石广澎
2024-06-04 14a52315c4bdcd7d04208f41696ffd3771dd8183
feat(支付): 权益平台配置
7个文件已修改
209 ■■■■ 已修改文件
common/api/index.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/config.js 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/http.interceptor.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/util.js 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/pay/discountpay.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/pay/scanpay.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/api/index.js
@@ -58,6 +58,8 @@
/* 微信支付 */
export const saveWxOrder = (params, config = {}) => http.post(URL +
    '/service-merchant/v1/web/aggregatePayAllin/saveWxOrder', params, config = {});
export const saveWxOrder1 = (params, config = {}) => http.post(URL +
    '/service-merchant/v1/web/aggregatePayAllin/saveOrder', params, config = {});
/* 图形验证吗 */
export const getVerify = (params, config = {}) => http.get(URL +
common/config.js
@@ -3,39 +3,35 @@
// 开发
const dev = {
    webURL: 'https://jmy.jinmingyuan.com/pay',
    baseURL: 'http://1.14.252.104:7101',
    sftpURL: 'https://echftp.jinmingyuan.com',
    imgUrl: 'https://echftp.jinmingyuan.com/platform/app/',
    wx_appid: 'wxad8cc511da676bd4',
    ali_appid:'2021003199690698'
}
// 支付测试
const payTest = {
    webURL: 'https://jmy.jinmingyuan.com/scanPay',
    baseURL: 'http://u2cgg5.natappfree.cc',
    baseURL: '/dev-api',
    sftpURL: 'https://yqzx.jinmingyuan.com/file',
    imgUrl: 'https://yqzx.jinmingyuan.com/file/platform/app/',
    wx_appid: 'wxad8cc511da676bd4',
    wx_appid: 'wxe4a1e9fddc509c46',
    ali_appid:'2021003199690698'
}
// 生态圈
const stq = {
    webURL: 'https://jmy.jinmingyuan.com/scanPay',
// 测试
const test = {
    webURL: 'https://sfzf.cpbtsoft.cn/pay',
    baseURL: 'https://sfzf.cpbtsoft.cn',
    sftpURL: 'https://sfzf.cpbtsoft.cn/file',
    wx_appid: 'wxe4a1e9fddc509c46',
    ali_appid: '2021003199690698'
}
// 正式
const prod = {
    webURL: 'https://jmy.jinmingyuan.com/pay',
    baseURL: 'https://yqzx.jinmingyuan.com',
    sftpURL: 'https://yqzx.jinmingyuan.com/file',
    imgUrl: 'https://yqzx.jinmingyuan.com/file/platform/app/',
    wx_appid: 'wxad8cc511da676bd4',
    ali_appid:'2021003199690698'
}
const cardType = {
    '00': '储蓄卡',
    '02': '信用卡'
}
module.exports = {
    config: stq,
    ACCESSTOKEN: "SCAN-WECHAT-TOKEN-HEADER",
    config: test,
    ACCESSTOKEN: "Authorization",
    /* 是否打印请求日志 */
    DEBUG: false,
    cardType: cardType
common/http.interceptor.js
@@ -43,9 +43,7 @@
        // 引用token
        const TOKEN = uni.getStorageSync(ACCESSTOKEN);
        if (TOKEN) {
            x.header[ACCESSTOKEN] = TOKEN;
        } else {
            delete x.header[ACCESSTOKEN]
            x.header[ACCESSTOKEN] = 'Bearer ' + TOKEN;
        }
        x.header['CLIENT-TYPE'] = appType()
        return x;
common/util.js
@@ -135,27 +135,6 @@
}
/**
 * 判断token是否存在
 */
export function getToken() {
    return uni.getStorageSync(ACCESSTOKEN);
}
/**
 * 判断token是否存在
 */
export function hasToken() {
    return !isBlank(getToken());
}
/**
 * 获取用户信息
 */
export function getUserInfo() {
    return JSON.parse(uni.getStorageSync('userInfo'))
}
/**
 * 判断两个数组的内容是否相同
 */
export function arrEquals(arr1, arr2) {
@@ -833,73 +812,6 @@
export function percentage(arg1, arg2) {
    var add = this.add(arg1, arg2)
    return this.mul(this.abs(arg1, add), 100)
}
/**
 * 查看网络状态
 * false 没有网络  true 有网络
 */
export function getNetworkStatus() {
    var result = ''
    uni.getNetworkType({
        success: (res) => {
            if (res.networkType == 'none') {
                // this.$u.toast("没有网络");
                result = false
            } else {
                // this.$u.toast("有网络");
                result = true
            }
        }
    })
    return result
}
/**
 * @param {Object} key 缓存的key
 * @param {Object} param 要缓存的对象
 * 将param push到缓存数组中
 */
export function setArrayStorageSync(key, param) {
    const data = uni.getStorageSync(key) || []
    data.push(param)
    uni.setStorageSync(key, data)
}
// 获取轮播图列表
export function getBannerImg(val, state) {
    let list = []
    if (!isBlank(val) && state === '2') {
        let arr = JSON.parse(val)
        arr.map(x => {
            list.push(config.sftpURL + x.path)
        })
    } else {
        list = [config.imgUrl + 'no-book.png']
    }
    return list
}
// 商品图片路径
export function getGoodsImg(val, state) {
    let headImg = ""
    if (!isBlank(val) && state === '2') {
        headImg = config.sftpURL + JSON.parse(val)[0].path
    } else {
        headImg = config.imgUrl + 'no-book.png'
    }
    return headImg
}
// 图片路径
export function GoodsImg(val) {
    let headImg = ""
    if (!isBlank(val)) {
        headImg = config.sftpURL + val
    } else {
        headImg = config.imgUrl + 'no-book.png'
    }
    return headImg
}
// 保留三位小数 末尾超过向上进1
manifest.json
@@ -73,12 +73,20 @@
    "h5" : {
        "title" : "支付",
        "router" : {
            "base" : "/scanPay/",
            "base" : "/pay/",
            "mode" : "history"
        },
        "devServer" : {
            "https" : false,
            "disableHostCheck" : true
            "proxy" : {
                "/dev-api" : {
                    "target" : "http://172.16.2.117:8080",
                    "changeOrigin" : true,
                    "secure" : false,
                    "pathRewrite" : {
                        "^/dev-api" : ""
                    }
                }
            }
        },
        "optimization" : {
            "treeShaking" : {
pages/pay/discountpay.vue
@@ -10,15 +10,15 @@
            </view>
        </view>
        <view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01"
    <!--        <view v-if="discountInfo.shopDiscount!=1&&money*(1-discountInfo.shopDiscount)>=0.01"
            class="bg-fff u-m-h-32 u-m-t-20 u-p-h-32 u-br-10">
            <view class="u-p-v-32 u-flex u-row-between u-border-bottom u-font-30 color-333">
                <view>{{discountInfo.memberGradeName}}专属折扣</view>
                <view>-{{ money*(1-discountInfo.shopDiscount).toFixed(2) }}</view>
            </view>
        </view>
        </view>-->
        <view v-if="canUseIntegral||canUseCoupon" class="u-p-h-32 bg-fff u-m-h-32 u-br-10">
            <view class="u-font-28 u-m-t-32">选择优惠方式</view>
<!--            <view class="u-font-28 u-m-t-32">选择优惠方式</view>
            <view v-if="canUseIntegral" class="u-p-v-24 u-border-bottom u-flex u-m-t-10">
                <image class="item-icon" style="align-self: flex-start;position: relative;top: -3rpx;"
                    src="/static/integral.png" mode=""></image>
@@ -29,7 +29,7 @@
                </view>
                <input-number @handleCount="changeInt" :value="canUseInt" :min="0" :max="maxIntegral">
                </input-number>
            </view>
            </view>-->
            <view v-if="canUseCoupon" class="u-flex u-p-v-32">
                <image class="item-icon" src="/static/coupon-icon.png" mode=""></image>
                <view class="u-font-30 u-flex-1 u-m-h-16">优惠券</view>
@@ -94,7 +94,7 @@
            <key-bord @changeMoney="changeMoney" :num.sync="money" @close="bordShow = false" @pay="pay"></key-bord>
        </u-popup>
        <!-- 支付验证码 -->
        <u-popup :show="codeShow" closeable mode="center" @close="codeShow = false">
<!--        <u-popup :show="codeShow" closeable mode="center" @close="codeShow = false">
            <view class="u-p-h-40 u-p-b-40">
                <view class="u-text-center u-p-t-20 u-m-b-30 u-font-34">请输入手机验证码</view>
                <view class="u-text-center u-m-b-20 color-666">{{ shopInfo.shop_name }}</view>
@@ -104,7 +104,7 @@
                <u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input>
            </view>
        </u-popup>
        </u-popup>-->
    </view>
</template>
pages/pay/scanpay.vue
@@ -27,8 +27,7 @@
          <view class="flex-1">
            <view class="u-font-30 color-333">支付宝</view>
            <text v-if="isNew" class="tag u-m-t-10">会员享优惠</text>
            <text v-if="!isNew&&token&&shopInfo.use_score_flag&&shopInfo.app_pay_use_score_flag"
                  class="u-font-24 color-999 u-m-t-10">
                        <text v-if="!isNew&&token&&shopInfo.use_score_flag&&shopInfo.app_pay_use_score_flag" class="u-font-24 color-999 u-m-t-10">
              可用
              <text class="color-red">{{ integral }}</text>
              积分
@@ -39,16 +38,14 @@
              parseFloat((couponInfo.thresholdValue / 100).toFixed(2))
            }}元减{{ parseFloat((couponInfo.discount / 100).toFixed(2)) }}元
          </view>
          <u-radio @change="radioChange($event,5)" :name="5" activeColor="#D41F28"
                   :customStyle="{ marginLeft: '10rpx' }"></u-radio>
                    <u-radio @change="radioChange($event,5)" :name="5" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }"></u-radio>
        </view>
        <view v-if="platform == 2" class="u-border-bottom u-p-v-20 u-flex u-row-between">
          <image src="@/static/imgs/pay-wx.png" class="pay-icon"></image>
          <view class="flex-1">
            <view class="u-font-30 color-333">微信</view>
            <text v-if="isNew" class="tag u-m-t-10">会员享优惠</text>
            <text v-if="!isNew&&token&&shopInfo.use_score_flag&&shopInfo.app_pay_use_score_flag"
                  class="u-font-24 color-999 u-m-t-10">
                        <text v-if="!isNew&&token&&shopInfo.use_score_flag&&shopInfo.app_pay_use_score_flag" class="u-font-24 color-999 u-m-t-10">
              可用
              <text class="color-red">{{ integral }}</text>
              积分
@@ -59,48 +56,42 @@
              parseFloat((couponInfo.thresholdValue / 100).toFixed(2))
            }}元减{{ parseFloat((couponInfo.discount / 100).toFixed(2)) }}元
          </view>
          <u-radio @change="radioChange($event,2)" :name="2" activeColor="#D41F28"
                   :customStyle="{ marginLeft: '10rpx' }">
                    <u-radio @change="radioChange($event,2)" :name="2" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
          </u-radio>
        </view>
        <navigator v-if="shuaka&&token&&bankCard!=-1" class="shuka" url="/pages/pay/shuaKa/shuaKa">
                <!-- <navigator v-if="shuaka&&token&&bankCard!=-1" class="shuka" url="/pages/pay/shuaKa/shuaKa">
          <image src="/static/shuaka/shuaka.png" mode=""></image>
        </navigator>
                </navigator> -->
        <view v-if="bankCard.id" class="u-border-bottom u-p-v-20 u-flex">
          <view @click="bordShow=false;bankCardOpen=true" class="flex-1 u-flex">
            <image :src="bankCardStyle.logo" class="pay-icon"></image>
            <view>
              <view class="u-font-30 color-333 u-flex">
                {{ bankCard.bankName }}({{ cardType[bankCard.cardType] }})({{ bankCard.cardNo }})
                <u-icon name="arrow-right"
                        color="#000">
                                <u-icon name="arrow-right" color="#000">
                </u-icon>
              </view>
              <!-- <text v-if="isNew" class="tag u-m-t-10">会员享优惠</text> -->
              <text v-if="!isNew&&shopInfo.use_score_flag&&shopInfo.bank_pay_use_score_flag"
                    class="u-font-24 color-999 u-m-t-10">
                            <text v-if="!isNew&&shopInfo.use_score_flag&&shopInfo.bank_pay_use_score_flag" class="u-font-24 color-999 u-m-t-10">
                可用
                <text class="color-red">{{ integral }}</text>
                积分
              </text>
            </view>
          </view>
          <view v-if="!isNew&&shopInfo.user_coupon_flag&&shopInfo.bank_pay_use_coupon_flag&&couponInfo"
                class="tag-pain">
                    <view v-if="!isNew&&shopInfo.user_coupon_flag&&shopInfo.bank_pay_use_coupon_flag&&couponInfo" class="tag-pain">
            满{{
              parseFloat((couponInfo.thresholdValue / 100).toFixed(2))
            }}元减{{ parseFloat((couponInfo.discount / 100).toFixed(2)) }}元
          </view>
          <u-radio @change="radioChange($event,3, bankCard.id)" :name="3" activeColor="#D41F28"
                   :customStyle="{ marginLeft: '10rpx' }">
                    <u-radio @change="radioChange($event,3, bankCard.id)" :name="3" activeColor="#D41F28" :customStyle="{ marginLeft: '10rpx' }">
          </u-radio>
        </view>
      </u-radio-group>
      <navigator v-if="bankCard==-1&&bindCard&&token&&!isNew" class="shuka" url="/pages/pay/bindCard/bindCard">
            <!-- <navigator v-if="bankCard==-1&&bindCard&&token&&!isNew" class="shuka" url="/pages/pay/bindCard/bindCard">
        <image src="/static/bangka.png" mode=""></image>
      </navigator>
      <navigator v-if="bankCard==-1&&!isNew" url="/pages/pay/bindCard/bindCard"
                 class="u-border-bottom u-p-v-20 u-flex u-row-between">
            <navigator v-if="bankCard==-1&&!isNew" url="/pages/pay/bindCard/bindCard" class="u-border-bottom u-p-v-20 u-flex u-row-between">
        <view class="u-flex-1 u-flex ">
          <image class="pay-icon" :src="bankCardStyle.logo" mode=""></image>
          <view class="flex-1 u-m-l-20">
@@ -110,7 +101,7 @@
        </view>
        <u-radio disabled activeColor="#D41F28" :customStyle="{ marginLeft: '30rpx' }">
        </u-radio>
      </navigator>
            </navigator> -->
      <navigator v-if="isNew" class="reg-btn" :url="'/pages/pay/register?cid='+cid">
        <image src="/static/register-btn.png" mode=""></image>
      </navigator>
@@ -154,8 +145,7 @@
        <view class="u-text-center u-m-b-20 color-666">{{ shopInfo.shop_name }}</view>
        <view class="u-flex u-row-center font-bold u-m-b-40">
          <text class="u-font-42">¥</text>
          <text
              class="u-font-money">{{ money }}
                    <text class="u-font-money">{{ money }}
          </text>
        </view>
        <u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input>
@@ -299,8 +289,8 @@
      if (this.count >= this.end) {
        uni.hideLoading()
      }
      this.token = res.token.accessToken
      uni.setStorageSync(ACCESSTOKEN, res.token.accessToken)
                this.token = res.token
                uni.setStorageSync(ACCESSTOKEN, res.token)
      uni.setStorageSync('IS_NEW', res.isNew)
      this.isNew = res.isNew
      if (!res.isNew) {
@@ -323,7 +313,7 @@
      this.bordShow = true;
    },
    init() {
      this.end += 5
                this.end += 1
      //获取商铺信息
      queryShop({
        params: {
@@ -347,6 +337,10 @@
      }).catch(() => {
        uni.hideLoading()
      })
            },
            //查询营销信息
            getMarketing(){
                this.end += 4
      // 刷卡有礼
      activityInfo().then(res => {
        this.count++
@@ -421,11 +415,10 @@
          uni.hideLoading()
        })
      }
    },
    // 获取会员相关信息
    getUserInfo() {
      this.end += 4
                this.end += 2
      queryMyDiscount({
        shopId: this.shopInfo.id
@@ -443,7 +436,7 @@
          uni.hideLoading()
        }
      })
      //获取用户银行卡
                /* //获取用户银行卡
      myBankCard().then(res => {
        this.count++
        if (this.count >= this.end) {
@@ -476,7 +469,7 @@
        if (this.count >= this.end) {
          uni.hideLoading()
        }
      })
                }) */
      //获取用户优惠券
      queryMyUseSweepPayMaxCoupon({
        params: {