1.优化支付进件问题

dev
杨杰 2 years ago
parent f1a67b1131
commit aeba6f0ab4
  1. 19
      App.vue
  2. 5
      main.js
  3. 3
      manifest.json
  4. 306
      pages/index/index.vue
  5. 2
      pages/welcome/welcome.vue
  6. 5
      uni.scss

@ -5,8 +5,8 @@
// url: 'https://pay.bxb.cn/crest',
// imgUrl: 'https://xuan-pay-private.obs.cn-southwest-2.myhuaweicloud.com',
//
url: 'https://paycs.dctpay.com/crest',
imgUrl: 'https://xuan-pay-private.obs.cn-southwest-2.myhuaweicloud.com',
// url: 'https://paycs.dctpay.com/crest',
// imgUrl: 'https://xuan-pay-private.obs.cn-southwest-2.myhuaweicloud.com',
userInfo: "",
openId: '',
token: '',
@ -14,14 +14,15 @@
code: '', //codeopenid
snNo: '', // sn
//
// url: 'https://hsg.dctpay.com/user',
// imgUrl: 'https://hsg.dctpay.com/filesystem/',
// imageWxImg: 'https://hsg.dctpay.com/filesystem/wxApplets/',
//
url: 'https://hsgcs.dctpay.com/user',
graurl:'https://gratia-pay.dctpay.com/crest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
url: 'https://hsg.dctpay.com/user',
graurl:'https://pay.dctpay.com/crest',
imgUrl: 'https://pay.dctpay.com/filesystem/',
imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
//
// url: 'https://hsgcs.dctpay.com/user',
// graurl:'https://gratia-pay.dctpay.com/crest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg: 'https://hsgcs.dctpay.com/filesystem/wxApplets/',
},
onLaunch: function() {
console.log('App Launch');

@ -1,7 +1,10 @@
import App from './App'
import * as filters from './Utils/js/date.js'
// #ifndef VUE3
import Vue from 'vue'
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({

@ -77,6 +77,9 @@
"title" : "惠支付",
"devServer" : {
"https" : false
},
"sdkConfigs" : {
"maps" : {}
}
}
}

@ -6,26 +6,27 @@
<view class="idcard fcorfff font40 fontlet">
{{plateNumberStr==''?'¥0.00':'¥'+plateNumberStr}}
</view>
<view class="width40w mart10 line1"></view>
<view class="width50w mart10 line1"></view>
</view>
<!-- 商家优惠 -->
<view class="height50 width100 mart10 backcorfff"
v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null">
v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null" @click="showPopupstore()">
<view class="width50 flleft fcor666 font16 alijusstart" style="padding-left: 5%;">
门店优惠
</view>
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;"
v-if="storeList.discountActivity.discountType == 1">
{{storeList.discountActivity.discountCondition}}元减{{storeList.discountActivity.discountPrice}}
v-if="storediscountPrice != 0 && storediscountType !=3">
-{{storediscountPrice}}
</view>
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;"
v-if="storeList.discountActivity.discountType == 2">
全场立减{{storeList.discountActivity.discountPrice}}
v-if="storediscountPrice != 0 && storediscountType ==3">
{{storediscountPrice}}
</view>
<view class="width40 flright fotrt paddtright15 font15 fcoreb5 alijusend" style="align-items: center;"
v-if="storeList.discountActivity.discountType == 3">
全场打{{storeList.discountActivity.discountPrice}}
<view class="width40 flright fotrt paddtright15 font15 fcor666 alijusend" style="align-items: center;"
v-if="storediscountPrice == 0">
查看商户活动
</view>
</view>
<view class=" width90 line1 mart5 marb5"></view>
<!-- 积分抵扣 -->
@ -67,10 +68,15 @@
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image>
</view>
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;"
v-if="deductionPrice != 0 && user" @click="showPopup()">
v-if="deductionPrice != 0 && userDiscountType !=3 && user" @click="showPopup()">
-{{deductionPrice}}
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image>
</view>
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;"
v-if="deductionPrice != 0 && userDiscountType ==3 && user" @click="showPopup()">
{{deductionPrice * 100}}
<image style="width: 40rpx;height: 40rpx;" src="../../static/jt.png"></image>
</view>
<view class="width60 flright fotrt paddtright15 font15 fcor666 alijun" style="align-items: center;"
v-if="!user" @click="showPopuplogin()">
登陆查看可享用优惠券
@ -115,21 +121,68 @@
</view>
</view>
<!-- 优惠券弹窗 scrollY="true" -->
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true">
<!-- 优惠券弹窗 -->
<wybPopup ref="popup" type="bottom" width="500" radius="6" :showCloseIcon="true" scrollY="true">
<view class="fotct font18 fontwig6 fcor333 mart10 height30">优惠券选择</view>
<view v-if="discountList == ''" class="mart60 fotct font14 fcor666">
<image mode="widthFix" style="width: 50vw;" src="../../static/noorder.png"></image>
</view>
<view class="width90 height40 tccs mart20 couts" v-for="(discout, index) in discountList" :key="index"
<view class="width90 height60 mart20 couts" v-for="(discout, index) in discountList" :key="index"
@click="radioChanges(discout)">
<view class="margle20">
<view class="yhprice">
<view class="alijusstart width94 mart5">
<view class="font16 width70 fontwig6 fcor333 text1">{{discout.discountName}}</view>
<view class="width30 fotrt">
<radio :checked="discout.id == memDiscountId" color="#0083f5" />
</view>
<view class="font16 fontwig6 fcor333 text1">{{discout.discountName}}</view>
</view>
<view class="alijusstart width94 mart5">
<view class="font14 width40 fcor333" v-if="discout.discountType == 1">
{{discout.discountCondition}}-{{discout.discountPrice}}</view>
<view class="font14 width40 fcor333" v-if="discout.discountType == 2">抵扣{{discout.discountPrice}}
</view>
<view class="font14 width40 fcor333" v-if="discout.discountType == 3">
{{discout.discountPrice * 100}}
</view>
<view class="font12 width60 fcor999 fotrt">
有效期:{{discout.useEndTime | timeFormat('yyyy-mm-dd')}}
</view>
</view>
</view>
<view class="height40p"></view>
</wybPopup>
<!-- 门店活动 -->
<wybPopup ref="popupstore" type="bottom" width="500" radius="6" :showCloseIcon="true" scrollY="true">
<view class="fotct font18 fontwig6 fcor333 mart10 height30">门店活动选择</view>
<view v-if="storeCouponlist == ''" class="mart60 fotct font14 fcor666">
<image mode="widthFix" style="width: 50vw;" src="../../static/noorder.png"></image>
</view>
<view class="width90 height60 mart20 couts" v-for="(discout, indexs) in storeCouponlist" :key="indexs"
@click="radiostoreChanges(discout)">
<view class="alijusstart width94 mart5">
<view class="font16 width70 fontwig6 fcor333 text1">{{discout.name}}</view>
<view class="width30 fotrt">
<radio :checked="discout.id == storeDiscountId" color="#0083f5" />
</view>
</view>
<view class="alijusstart width94 mart5">
<view class="font14 width40 fcor333" v-if="discout.discountType == 1">
{{discout.discountCondition}}-{{discout.discountPrice}}</view>
<view class="font14 width40 fcor333" v-if="discout.discountType == 2">抵扣{{discout.discountPrice}}
</view>
<view class="font14 width40 fcor333" v-if="discout.discountType == 3">{{discout.discountPrice}}
</view>
<view class="font12 width60 fcor999 fotrt">
有效期:{{discout.endTime | timeFormat('yyyy-mm-dd')}}
</view>
</view>
<!-- <view class="margle20">
<view class="yhprice">
<radio :checked="discout.id == storeDiscountId" color="#0083f5" />
</view>
<view class="font16 fontwig6 fcor333 text1">{{discout.name}}</view>
</view> -->
</view>
<view class="height40p"></view>
</wybPopup>
<wybPopup ref="popups" type="center" height="850" width="600" bgColor="" radius="20" :showCloseIcon="false">
@ -178,8 +231,9 @@
},
data() {
return {
plateNumberList: [],
length: 6,
plateNumberList: [], //
plateNumberList1: [], //
length: 11,
discountPrice: 0, //
inputPrice: '', //
payPrice: 0, //
@ -187,6 +241,7 @@
priceValue: [0, 0], //
discountList: '', //
memDiscountId: '', //
userDiscountType: '', //
numKeybordList: [
[1, 2, 3],
[4, 5, 6],
@ -200,6 +255,7 @@
cjstu: true, //
suNo: '', //sn
storeList: '', //
storeCouponlist: '', //
isDiscount: true,
user: '', //
deductionPrice: '0.00', //
@ -209,6 +265,11 @@
getCodeText: '获取验证码',
getCodeBtnColor: "#ffffff",
getCodeisWaiting: false,
storediscountType: '', //
storediscountCondition: '', //
storediscountPrice: '', //
storeDiscountId: '' //id
}
},
mounted() {},
@ -346,6 +407,7 @@
data: res.return_data.uniqueCode
})
this.$refs.popups.hide();
this.getQrCodeDetail();
this.getUserAccount();
this.queryUserDiscountList();
} else {
@ -366,6 +428,10 @@
showPopup() {
this.$refs.popup.show();
},
//
showPopupstore() {
this.$refs.popupstore.show();
},
//
getUserAccount() {
getUserAccount().then(res => {
@ -394,22 +460,27 @@
let storetype = '';
let storeprice = '';
if (this.storeList.discountActivity != '' && this.storeList.discountActivity != null) {
if (item >= this.storeList.discountActivity.discountCondition && this.storeList.discountActivity
.discountType == 1) {
storetype = this.storeList.discountActivity.discountType;
storeprice = this.storeList.discountActivity.discountPrice;
if (item >= this.storediscountCondition && (this.storediscountType == 1 || this.storediscountType ==
2)) {
storetype = this.storediscountType;
storeprice = this.storediscountPrice;
} else {
storetype = this.storeList.discountActivity.discountType;
storeprice = this.storeList.discountActivity.discountPrice;
storetype = this.storediscountType;
storeprice = this.storediscountPrice;
}
}
let phone = '';
if (app.globalData.userInfo) {
phone = app.globalData.userInfo.phone;
}
let datas = {
transactionPrice: item,
storeDiscountType: storetype,
storeDiscountPrice: storeprice,
userDiscountType: this.memDiscountId,
userDiscountPrice: this.deductionPrice
userDiscountType: this.userDiscountType,
userDiscountPrice: this.deductionPrice,
storeDiscountId: this.storeDiscountId,
userPhone: phone
}
calculation(datas).then(res => {
if (res.return_code == '000000') {
@ -421,14 +492,33 @@
},
//
getQrCodeDetail() {
let phone = '';
if (app.globalData.userInfo) {
phone = app.globalData.userInfo.phone;
}
let datas = {
serialNumber: app.globalData.snNo
serialNumber: app.globalData.snNo,
phone: phone
// app.globalData.snNo
// 1000017421
}
getQrCodeDetail(datas).then(res => {
if (res.return_code == '000000') {
this.storeList = res.return_data;
if (res.return_data.discountActivity) {
this.storeCouponlist = res.return_data.discountActivity;
this.storediscountType = res.return_data.discountActivity[0].discountType;
this.storediscountCondition = res.return_data.discountActivity[0].discountCondition;
this.storediscountPrice = res.return_data.discountActivity[0].discountPrice;
this.storeDiscountId = res.return_data.discountActivity[0].id;
}
} else {
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
}
})
},
@ -450,15 +540,16 @@
if (this.memDiscountId == item.id) { //
this.memDiscountId = '';
this.deductionPrice = '0.00';
this.userDiscountType = '';
this.calculation(this.inputPrice);
} else { //
this.userDiscountType = item.discountType;
if (item.discountType == 1) {
if (this.inputPrice >= item.discountCondition) {
this.memDiscountId = item.id;
//
this.deductionPrice = item.discountPrice;
let oldprice = this.inputPrice - this.deductionPrice;
this.calculation(oldprice);
this.calculation(this.inputPrice);
} else {
uni.showToast({
title: '请满' + item.discountCondition + '使用此券',
@ -471,21 +562,69 @@
this.memDiscountId = item.id;
//
this.deductionPrice = item.discountPrice;
let oldprice = this.inputPrice - this.deductionPrice;
this.calculation(oldprice);
this.calculation(this.inputPrice);
}
if (item.discountType == 3) {
this.memDiscountId = item.id;
//
this.deductionPrice = parseFloat(this.inputPrice - (this.inputPrice * item.discountPrice)).toFixed(
2);
let oldprice = parseFloat(this.inputPrice * item.discountPrice).toFixed(2);
this.calculation(oldprice);
this.deductionPrice = item.discountPrice;
this.calculation(this.inputPrice);
}
}
this.$refs.popup.hide();
},
//
radiostoreChanges(item) {
if (this.inputPrice == '') {
uni.showToast({
title: '请输入正确的支付金额',
duration: 2000,
icon: 'none'
})
this.payPrice = 0;
this.plateNumberList = [];
this.$refs.popupstore.hide();
return;
}
if (this.storeDiscountId == item.id) { //
this.storeDiscountId = '';
this.storediscountPrice = '0.00';
this.storediscountType = '';
this.calculation(this.inputPrice);
} else { //
this.storediscountType = item.discountType;
if (item.discountType == 1) {
if (this.inputPrice >= item.discountCondition) {
this.storeDiscountId = item.id;
//
this.storediscountPrice = item.discountPrice;
this.calculation(this.inputPrice);
} else {
uni.showToast({
title: '请满' + item.discountCondition + '使用此券',
icon: 'none',
duration: 2000
})
}
}
if (item.discountType == 2) {
this.storeDiscountId = item.id;
//
this.storediscountPrice = item.discountPrice;
this.calculation(this.inputPrice);
}
if (item.discountType == 3) {
this.storeDiscountId = item.id;
//
this.storediscountPrice = item.discountPrice;
this.calculation(this.inputPrice);
}
}
this.$refs.popupstore.hide();
},
rechangeload() {
this.isUse = false;
this.$nextTick(() => (this.isUse = true))
@ -509,7 +648,8 @@
n = n.replace(/^\./g, '')
// ..
n = n.replace(/\.{2,}/g, '.')
if (n == 0 || this.plateNumberList[lenth] == '') {
// || this.plateNumberList[lenth] == ''
if (n == 0) {
uni.showToast({
title: '请输入正确的支付金额',
duration: 2000,
@ -517,6 +657,14 @@
})
this.payPrice = 0;
this.plateNumberList = [];
this.plateNumberList1 = [];
this.storediscountType = ''; //
this.storediscountCondition = ''; //
this.storediscountPrice = ''; //
this.storeDiscountId = ''; //id
this.userDiscountType = '';
this.deductionPrice = '';
this.memDiscountId = '';
return;
}
// var userAgent = navigator.userAgent.toLowerCase();
@ -529,11 +677,18 @@
//
createJSAPIOrder(item) {
// "WECHAT ALIPAY UQRCODEPAY",
let phone = '';
if (app.globalData.userInfo) {
phone = app.globalData.userInfo.phone;
}
let datas = {
"qrCodeSN": app.globalData.snNo,
"payUserId": app.globalData.openId,
"payMode": item,
"totalAmount": this.inputPrice
"totalAmount": this.inputPrice,
"storeDiscountId": this.storeDiscountId,
"userDiscountId": this.memDiscountId,
"userPhone": phone
}
createJSAPIOrder(datas).then(res => {
if (res.return_code == '000000') {
@ -554,7 +709,15 @@
}
jsapiPay(datas).then(res => {
if (res.return_code == '000000') {
if (res.return_data.payParam) {
this.payRequest(res.return_data.payParam);
} else {
uni.showToast({
title: '单比金额最多10000000元',
icon: 'none',
duration: 2000
})
}
} else {
uni.showToast({
title: res.return_msg,
@ -566,8 +729,17 @@
},
//
deleteVal() {
// this.plateNumberList.pop();
if (this.plateNumberList1[0] == 0 && this.plateNumberList1[1] == '.' && this.plateNumberList1.length ==
2) {
this.plateNumberList = [];
this.plateNumberList1 = [];
} else {
this.plateNumberList.pop();
this.priceValue[1] = 0;
this.plateNumberList1.pop();
}
// this.priceValue[1] = 0;
this.reload();
},
//
@ -597,32 +769,76 @@
},
//
input(val) {
if (this.plateNumberList[0] == '.') {
this.plateNumberList1.push(val);
let lists = '';
this.plateNumberList1.forEach(item => {
lists += item.toString();
})
var strdata1 = lists.split('.');
var strdata2 = /^[0-9]{0,7}(\.[0-9]{1,2})?$/.test(lists);
//0
if (this.plateNumberList1[0] == 0 && this.plateNumberList1.length < 2) {
this.plateNumberList1 = ['0', '.'];
this.plateNumberList = ['0', '.'];
return;
}
//
if (this.plateNumberList1[0] == '.') {
uni.showToast({
title: '请输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
if (this.plateNumberList.length >= this.length) {
// if (this.plateNumberList.indexOf('.') == 1 && val == '.') {
// uni.showToast({
// title: '',
// duration: 2000,
// icon: 'none'
// })
// }
//
if (strdata1.length == 3 && !strdata2) {
uni.showToast({
title: '输入金额不能超过最大值',
title: '输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
//
if (this.plateNumberList.indexOf('.') != -1 && !strdata2) {
uni.showToast({
title: '请输入正确的金额',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
//7
if (this.plateNumberList.length > 7 && this.plateNumberList.indexOf('.') == -1) {
uni.showToast({
title: '单比金额最多10000000元',
duration: 2000,
icon: 'none'
})
this.plateNumberList1.pop();
return;
}
this.plateNumberList.push(val);
},
//
//
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// debug: false, // ,apialertpclogpc
debug: false, // ,apialertpclogpc
appId: self.appId, //
timestamp: self.timeStamp, //
nonceStr: self.nonceStr, //

@ -67,7 +67,7 @@
//
jumpWeb() {
location.href =
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2Fgratia-pay-scanPay%2Findex.html%23%2F&response_type=code&scope=snsapi_base&#wechat_redirect';
'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https://hsg.dctpay.com/wechat_authorize/?redirect_uri=https://hsg.dctpay.com/scanPay&response_type=code&scope=snsapi_base#wechat_redirect';
},
}
}

@ -323,6 +323,11 @@ $uni-font-size-paragraph:30upx;
margin-left: 20%;
}
.width50w {
width: 50%;
margin-left: 25%;
}
.width40w {
width: 40%;
margin-left: 30%;

Loading…
Cancel
Save