diff --git a/App.vue b/App.vue
index f2fb0c8..70c1283 100644
--- a/App.vue
+++ b/App.vue
@@ -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: '', //code获取openid
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');
diff --git a/main.js b/main.js
index 365eb09..5f8a912 100644
--- a/main.js
+++ b/main.js
@@ -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({
diff --git a/manifest.json b/manifest.json
index 96b39f3..5fcd3c4 100644
--- a/manifest.json
+++ b/manifest.json
@@ -77,6 +77,9 @@
"title" : "惠支付",
"devServer" : {
"https" : false
+ },
+ "sdkConfigs" : {
+ "maps" : {}
}
}
}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index a7784a3..92ee7ef 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -6,28 +6,29 @@
{{plateNumberStr==''?'¥0.00':'¥'+plateNumberStr}}
-
+
+ v-if="storeList.discountActivity !== '' && storeList.discountActivity !== null" @click="showPopupstore()">
门店优惠
- 满{{storeList.discountActivity.discountCondition}}元减{{storeList.discountActivity.discountPrice}}元
+ v-if="storediscountPrice != 0 && storediscountType !=3">
+ -¥{{storediscountPrice}}元
- 全场立减{{storeList.discountActivity.discountPrice}}
+ v-if="storediscountPrice != 0 && storediscountType ==3">
+ {{storediscountPrice}}折
-
- 全场打{{storeList.discountActivity.discountPrice}}折
+
+ 查看商户活动
+
-
+
-
+
+
优惠券选择
-
-
-
+
+ {{discout.discountName}}
+
- {{discout.discountName}}
+
+
+
+ 满{{discout.discountCondition}}-{{discout.discountPrice}}元
+ 抵扣{{discout.discountPrice}}元
+
+
+ {{discout.discountPrice * 100}}折
+
+
+ 有效期:{{discout.useEndTime | timeFormat('yyyy-mm-dd')}}
+
+
+
+
+
+ 门店活动选择
+
+
+
+
+
+ {{discout.name}}
+
+
+
+
+
+
+ 满{{discout.discountCondition}}-{{discout.discountPrice}}元
+ 抵扣{{discout.discountPrice}}元
+
+ {{discout.discountPrice}}折
+
+
+ 有效期:{{discout.endTime | timeFormat('yyyy-mm-dd')}}
+
+
+
+
+
@@ -178,15 +231,17 @@
},
data() {
return {
- plateNumberList: [],
- length: 6,
- discountPrice: 0, //优惠金额
+ plateNumberList: [], //输出值
+ plateNumberList1: [], //计算值
+ length: 11,
+ discountPrice: 0, //优惠金额
inputPrice: '', //输入金额
payPrice: 0, //支付金额
reNum: 0, // 是否重复
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() {},
@@ -233,10 +294,10 @@
parice = str - (this.priceValue[1] / 10 / 10);
if (str == 0) {
this.calculation(0);
- }
- if (str) {
+ }
+ if (str) {
this.calculation(str);
- }
+ }
if (parice > 0) {
this.cjstu = false;
} else {
@@ -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,44 +492,64 @@
},
//查询门店详情
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'
+ })
}
})
},
//选择优惠券
- radioChanges(item) {
- // this.rechangeload();
- if (this.inputPrice == '') {
- uni.showToast({
- title: '请输入正确的支付金额',
- duration: 2000,
- icon: 'none'
- })
- this.payPrice = 0;
- this.plateNumberList = [];
- this.$refs.popup.hide();
- return;
+ radioChanges(item) {
+ // this.rechangeload();
+ if (this.inputPrice == '') {
+ uni.showToast({
+ title: '请输入正确的支付金额',
+ duration: 2000,
+ icon: 'none'
+ })
+ this.payPrice = 0;
+ this.plateNumberList = [];
+ this.$refs.popup.hide();
+ return;
}
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))
@@ -508,15 +647,24 @@
// 必须保证第一个为数字而不是.
n = n.replace(/^\./g, '')
// 保证只有出现一个.而没有多个.
- n = n.replace(/\.{2,}/g, '.')
- if (n == 0 || this.plateNumberList[lenth] == '') {
+ n = n.replace(/\.{2,}/g, '.')
+ // || this.plateNumberList[lenth] == ''
+ if (n == 0) {
uni.showToast({
title: '请输入正确的支付金额',
duration: 2000,
icon: 'none'
})
this.payPrice = 0;
- this.plateNumberList = [];
+ 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') {
- this.payRequest(res.return_data.payParam);
+ 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();
- this.priceValue[1] = 0;
+ // this.plateNumberList.pop();
+ if (this.plateNumberList1[0] == 0 && this.plateNumberList1[1] == '.' && this.plateNumberList1.length ==
+ 2) {
+ this.plateNumberList = [];
+ this.plateNumberList1 = [];
+
+ } else {
+ this.plateNumberList.pop();
+ 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: '请输入正确的金额',
+ 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: '输入金额不能超过最大值',
+ title: '单比金额最多10000000元',
duration: 2000,
icon: 'none'
})
+ this.plateNumberList1.pop();
return;
}
this.plateNumberList.push(val);
+
},
- //微笑支付
+ //微信支付
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
- // debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: self.appId, // 必填,公众号的唯一标识
timestamp: self.timeStamp, // 必填,生成签名的时间戳
nonceStr: self.nonceStr, // 必填,生成签名的随机串
diff --git a/pages/welcome/welcome.vue b/pages/welcome/welcome.vue
index 77c1161..623a42c 100644
--- a/pages/welcome/welcome.vue
+++ b/pages/welcome/welcome.vue
@@ -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_basewechat_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';
},
}
}
diff --git a/uni.scss b/uni.scss
index 802eedf..c722168 100644
--- a/uni.scss
+++ b/uni.scss
@@ -321,6 +321,11 @@ $uni-font-size-paragraph:30upx;
.width60w {
width: 60%;
margin-left: 20%;
+}
+
+.width50w {
+ width: 50%;
+ margin-left: 25%;
}
.width40w {