From 14a52315c4bdcd7d04208f41696ffd3771dd8183 Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期二, 04 六月 2024 18:02:17 +0800
Subject: [PATCH] feat(支付): 权益平台配置
---
common/http.interceptor.js | 6
common/util.js | 88 --
pages/pay/scanpay.vue | 1589 ++++++++++++++++++++++++++--------------------------
manifest.json | 14
pages/pay/discountpay.vue | 12
common/config.js | 40
common/api/index.js | 2
7 files changed, 830 insertions(+), 921 deletions(-)
diff --git a/common/api/index.js b/common/api/index.js
index acb54f9..063a7f4 100644
--- a/common/api/index.js
+++ b/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 +
diff --git a/common/config.js b/common/config.js
index 7abfc07..3a4d60a 100644
--- a/common/config.js
+++ b/common/config.js
@@ -3,40 +3,36 @@
// 寮�鍙�
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',
- ali_appid:'2021003199690698'
+ 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'
+}
+// 姝e紡
+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'
+ ali_appid: '2021003199690698'
}
-
const cardType = {
'00': '鍌ㄨ搫鍗�',
'02': '淇$敤鍗�'
}
module.exports = {
- config: stq,
- ACCESSTOKEN: "SCAN-WECHAT-TOKEN-HEADER",
+ config: test,
+ ACCESSTOKEN: "Authorization",
/* 鏄惁鎵撳嵃璇锋眰鏃ュ織 */
DEBUG: false,
cardType: cardType
-}
+}
\ No newline at end of file
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index f12595f..77fa8f2 100644
--- a/common/http.interceptor.js
+++ b/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;
@@ -78,4 +76,4 @@
vm.$u.toast("璇锋眰寮傚父锛�"); //閿欒鎻愮ず淇℃伅
return Promise.reject(response)
})
-}
+}
\ No newline at end of file
diff --git a/common/util.js b/common/util.js
index 2084eb2..f345d22 100644
--- a/common/util.js
+++ b/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 缂撳瓨鐨刱ey
- * @param {Object} param 瑕佺紦瀛樼殑瀵硅薄
- * 灏唒aram 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
diff --git a/manifest.json b/manifest.json
index fe6bbed..ec9b69c 100644
--- a/manifest.json
+++ b/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" : {
diff --git a/pages/pay/discountpay.vue b/pages/pay/discountpay.vue
index 32604c9..15038c8 100644
--- a/pages/pay/discountpay.vue
+++ b/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>
diff --git a/pages/pay/scanpay.vue b/pages/pay/scanpay.vue
index 790e6d5..e4d5af6 100644
--- a/pages/pay/scanpay.vue
+++ b/pages/pay/scanpay.vue
@@ -1,852 +1,845 @@
<!-- 鎵爜鏀粯 -->
<template>
- <view class="page">
- <view class="shop u-flex u-row-between">
- <view class="u-m-r-30">
- <view class="u-font-28 color-666 u-m-b-10">浠樻缁�</view>
- <view class="u-font-34 font-bold color-333">{{ shopInfo.shop_name }}</view>
- </view>
- <image :src="shopInfo.logo_image||'/static/imgs/store-logo.png'" class="avg-img"></image>
- </view>
- <view class="u-p-48 bg-fff u-flex-1 content">
- <view class="u-font-28 color-666">閲戦</view>
- <view class="u-p-v-20 u-flex u-border-bottom u-relative">
- <view class="money-icon color-333">楼</view>
- <view class="u-flex-1 u-flex u-m-l-10" style="height: 80rpx;">
- <view v-if="money" class="money-num">{{ money }}</view>
- <view :class="['cursor',{'cursor-act':!money&&bordShow}]"></view>
- <view v-if="!money" class="u-font-50 color-999">璇疯緭鍏ラ噾棰�</view>
- <view :class="['cursor',{'cursor-act':money&&bordShow}]"></view>
- </view>
- <view class="mask" @click="showBord"></view>
- </view>
- <view class="u-font-28 color-666 u-m-t-60">閫夋嫨鏀粯鏂瑰紡</view>
- <u-radio-group v-model="payWay" placement="column">
- <view v-if="platform == 5" class="u-border-bottom u-p-v-20 u-flex u-row-between">
- <image src="@/static/imgs/pay-zfb.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 class="color-red">{{ integral }}</text>
- 绉垎
- </text>
- </view>
- <view v-if="token&&couponInfo&&shopInfo.user_coupon_flag&&shopInfo.app_pay_use_coupon_flag" class="tag-pain">
- 婊{
+ <view class="page">
+ <view class="shop u-flex u-row-between">
+ <view class="u-m-r-30">
+ <view class="u-font-28 color-666 u-m-b-10">浠樻缁�</view>
+ <view class="u-font-34 font-bold color-333">{{ shopInfo.shop_name }}</view>
+ </view>
+ <image :src="shopInfo.logo_image||'/static/imgs/store-logo.png'" class="avg-img"></image>
+ </view>
+ <view class="u-p-48 bg-fff u-flex-1 content">
+ <view class="u-font-28 color-666">閲戦</view>
+ <view class="u-p-v-20 u-flex u-border-bottom u-relative">
+ <view class="money-icon color-333">楼</view>
+ <view class="u-flex-1 u-flex u-m-l-10" style="height: 80rpx;">
+ <view v-if="money" class="money-num">{{ money }}</view>
+ <view :class="['cursor',{'cursor-act':!money&&bordShow}]"></view>
+ <view v-if="!money" class="u-font-50 color-999">璇疯緭鍏ラ噾棰�</view>
+ <view :class="['cursor',{'cursor-act':money&&bordShow}]"></view>
+ </view>
+ <view class="mask" @click="showBord"></view>
+ </view>
+ <view class="u-font-28 color-666 u-m-t-60">閫夋嫨鏀粯鏂瑰紡</view>
+ <u-radio-group v-model="payWay" placement="column">
+ <view v-if="platform == 5" class="u-border-bottom u-p-v-20 u-flex u-row-between">
+ <image src="@/static/imgs/pay-zfb.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 class="color-red">{{ integral }}</text>
+ 绉垎
+ </text>
+ </view>
+ <view v-if="token&&couponInfo&&shopInfo.user_coupon_flag&&shopInfo.app_pay_use_coupon_flag" class="tag-pain">
+ 婊{
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>
- </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 class="color-red">{{ integral }}</text>
- 绉垎
- </text>
- </view>
- <view v-if="token&&couponInfo&&shopInfo.user_coupon_flag&&shopInfo.app_pay_use_coupon_flag" class="tag-pain">
- 婊{
+ </view>
+ <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 class="color-red">{{ integral }}</text>
+ 绉垎
+ </text>
+ </view>
+ <view v-if="token&&couponInfo&&shopInfo.user_coupon_flag&&shopInfo.app_pay_use_coupon_flag" class="tag-pain">
+ 婊{
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>
- </view>
- <navigator v-if="shuaka&&token&&bankCard!=-1" class="shuka" url="/pages/pay/shuaKa/shuaKa">
- <image src="/static/shuaka/shuaka.png" mode=""></image>
- </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>
- </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 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>
+ <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">
+ <image src="/static/shuaka/shuaka.png" mode=""></image>
+ </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>
+ </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 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">
+ 婊{
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>
- </view>
- </u-radio-group>
- <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">
- <view class="u-flex-1 u-flex ">
- <image class="pay-icon" :src="bankCardStyle.logo" mode=""></image>
- <view class="flex-1 u-m-l-20">
- <view class="u-font-30 color-333">閾惰鍗�</view>
- <view class="u-font-24 color-red">缁戝崱鍙韩鏇村浼樻儬</view>
- </view>
- </view>
- <u-radio disabled activeColor="#D41F28" :customStyle="{ marginLeft: '30rpx' }">
- </u-radio>
- </navigator>
- <navigator v-if="isNew" class="reg-btn" :url="'/pages/pay/register?cid='+cid">
- <image src="/static/register-btn.png" mode=""></image>
- </navigator>
- </view>
+ </view>
+ <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">
+ <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">
+ <view class="u-flex-1 u-flex ">
+ <image class="pay-icon" :src="bankCardStyle.logo" mode=""></image>
+ <view class="flex-1 u-m-l-20">
+ <view class="u-font-30 color-333">閾惰鍗�</view>
+ <view class="u-font-24 color-red">缁戝崱鍙韩鏇村浼樻儬</view>
+ </view>
+ </view>
+ <u-radio disabled activeColor="#D41F28" :customStyle="{ marginLeft: '30rpx' }">
+ </u-radio>
+ </navigator> -->
+ <navigator v-if="isNew" class="reg-btn" :url="'/pages/pay/register?cid='+cid">
+ <image src="/static/register-btn.png" mode=""></image>
+ </navigator>
+ </view>
- <button class="pay-it" @click="pay">浠樻</button>
- <!-- 閫夋嫨閾惰鍗� -->
- <u-popup mode="bottom" :closeable="true" :show="bankCardOpen" :round="10" @close="bankCardOpen = false">
- <view class="u-font-32 color-333 u-text-center u-p-30 u-border-bottom">閫夋嫨閾惰鏀粯</view>
- <scroll-view scroll-y class="u-p-h-30 bankCard-list">
- <block v-for="(item,i) in bankCardList" :key="i">
- <view @click="chooseBankCard(item)" class="u-border-bottom u-p-v-30 u-flex">
- <view class="flex-1 u-flex">
- <image :src="bankCardStyle.logo" class="pay-icon"></image>
- <view>
- <view class="u-font-26 color-333">{{ item.bankName }}</view>
- <view class="u-m-t-10 u-font-28 color-333">{{ cardType[item.cardType] }}({{ item.cardNo }})
- </view>
- </view>
- </view>
- <u-icon name="checkbox-mark" :color="bankCardId==item.id?'#D31F28':'#fff'" size="22"></u-icon>
- </view>
- </block>
- <navigator url="/pages/pay/bindCard/bindCard" class="u-border-bottom u-p-v-30 u-flex">
- <view class="add-icon">
- <u-icon name="plus" bold color="#D31F28"></u-icon>
- </view>
- <view class="u-font-28 color-333 u-m-l-20">浣跨敤鏂板崱鏀粯</view>
- </navigator>
- </scroll-view>
- </u-popup>
- <!-- 鏁板瓧閿洏 -->
- <u-popup :show="bordShow" :overlay="false" @close="bordShow = false">
- <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">
- <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>
- <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>
- </view>
- <u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input>
- </view>
+ <button class="pay-it" @click="pay">浠樻</button>
+ <!-- 閫夋嫨閾惰鍗� -->
+ <u-popup mode="bottom" :closeable="true" :show="bankCardOpen" :round="10" @close="bankCardOpen = false">
+ <view class="u-font-32 color-333 u-text-center u-p-30 u-border-bottom">閫夋嫨閾惰鏀粯</view>
+ <scroll-view scroll-y class="u-p-h-30 bankCard-list">
+ <block v-for="(item,i) in bankCardList" :key="i">
+ <view @click="chooseBankCard(item)" class="u-border-bottom u-p-v-30 u-flex">
+ <view class="flex-1 u-flex">
+ <image :src="bankCardStyle.logo" class="pay-icon"></image>
+ <view>
+ <view class="u-font-26 color-333">{{ item.bankName }}</view>
+ <view class="u-m-t-10 u-font-28 color-333">{{ cardType[item.cardType] }}({{ item.cardNo }})
+ </view>
+ </view>
+ </view>
+ <u-icon name="checkbox-mark" :color="bankCardId==item.id?'#D31F28':'#fff'" size="22"></u-icon>
+ </view>
+ </block>
+ <navigator url="/pages/pay/bindCard/bindCard" class="u-border-bottom u-p-v-30 u-flex">
+ <view class="add-icon">
+ <u-icon name="plus" bold color="#D31F28"></u-icon>
+ </view>
+ <view class="u-font-28 color-333 u-m-l-20">浣跨敤鏂板崱鏀粯</view>
+ </navigator>
+ </scroll-view>
+ </u-popup>
+ <!-- 鏁板瓧閿洏 -->
+ <u-popup :show="bordShow" :overlay="false" @close="bordShow = false">
+ <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">
+ <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>
+ <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>
+ </view>
+ <u-code-input @finish="bankPay" v-model="smscode" mode="box" :focus="true"></u-code-input>
+ </view>
- </u-popup>
- </view>
+ </u-popup>
+ </view>
</template>
<script>
-import {
- config,
- cardType,
- ACCESSTOKEN
-} from '@/common/config.js';
-import {
- headBand,
- bankCardStyle,
- myBankCard,
- queryShop,
- queryMyDiscount,
- getScoreWorth,
- userLogin,
- queryScore,
- queryMyUseSweepPayMaxCoupon,
- getWechatConfigInfo,
- saveWxOrder,
- tlPay
-} from '@/common/api/index'
-import wx from 'weixin-js-sdk'; // 浣跨敤js-sdk
-import {
- activityInfo
-} from '@/common/api/shuaka'
+ import {
+ config,
+ cardType,
+ ACCESSTOKEN
+ } from '@/common/config.js';
+ import {
+ headBand,
+ bankCardStyle,
+ myBankCard,
+ queryShop,
+ queryMyDiscount,
+ getScoreWorth,
+ userLogin,
+ queryScore,
+ queryMyUseSweepPayMaxCoupon,
+ getWechatConfigInfo,
+ saveWxOrder,
+ tlPay
+ } from '@/common/api/index'
+ import wx from 'weixin-js-sdk'; // 浣跨敤js-sdk
+ import {
+ activityInfo
+ } from '@/common/api/shuaka'
-export default {
- data() {
- return {
- platform: this.$utils.getPlat(),
- cardType: cardType,
- cid: '',
- bordShow: false, // 鏄剧ず閿洏
- scoreWorth: 0,
- shopInfo: {
- shop_name: '',
- scan_flag: '',
- use_score_flag: 0, //鍟嗛摵鏄惁鍙敤绉垎 0鍚� 1鏄�
- user_coupon_flag: 0, //鍟嗛摵鏄惁鍙敤浼樻儬鍒� 0鍚� 1鏄�
- app_pay_use_score_flag: 0, //寰俊/鏀粯瀹濇槸鍚﹀彲鐢ㄧН鍒� 0鍚� 1鏄�
- app_pay_use_coupon_flag: 0, //寰俊/鏀粯瀹濇槸鍚﹀彲鐢ㄤ紭鎯犲埜 0鍚� 1鏄�
- bank_pay_use_score_flag: 0, //閾惰鍗℃敮浠樻槸鍚﹀彲鐢ㄧН鍒� 0鍚� 1鏄�
- bank_pay_use_coupon_flag: 0, //閾惰鍗℃敮浠樻槸鍚﹀彲鐢ㄤ紭鎯犲埜 0鍚� 1鏄�
- },
- money: '', // 閲戦
- integral: 0, // 浣跨敤绉垎
- couponInfo: null, // 浼樻儬鍒稿唴瀹�
- payWay: 3, //鏀粯鏂瑰紡 5 鏀粯瀹� 2 寰俊 3閾惰鍗�
- token: null,
- isNew: false, // 鏄惁鏂扮敤鎴凤紝鏂扮敤鎴锋煡璇笉鍒扮Н鍒嗗拰閾惰鍗�
- codeShow: false, // 閾惰鍗℃敮浠橀獙璇佺爜杈撳叆寮圭獥
- smscode: '', // 閾惰鍗℃敮浠橀獙璇佺爜
- thpinfo: null,
- bankCardStyle: {
- color: '',
- logo: ''
- },
- bankCardList: [], //閾惰鍗″垪琛�
- bankCard: -1, // 閫変腑閾惰鍗�
- bankCardId: null, // 閫変腑閾惰鍗�
- bankCardOpen: false,
- canReset: false,
- end: 0,
- count: 0,
- shuaka: null, //鍒峰崱娲诲姩
- bindCard: false, // 缁戝崱鏈夌ぜ
- discount: {
- memberGradeName: '',
- shopDiscount: 10
- },
- aLiUserId: ''
- };
- },
- onLoad(opt) {
- this.isNew = uni.getStorageSync('IS_NEW')
- uni.showLoading()
- this.payWay = this.platform
- if (opt.cid) {
- this.cid = opt.cid
- uni.setStorageSync('CID', opt.cid)
- this.init()
- }
- if (opt.code || opt.auth_code) {
- let code = opt.code
- if (this.platform == 5) {
- code = opt.auth_code
- }
- this.end++
- userLogin({
- platform: this.platform,
- params: {
- code
- }
- }).then(res => {
- this.getToken(res)
- }).catch(() => {
- uni.hideLoading()
- })
- } else {
- if (process.env.NODE_ENV === 'development') {
- console.log('寮�鍙戠幆澧�');
- } else {
- console.log('鐢熶骇鐜');
- const redirect_uri = encodeURIComponent(window.location.href.split('?')[0] + '?cid=' + this.cid)
- if (this.platform == 2) {
- window.location.href =
- `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.wx_appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
- } else if (this.platform == 5) {
- window.location.href =
- `https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=${config.ali_appid}&scope=auth_base&redirect_uri=${redirect_uri}&state=STATE`
- }
- }
- }
+ export default {
+ data() {
+ return {
+ platform: this.$utils.getPlat(),
+ cardType: cardType,
+ cid: '',
+ bordShow: false, // 鏄剧ず閿洏
+ scoreWorth: 0,
+ shopInfo: {
+ shop_name: '',
+ scan_flag: '',
+ use_score_flag: 0, //鍟嗛摵鏄惁鍙敤绉垎 0鍚� 1鏄�
+ user_coupon_flag: 0, //鍟嗛摵鏄惁鍙敤浼樻儬鍒� 0鍚� 1鏄�
+ app_pay_use_score_flag: 0, //寰俊/鏀粯瀹濇槸鍚﹀彲鐢ㄧН鍒� 0鍚� 1鏄�
+ app_pay_use_coupon_flag: 0, //寰俊/鏀粯瀹濇槸鍚﹀彲鐢ㄤ紭鎯犲埜 0鍚� 1鏄�
+ bank_pay_use_score_flag: 0, //閾惰鍗℃敮浠樻槸鍚﹀彲鐢ㄧН鍒� 0鍚� 1鏄�
+ bank_pay_use_coupon_flag: 0, //閾惰鍗℃敮浠樻槸鍚﹀彲鐢ㄤ紭鎯犲埜 0鍚� 1鏄�
+ },
+ money: '', // 閲戦
+ integral: 0, // 浣跨敤绉垎
+ couponInfo: null, // 浼樻儬鍒稿唴瀹�
+ payWay: 3, //鏀粯鏂瑰紡 5 鏀粯瀹� 2 寰俊 3閾惰鍗�
+ token: null,
+ isNew: false, // 鏄惁鏂扮敤鎴凤紝鏂扮敤鎴锋煡璇笉鍒扮Н鍒嗗拰閾惰鍗�
+ codeShow: false, // 閾惰鍗℃敮浠橀獙璇佺爜杈撳叆寮圭獥
+ smscode: '', // 閾惰鍗℃敮浠橀獙璇佺爜
+ thpinfo: null,
+ bankCardStyle: {
+ color: '',
+ logo: ''
+ },
+ bankCardList: [], //閾惰鍗″垪琛�
+ bankCard: -1, // 閫変腑閾惰鍗�
+ bankCardId: null, // 閫変腑閾惰鍗�
+ bankCardOpen: false,
+ canReset: false,
+ end: 0,
+ count: 0,
+ shuaka: null, //鍒峰崱娲诲姩
+ bindCard: false, // 缁戝崱鏈夌ぜ
+ discount: {
+ memberGradeName: '',
+ shopDiscount: 10
+ },
+ aLiUserId: ''
+ };
+ },
+ onLoad(opt) {
+ this.isNew = uni.getStorageSync('IS_NEW')
+ uni.showLoading()
+ this.payWay = this.platform
+ if (opt.cid) {
+ this.cid = opt.cid
+ uni.setStorageSync('CID', opt.cid)
+ this.init()
+ }
+ if (opt.code || opt.auth_code) {
+ let code = opt.code
+ if (this.platform == 5) {
+ code = opt.auth_code
+ }
+ this.end++
+ userLogin({
+ platform: this.platform,
+ params: {
+ code
+ }
+ }).then(res => {
+ this.getToken(res)
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ } else {
+ if (process.env.NODE_ENV === 'development') {
+ console.log('寮�鍙戠幆澧�');
+ } else {
+ console.log('鐢熶骇鐜');
+ const redirect_uri = encodeURIComponent(window.location.href.split('?')[0] + '?cid=' + this.cid)
+ if (this.platform == 2) {
+ window.location.href =
+ `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${config.wx_appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+ } else if (this.platform == 5) {
+ window.location.href =
+ `https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=${config.ali_appid}&scope=auth_base&redirect_uri=${redirect_uri}&state=STATE`
+ }
+ }
+ }
- },
- onShow() {
- this.token = uni.getStorageSync(ACCESSTOKEN) || null
- this.bordShow = false
- this.bankCardOpen = false
- this.codeShow = false
- this.smscode = ''
- if (this.canReset && this.token && !this.isNew) {
- this.end = 0
- this.count = 0
- uni.showLoading()
- this.getUserInfo()
- }
- this.canReset = true
- },
- methods: {
- getToken(res){
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.token = res.token.accessToken
- uni.setStorageSync(ACCESSTOKEN, res.token.accessToken)
- uni.setStorageSync('IS_NEW', res.isNew)
- this.isNew = res.isNew
- if (!res.isNew) {
- this.getUserInfo()
- }
- },
- radioChange(e, item, bankCardId) {
- this.bordShow = false
- this.payWay = item
- if(bankCardId){
- this.bankCardId = bankCardId
- }
- },
- // 鏇存柊閲戦
- changeMoney(str) {
- this.money = str;
- },
- // 灞曠ず閿洏
- showBord() {
- this.bordShow = true;
- },
- init() {
- this.end += 5
- //鑾峰彇鍟嗛摵淇℃伅
- queryShop({
- params: {
- cid: this.cid
- }
- }).then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- if (res.logo_image) {
- try {
- let arr = JSON.parse(res.logo_image)
- res.logo_image = config.sftpURL + arr[0].path
- } catch (e) {
- //TODO handle the exception
- res.logo_image = ''
- }
- }
- this.shopInfo = res
- }).catch(() => {
- uni.hideLoading()
- })
- // 鍒峰崱鏈夌ぜ
- activityInfo().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.shuaka = res
- }).catch(() => {
- uni.hideLoading()
- })
- // 棣栫粦鏈夌ぜ
- headBand().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.bindCard = res
- }).catch(() => {
- uni.hideLoading()
- })
- // 绉垎浠峰��
- getScoreWorth().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.scoreWorth = res.settingVal
- }).catch(() => {
- uni.hideLoading()
- })
- //鑾峰彇閾惰鍗¢鏍奸厤缃�
- bankCardStyle().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- try {
- let arr = JSON.parse(res.logo)
- res.logo = config.sftpURL + arr[0].path
- } catch (e) {
- //TODO handle the exception
- res.logo = ''
- }
- this.bankCardStyle = res
- uni.setStorageSync('bankCardStyle', res)
- }).catch(() => {
- uni.hideLoading()
- })
- if (this.platform == 2) {
- this.end += 1
- //鑾峰彇寰俊jsSdk閰嶇疆
- const uri = encodeURIComponent(window.location)
- getWechatConfigInfo({
- url: uri
- }).then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- wx.config({
- debug: false, // 寮�鍚皟璇曟ā寮�
- appId: res.appId, // 蹇呭~锛屽叕浼楀彿鐨勫敮涓�鏍囪瘑
- timestamp: res.timestamp, // 蹇呭~锛岀敓鎴愮鍚嶇殑鏃堕棿鎴�
- nonceStr: res.noncestr, // 蹇呭~锛岀敓鎴愮鍚嶇殑闅忔満涓�
- signature: res.signature, // 蹇呭~锛岀鍚�
- jsApiList: ['chooseWXPay'], // 蹇呭~锛岄渶瑕佷娇鐢ㄧ殑 JS 鎺ュ彛鍒楄〃
- openTagList: [
- 'wx-open-launch-weapp'
- ] // 鍙�夛紝闇�瑕佷娇鐢ㄧ殑寮�鏀炬爣绛惧垪琛紝渚嬪['wx-open-launch-app']
- });
- }).catch(() => {
- uni.hideLoading()
- })
- }
+ },
+ onShow() {
+ this.token = uni.getStorageSync(ACCESSTOKEN) || null
+ this.bordShow = false
+ this.bankCardOpen = false
+ this.codeShow = false
+ this.smscode = ''
+ if (this.canReset && this.token && !this.isNew) {
+ this.end = 0
+ this.count = 0
+ uni.showLoading()
+ this.getUserInfo()
+ }
+ this.canReset = true
+ },
+ methods: {
+ getToken(res) {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.token = res.token
+ uni.setStorageSync(ACCESSTOKEN, res.token)
+ uni.setStorageSync('IS_NEW', res.isNew)
+ this.isNew = res.isNew
+ if (!res.isNew) {
+ this.getUserInfo()
+ }
+ },
+ radioChange(e, item, bankCardId) {
+ this.bordShow = false
+ this.payWay = item
+ if (bankCardId) {
+ this.bankCardId = bankCardId
+ }
+ },
+ // 鏇存柊閲戦
+ changeMoney(str) {
+ this.money = str;
+ },
+ // 灞曠ず閿洏
+ showBord() {
+ this.bordShow = true;
+ },
+ init() {
+ this.end += 1
+ //鑾峰彇鍟嗛摵淇℃伅
+ queryShop({
+ params: {
+ cid: this.cid
+ }
+ }).then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ if (res.logo_image) {
+ try {
+ let arr = JSON.parse(res.logo_image)
+ res.logo_image = config.sftpURL + arr[0].path
+ } catch (e) {
+ //TODO handle the exception
+ res.logo_image = ''
+ }
+ }
+ this.shopInfo = res
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ },
+ //鏌ヨ钀ラ攢淇℃伅
+ getMarketing(){
+ this.end += 4
+ // 鍒峰崱鏈夌ぜ
+ activityInfo().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.shuaka = res
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ // 棣栫粦鏈夌ぜ
+ headBand().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.bindCard = res
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ // 绉垎浠峰��
+ getScoreWorth().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.scoreWorth = res.settingVal
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ //鑾峰彇閾惰鍗¢鏍奸厤缃�
+ bankCardStyle().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ try {
+ let arr = JSON.parse(res.logo)
+ res.logo = config.sftpURL + arr[0].path
+ } catch (e) {
+ //TODO handle the exception
+ res.logo = ''
+ }
+ this.bankCardStyle = res
+ uni.setStorageSync('bankCardStyle', res)
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ if (this.platform == 2) {
+ this.end += 1
+ //鑾峰彇寰俊jsSdk閰嶇疆
+ const uri = encodeURIComponent(window.location)
+ getWechatConfigInfo({
+ url: uri
+ }).then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ wx.config({
+ debug: false, // 寮�鍚皟璇曟ā寮�
+ appId: res.appId, // 蹇呭~锛屽叕浼楀彿鐨勫敮涓�鏍囪瘑
+ timestamp: res.timestamp, // 蹇呭~锛岀敓鎴愮鍚嶇殑鏃堕棿鎴�
+ nonceStr: res.noncestr, // 蹇呭~锛岀敓鎴愮鍚嶇殑闅忔満涓�
+ signature: res.signature, // 蹇呭~锛岀鍚�
+ jsApiList: ['chooseWXPay'], // 蹇呭~锛岄渶瑕佷娇鐢ㄧ殑 JS 鎺ュ彛鍒楄〃
+ openTagList: [
+ 'wx-open-launch-weapp'
+ ] // 鍙�夛紝闇�瑕佷娇鐢ㄧ殑寮�鏀炬爣绛惧垪琛紝渚嬪['wx-open-launch-app']
+ });
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ }
+ },
+ // 鑾峰彇浼氬憳鐩稿叧淇℃伅
+ getUserInfo() {
+ this.end += 2
- },
- // 鑾峰彇浼氬憳鐩稿叧淇℃伅
- getUserInfo() {
- this.end += 4
+ queryMyDiscount({
+ shopId: this.shopInfo.id
+ }).then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ res.shopDiscount = parseFloat(res.shopDiscount / 10)
+ this.discount = res
+ uni.setStorageSync('DISCOUNT_INFO', res)
+ }).catch(() => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ })
+ /* //鑾峰彇鐢ㄦ埛閾惰鍗�
+ myBankCard().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.bankCardList = res.rows
+ if (res.rows[0]) {
+ this.bankCard = res.rows[0]
+ if (this.platform == 3) {
+ this.bankCardId = res.rows[0].id
+ }
+ } else {
+ this.bankCard = -1
+ }
+ }).catch(() => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ })
+ //鑾峰彇鐢ㄦ埛绉垎
+ queryScore().then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.integral = res.totalScore
+ }).catch(() => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ }) */
+ //鑾峰彇鐢ㄦ埛浼樻儬鍒�
+ queryMyUseSweepPayMaxCoupon({
+ params: {
+ shopId: this.shopInfo.id
+ }
+ }).then(res => {
- queryMyDiscount({
- shopId: this.shopInfo.id
- }).then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- res.shopDiscount = parseFloat(res.shopDiscount / 10)
- this.discount = res
- uni.setStorageSync('DISCOUNT_INFO', res)
- }).catch(() => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- })
- //鑾峰彇鐢ㄦ埛閾惰鍗�
- myBankCard().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.bankCardList = res.rows
- if (res.rows[0]) {
- this.bankCard = res.rows[0]
- if (this.platform == 3) {
- this.bankCardId = res.rows[0].id
- }
- } else {
- this.bankCard = -1
- }
- }).catch(() => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- })
- //鑾峰彇鐢ㄦ埛绉垎
- queryScore().then(res => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.integral = res.totalScore
- }).catch(() => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- })
- //鑾峰彇鐢ㄦ埛浼樻儬鍒�
- queryMyUseSweepPayMaxCoupon({
- params: {
- shopId: this.shopInfo.id
- }
- }).then(res => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ this.couponInfo = res
+ }).catch(() => {
+ this.count++
+ if (this.count >= this.end) {
+ uni.hideLoading()
+ }
+ })
+ },
+ // 閫夋嫨閾惰鍗�
+ chooseBankCard(item) {
+ this.payWay = 3
+ this.bankCard = item;
+ this.$nextTick(() => {
+ this.bankCardId = item.id
+ this.bankCardOpen = false
+ })
+ },
+ //璺宠浆钀ラ攢椤甸潰
+ toDiscount() {
+ const shopInfo = encodeURIComponent(JSON.stringify(this.shopInfo))
+ if (!this.isNew) { //鏄細鍛�
+ if (this.integral > 0 || this.couponInfo) { //鏈変紭鎯犲埜鎴栫Н鍒�
+ if (this.payWay == 3 && (this.shopInfo.bank_pay_use_score_flag || this.shopInfo
+ .bank_pay_use_coupon_flag)) { //閾惰鍗℃敮浠�
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- this.couponInfo = res
- }).catch(() => {
- this.count++
- if (this.count >= this.end) {
- uni.hideLoading()
- }
- })
- },
- // 閫夋嫨閾惰鍗�
- chooseBankCard(item) {
- this.payWay = 3
- this.bankCard = item;
- this.$nextTick(() => {
- this.bankCardId = item.id
- this.bankCardOpen = false
- })
- },
- //璺宠浆钀ラ攢椤甸潰
- toDiscount() {
- const shopInfo = encodeURIComponent(JSON.stringify(this.shopInfo))
- if (!this.isNew) { //鏄細鍛�
- if (this.integral > 0 || this.couponInfo) { //鏈変紭鎯犲埜鎴栫Н鍒�
- if (this.payWay == 3 && (this.shopInfo.bank_pay_use_score_flag || this.shopInfo
- .bank_pay_use_coupon_flag)) { //閾惰鍗℃敮浠�
+ uni.navigateTo({
+ url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ })
+ return false
+ } else if ((this.shopInfo.use_score_flag && this.shopInfo.app_pay_use_score_flag) || (this
+ .shopInfo
+ .user_coupon_flag && this.shopInfo.app_pay_use_coupon_flag)) {
+ uni.navigateTo({
+ url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ })
+ return false
+ } else if (this.discount.shopDiscount != 1) {
+ uni.navigateTo({
+ url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ })
+ return false
+ } else {
+ return true
+ }
+ } else if (this.discount.shopDiscount != 1) {
+ uni.navigateTo({
+ url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
+ })
+ return false
+ } else {
+ return true
+ }
+ } else {
+ return true
+ }
+ },
+ //纭鏀粯
+ pay() {
+ if (uni.$u.test.isEmpty(this.money)) {
+ uni.$u.toast('璇疯緭鍏ラ噾棰濓紒')
+ return
+ }
+ this.bordShow = false
+ // return this.toDiscount() //鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
+ if (this.toDiscount()) {
+ // 閲戦 this.money
+ uni.showLoading()
+ const params = {
+ money: parseFloat((this.money * 100).toPrecision(12)),
+ shopId: this.shopInfo.id,
+ cid: this.cid,
+ payWay: this.payWay,
+ score: 0,
+ couponDetailId: ''
+ }
+ if (this.payWay == 3) {
+ params.bankCardId = this.bankCardId
+ }
+ //鐢熸垚璁㈠崟
+ saveWxOrder(params).then(res => {
+ uni.hideLoading()
+ try {
+ this.orderId = res.orderId
+ res.youHuiInfo.shopName = this.shopInfo.shop_name
+ this.youHuiInfo = res.youHuiInfo
+ if (res.toPayMethod == 1) {
+ if (this.payWay == 3) {
+ this.smscode = ''
+ this.codeShow = true
+ }
+ } else if (res.toPayMethod == 2) {
+ if (this.payWay == 2) {
+ this.wxPay(res.paymentData)
+ }
+ if (this.payWay == 5) {
+ this.aliPay(res.paymentData)
+ }
+ } else if (res.toPayMethod == 3) {
+ // window.location.href = res.paymentUrl
+ this.smscode = ''
+ this.codeShow = true
+ }
+ } catch (e) {
+ //TODO handle the exception
+ console.error(e);
+ }
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ }
- uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
- })
- return false
- } else if ((this.shopInfo.use_score_flag && this.shopInfo.app_pay_use_score_flag) || (this
- .shopInfo
- .user_coupon_flag && this.shopInfo.app_pay_use_coupon_flag)) {
- uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
- })
- return false
- } else if (this.discount.shopDiscount != 1) {
- uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
- })
- return false
- } else {
- return true
- }
- } else if (this.discount.shopDiscount != 1) {
- uni.navigateTo({
- url: `/pages/pay/discountpay?shopInfo=${shopInfo}&integral=${this.integral}&scoreWorth=${this.scoreWorth}&money=${this.money}&payWay=${this.payWay}&bankCardId=${this.bankCardId}`
- })
- return false
- } else {
- return true
- }
- } else {
- return true
- }
- },
- //纭鏀粯
- pay() {
- if (uni.$u.test.isEmpty(this.money)) {
- uni.$u.toast('璇疯緭鍏ラ噾棰濓紒')
- return
- }
- this.bordShow = false
- // return this.toDiscount() //鍒ゆ柇鏄惁闇�瑕佽烦杞惀閿�椤甸潰
- if (this.toDiscount()) {
- // 閲戦 this.money
- uni.showLoading()
- const params = {
- money: parseFloat((this.money * 100).toPrecision(12)),
- shopId: this.shopInfo.id,
- cid: this.cid,
- payWay: this.payWay,
- score: 0,
- couponDetailId: ''
- }
- if (this.payWay == 3) {
- params.bankCardId = this.bankCardId
- }
- //鐢熸垚璁㈠崟
- saveWxOrder(params).then(res => {
- uni.hideLoading()
- try {
- this.orderId = res.orderId
- res.youHuiInfo.shopName = this.shopInfo.shop_name
- this.youHuiInfo = res.youHuiInfo
- if (res.toPayMethod == 1) {
- if (this.payWay == 3) {
- this.smscode = ''
- this.codeShow = true
- }
- } else if (res.toPayMethod == 2) {
- if (this.payWay == 2) {
- this.wxPay(res.paymentData)
- }
- if (this.payWay == 5) {
- this.aliPay(res.paymentData)
- }
- } else if (res.toPayMethod == 3) {
- // window.location.href = res.paymentUrl
- this.smscode = ''
- this.codeShow = true
- }
- } catch (e) {
- //TODO handle the exception
- console.error(e);
- }
- }).catch(() => {
- uni.hideLoading()
- })
- }
-
- },
- // 寰俊鏀粯
- wxPay(res) {
- setTimeout(() => {
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', {
- "appId": res.appId, //鍏紬鍙稩D锛岀敱鍟嗘埛浼犲叆
- "timeStamp": res.timeStamp, //鏃堕棿鎴筹紝鑷�1970骞翠互鏉ョ殑绉掓暟
- "nonceStr": res.nonceStr, //闅忔満涓�
- "package": res.package,
- "signType": res.signType, //寰俊绛惧悕鏂瑰紡锛�
- "paySign": res.paySign //寰俊绛惧悕
- },
- (res) => {
- if (res.err_msg == "get_brand_wcpay_request:ok") {
- // 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
- //res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
- uni.navigateTo({
- url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
+ },
+ // 寰俊鏀粯
+ wxPay(res) {
+ setTimeout(() => {
+ WeixinJSBridge.invoke(
+ 'getBrandWCPayRequest', {
+ "appId": res.appId, //鍏紬鍙稩D锛岀敱鍟嗘埛浼犲叆
+ "timeStamp": res.timeStamp, //鏃堕棿鎴筹紝鑷�1970骞翠互鏉ョ殑绉掓暟
+ "nonceStr": res.nonceStr, //闅忔満涓�
+ "package": res.package,
+ "signType": res.signType, //寰俊绛惧悕鏂瑰紡锛�
+ "paySign": res.paySign //寰俊绛惧悕
+ },
+ (res) => {
+ if (res.err_msg == "get_brand_wcpay_request:ok") {
+ // 浣跨敤浠ヤ笂鏂瑰紡鍒ゆ柇鍓嶇杩斿洖,寰俊鍥㈤槦閮戦噸鎻愮ず锛�
+ //res.err_msg灏嗗湪鐢ㄦ埛鏀粯鎴愬姛鍚庤繑鍥瀘k锛屼絾骞朵笉淇濊瘉瀹冪粷瀵瑰彲闈犮��
+ uni.navigateTo({
+ url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
.stringify(this.youHuiInfo)}`
- })
- }
- });
- }, 200)
- },
- //鏀粯瀹濇敮浠�
- aliPay(res) {
- ap.tradePay({
- tradeNO: res.tradeNO
- }, (res) => {
- if (res.resultCode == 9000) {
- uni.navigateTo({
- url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
+ })
+ }
+ });
+ }, 200)
+ },
+ //鏀粯瀹濇敮浠�
+ aliPay(res) {
+ ap.tradePay({
+ tradeNO: res.tradeNO
+ }, (res) => {
+ if (res.resultCode == 9000) {
+ uni.navigateTo({
+ url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
.stringify(this.youHuiInfo)}`
- })
- // 鏀粯鎴愬姛
- } else if (res.resultCode == 8000 || res.resultCode == 6001) {
- // 姝e湪澶勭悊涓� || 鍙栨秷
- } else {
- // 鏀粯澶辫触
- }
- });
- },
- //閾惰鍗℃敮浠�
- bankPay(e) {
- uni.showLoading()
- tlPay({
- orderId: this.orderId,
- payWay: 3,
- bankCardId: this.bankCardId,
- smscode: e,
- }).then(res => {
- uni.hideLoading()
- uni.hideKeyboard()
- this.codeShow = false
- uni.navigateTo({
- url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
+ })
+ // 鏀粯鎴愬姛
+ } else if (res.resultCode == 8000 || res.resultCode == 6001) {
+ // 姝e湪澶勭悊涓� || 鍙栨秷
+ } else {
+ // 鏀粯澶辫触
+ }
+ });
+ },
+ //閾惰鍗℃敮浠�
+ bankPay(e) {
+ uni.showLoading()
+ tlPay({
+ orderId: this.orderId,
+ payWay: 3,
+ bankCardId: this.bankCardId,
+ smscode: e,
+ }).then(res => {
+ uni.hideLoading()
+ uni.hideKeyboard()
+ this.codeShow = false
+ uni.navigateTo({
+ url: `/pages/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON
.stringify(this.youHuiInfo)}`
- })
- }).catch(() => {
- uni.hideLoading()
- })
- }
- }
-};
+ })
+ }).catch(() => {
+ uni.hideLoading()
+ })
+ }
+ }
+ };
</script>
<style scoped lang="scss">
-.page {
- height: calc(100vh - 0px);
- display: flex;
- flex-direction: column;
-}
+ .page {
+ height: calc(100vh - 0px);
+ display: flex;
+ flex-direction: column;
+ }
-.shop {
- padding: 50rpx 64rpx;
-}
+ .shop {
+ padding: 50rpx 64rpx;
+ }
-.avg-img {
- width: 94rpx;
- height: 94rpx;
- border-radius: 10rpx;
- background-color: #ffffff;
-}
+ .avg-img {
+ width: 94rpx;
+ height: 94rpx;
+ border-radius: 10rpx;
+ background-color: #ffffff;
+ }
-.content {
- border-radius: 40rpx 40rpx 0 0;
-}
+ .content {
+ border-radius: 40rpx 40rpx 0 0;
+ }
-.money {
- font-size: 40rpx;
- color: #333;
-}
+ .money {
+ font-size: 40rpx;
+ color: #333;
+ }
-.money-icon {
- font-size: 70rpx;
- // font-weight: bold;
- margin-right: 20rpx;
-}
+ .money-icon {
+ font-size: 70rpx;
+ // font-weight: bold;
+ margin-right: 20rpx;
+ }
-.money-num {
- font-size: 96rpx;
- // font-weight: bold;
-}
+ .money-num {
+ font-size: 96rpx;
+ // font-weight: bold;
+ }
-.pay-it {
- position: absolute;
- width: 686rpx;
- height: 98rpx;
- bottom: 0;
- border-radius: 10rpx;
- font-size: 34rpx;
- color: #ffffff;
- background-color: #de2d35;
- margin: 32rpx;
-}
+ .pay-it {
+ position: absolute;
+ width: 686rpx;
+ height: 98rpx;
+ bottom: 0;
+ border-radius: 10rpx;
+ font-size: 34rpx;
+ color: #ffffff;
+ background-color: #de2d35;
+ margin: 32rpx;
+ }
-.bank-card-ad {
- padding-top: 50rpx;
- background-image: url(~@/static/bank-card-ad1.png);
- background-size: 100% auto;
- background-position: top center;
- background-repeat: no-repeat;
-}
+ .bank-card-ad {
+ padding-top: 50rpx;
+ background-image: url(~@/static/bank-card-ad1.png);
+ background-size: 100% auto;
+ background-position: top center;
+ background-repeat: no-repeat;
+ }
-.pay-icon {
- align-self: flex-start;
- width: 48rpx;
- height: 48rpx;
- margin-right: 20rpx;
-}
+ .pay-icon {
+ align-self: flex-start;
+ width: 48rpx;
+ height: 48rpx;
+ margin-right: 20rpx;
+ }
-.tag {
- background-color: #F35656;
- font-size: 20rpx;
- color: #fff;
- border-radius: 4rpx;
- line-height: 1;
- padding: 4rpx;
-}
+ .tag {
+ background-color: #F35656;
+ font-size: 20rpx;
+ color: #fff;
+ border-radius: 4rpx;
+ line-height: 1;
+ padding: 4rpx;
+ }
-.tag-pain {
- border: 1px solid #D31F28;
- font-size: 22rpx;
- color: #D31F28;
- border-radius: 4rpx;
- line-height: 1;
- padding: 8rpx 4rpx;
-}
+ .tag-pain {
+ border: 1px solid #D31F28;
+ font-size: 22rpx;
+ color: #D31F28;
+ border-radius: 4rpx;
+ line-height: 1;
+ padding: 8rpx 4rpx;
+ }
-.mask {
- position: absolute;
- width: 100%;
- height: 100%;
- left: 0;
- bottom: 0;
- z-index: 101;
- background-color: rgba(0, 0, 0, 0);
-}
+ .mask {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ left: 0;
+ bottom: 0;
+ z-index: 101;
+ background-color: rgba(0, 0, 0, 0);
+ }
-@keyframes cursor-blinks {
- 0% {
- opacity: 1;
- display: block;
- }
+ @keyframes cursor-blinks {
+ 0% {
+ opacity: 1;
+ display: block;
+ }
- 50% {
- opacity: 0;
- display: none;
- }
+ 50% {
+ opacity: 0;
+ display: none;
+ }
- 100% {
- opacity: 1;
- display: block;
- }
-}
+ 100% {
+ opacity: 1;
+ display: block;
+ }
+ }
-.cursor {
- border-left: 1px solid transparent;
- height: 80rpx;
-}
+ .cursor {
+ border-left: 1px solid transparent;
+ height: 80rpx;
+ }
-.cursor-act {
- border-left: 1px solid #333;
- animation: cursor-blinks 1s infinite steps(1, start);
-}
+ .cursor-act {
+ border-left: 1px solid #333;
+ animation: cursor-blinks 1s infinite steps(1, start);
+ }
-.reg-btn {
- display: block;
- margin-top: 30rpx;
- width: 654rpx;
- height: 198rpx;
+ .reg-btn {
+ display: block;
+ margin-top: 30rpx;
+ width: 654rpx;
+ height: 198rpx;
- image {
- width: 100%;
- height: 100%;
- }
-}
+ image {
+ width: 100%;
+ height: 100%;
+ }
+ }
-.u-font-money {
- font-size: 60rpx;
-}
+ .u-font-money {
+ font-size: 60rpx;
+ }
-.bankCard-list {
- height: 50vh;
- width: 750rpx;
- box-sizing: border-box;
+ .bankCard-list {
+ height: 50vh;
+ width: 750rpx;
+ box-sizing: border-box;
- .pay-icon {
- align-self: center;
- }
-}
+ .pay-icon {
+ align-self: center;
+ }
+ }
-.add-icon {
- width: 50rpx;
- height: 50rpx;
- border-radius: 25rpx;
- background: #ffc0c38f;
- display: flex;
- align-items: center;
- justify-content: center;
-}
+ .add-icon {
+ width: 50rpx;
+ height: 50rpx;
+ border-radius: 25rpx;
+ background: #ffc0c38f;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
-.shuka {
- width: 678rpx;
- height: 45rpx;
- position: relative;
- left: -10rpx;
+ .shuka {
+ width: 678rpx;
+ height: 45rpx;
+ position: relative;
+ left: -10rpx;
- image {
- width: 100%;
- height: 100%;
- }
-}
+ image {
+ width: 100%;
+ height: 100%;
+ }
+ }
-.btn {
- /* position: fixed;
+ .btn {
+ /* position: fixed;
bottom: 100rpx; */
- margin: 0 auto;
- margin-top: 120rpx;
- position: relative;
- width: 680rpx;
- height: 100rpx;
-}
+ margin: 0 auto;
+ margin-top: 120rpx;
+ position: relative;
+ width: 680rpx;
+ height: 100rpx;
+ }
-.wx-app {
- position: absolute;
- width: 680rpx;
- height: 100rpx;
-}
-</style>
+ .wx-app {
+ position: absolute;
+ width: 680rpx;
+ height: 100rpx;
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.1