【收银台】

1. 从 crmeb php 项目迁移
pull/1/MERGE
YunaiV 2023-07-01 00:05:01 +08:00
parent 8d6d8a25fd
commit 224e4f4772
5 changed files with 1044 additions and 76 deletions

160
components/numberScroll.vue Normal file
View File

@ -0,0 +1,160 @@
<template>
<view class="number-box">
<block v-for="(myIndex, index) in indexArr" :key="index">
<swiper class="swiper" vertical="true" :current="myIndex" circular="true"
v-bind:style="{color:color,width:myIndex == 10 ? '14rpx' : myIndex == 1 ? '22rpx' : width+'rpx',height:height+'rpx',lineHeight:fontSize+'rpx',fontSize:fontSize+'rpx',fontWeight: fontWeight}">
<swiper-item>
<view class="swiper-item">0</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">1</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">2</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">3</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">4</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">5</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">6</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">7</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">8</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">9</view>
</swiper-item>
<swiper-item>
<view class="swiper-item">.</view>
</swiper-item>
</swiper>
</block>
</view>
</template>
<script>
export default {
props: {
num: [String, Number],
color: {
type: String,
default: '#000000'
},
width: {
type: String,
default: '30'
},
height: {
type: String,
default: '30'
},
fontSize: {
type: String,
default: '30'
},
fontWeight: {
type: [String, Number],
default: 500
}
},
data() {
return {
indexArr: []
};
},
created() {
let {
num
} = this;
let arr = new Array(num.toString().length);
arr.fill(0);
this.indexArr = arr;
},
watch: {
num: function(val, oldVal) {
//
let arr = Array.prototype.slice.apply(this.indexArr);
let newLen = val.toString().length;
let oldLen = oldVal.toString().length;
if (newLen > oldLen) {
for (let i = 0; i < newLen - oldLen; i++) {
arr.push(0);
}
this.indexArr = arr;
}
if (newLen < oldLen) {
for (let i = 0; i < oldLen - newLen; i++) {
arr.pop();
}
this.indexArr = arr;
}
this.numChange(val);
}
},
mounted() {
//app
this._time = setTimeout(() => {
this.numChange(this.num);
clearTimeout(this._time);
}, 50);
},
methods: {
/**
* 数字改变
* @value 数字
*/
numChange(num) {
this.$nextTick(() => {
let {
indexArr
} = this;
let copyIndexArr = Array.prototype.slice.apply(indexArr);
let _num = num.toString();
for (let i = 0; i < _num.length; i++) {
if (_num[i] === '.') {
copyIndexArr[i] = 10;
} else {
copyIndexArr[i] = Number(_num[i]);
}
}
this.indexArr = copyIndexArr;
})
}
}
};
</script>
<style lang="scss">
.number-box {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.swiper {
position: relative;
// line-height: 30upx;
// width: 30upx;
// height: 30upx;
// font-size: 30upx;
// background: red;
}
.swiper:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
</style>

View File

@ -269,7 +269,7 @@
"style": {
"navigationBarTitleText": "修改密码",
"navigationBarBackgroundColor": "#e93323"
// #ifdef MP
// #ifdef MP
,
"navigationBarTextStyle": "#fff"
// #endif
@ -314,7 +314,7 @@
"style": {
"navigationBarTitleText": "推广人排行",
"navigationBarBackgroundColor": "#e93323"
// #ifdef MP
// #ifdef MP
,
"navigationBarTextStyle": "#fff"
// #endif
@ -475,8 +475,24 @@
"navigationBarTitleText": "精品推荐"
}
}]
}
],
}, {
"root": "pages/goods",
"name": "goods",
"pages": [{
"path": "cashier/index",
"style": {
"navigationBarTitleText": "收银台",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
}]
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "crmeb",
@ -526,4 +542,4 @@
"query": "" //onLoad
}]
}
}
}

View File

@ -0,0 +1,796 @@
<template>
<view class="page" v-if="payPriceShow">
<view class="pay-price">
<view class="price">
<text class="unit"></text>
<numberScroll :num='(payPriceShow / 100.0).toFixed(2)' color="#E93323" width='30' height='50' fontSize='50' />
</view>
<view class="count-down">
支付剩余时间
<countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
:datatime="invalidTime / 1000" :is-col="true" :bgColor="bgColor" />
</view>
</view>
<view class="payment">
<view class="title">
支付方式
</view>
<view class="item acea-row row-between-wrapper" v-for="(item,index) in cartArr" :key="index"
v-show='item.payStatus' @click="payType(item.number || 0, item.value, index, item.channelCode)">
<view class="left acea-row row-between-wrapper">
<view class="iconfont" :class="item.icon"></view>
<view class="text">
<view class="name">{{item.name}}</view>
<view class="info" v-if="item.value == 'yue'">
{{item.title}} <span class="money">{{ item.number }}</span>
</view>
<view class="info" v-else>{{item.title}}</view>
</view>
</view>
<view class="iconfont" :class="active==index?'icon-xuanzhong11 font-num':'icon-weixuan'"></view>
</view>
</view>
<view class="btn">
<view class="button acea-row row-center-wrapper" @click='goPay(number, paytype, channelCode)'>确认支付</view>
<view class="wait-pay" @click="waitPay"></view>
</view>
<view v-show="false" v-html="formContent"></view>
</view>
</template>
<script>
import CountDown from "@/components/countDown";
import numberScroll from '@/components/numberScroll.vue'
import * as PayOrderApi from '@/api/pay/order.js';
export default {
components: {
CountDown,
numberScroll
},
data() {
return {
bgColor: {
'bgColor': '#fff',
'Color': '#E93323',
'width': '44rpx',
'timeTxtwidth': '16rpx',
'isDay': true
},
checked: false,
datatime: 1676344056, //
//
cartArr: [{
"name": '微信支付',
"icon": "icon-weixin2",
value: 'weixin',
title: '使用微信快捷支付',
payStatus: 1,
"channelCode": "wx_pub" // TODO
},
{
"name": '支付宝支付',
"icon": "icon-zhifubao",
value: 'alipay',
title: '使用支付宝支付',
payStatus: 1,
"channelCode": "alipay_wap" // TODO
},
{
"name": '余额支付',
"icon": "icon-yuezhifu",
value: 'yue',
title: '可用余额',
payStatus: 1,
},
{
"name": '线下支付',
"icon": "icon-yuezhifu1",
value: 'offline',
title: '使用线下付款',
payStatus: 2,
}, {
"name": '好友代付',
"icon": "icon-haoyoudaizhifu",
value: 'friend',
title: '找微信好友支付',
payStatus: 1,
}
],
orderId: 0,
// fromType: '', // TODO
active: 0,
payPrice: 0,
payPriceShow: 0,
payPostage: 0,
offlinePostage: false,
invalidTime: 0,
initIn: false,
jumpData: {
orderId: '',
msg: ''
},
formContent: '',
channelCode: '', //
form: { // form
html: '',
},
}
},
watch: {
cartArr: {
handler(newV, oldValue) {
let newPayList = [];
newV.forEach((item, index) => {
if (item.payStatus) {
item.index = index;
newPayList.push(item)
}
});
this.active = newPayList[0].index;
this.paytype = newPayList[0].value;
this.number = newPayList[0].number || 0;
this.channelCode = newPayList[0].channelCode || '';
},
immediate: true,
deep: true
}
},
onLoad(options) {
if (options.order_id) this.orderId = options.order_id
if (options.from_type) this.fromType = options.from_type
this.getCashierOrder()
},
onShow() {
let options = wx.getEnterOptionsSync();
console.log(options)
if (options.scene == '1038' && options.referrerInfo.appId == 'wxef277996acc166c3' && this.initIn) {
//
let extraData = options.referrerInfo.extraData;
this.initIn = false
if (!extraData) {
// "";
this.$util.Tips({
title: '取消支付'
}, {
tab: 5,
url: `/pages/goods/order_pay_status/index?order_id=${this.orderId}&msg=${this.$t(`取消支付`)}&type=3&totalPrice=${this.payPriceShow}&status=2`
});
} else {
if (extraData.code == 'success') {
this.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: 5,
url: `/pages/goods/order_pay_status/index?order_id=${this.orderId}&msg=${this.jumpData.msg}&type=3&totalPrice=${this.payPriceShow}`
});
} else if (extraData.code == 'cancel') {
// "";
this.$util.Tips({
title: '取消支付'
}, {
tab: 5,
url: `/pages/goods/order_pay_status/index?order_id=${this.orderId}&msg=${this.$t(`取消支付`)}&type=3&totalPrice=${this.payPriceShow}&status=2`
});
} else {
// "" + extraData.errmsg;
uni.reLaunch({
url: `/pages/goods/order_pay_status/index?order_id=${this.orderId}&msg=${this.$t(`支付失败`)}&totalPrice=${this.payPriceShow}`
})
}
}
}
},
methods: {
getCashierOrder() {
uni.showLoading({
title: '创建订单中'
});
PayOrderApi.getOrder(this.orderId).then(res => {
console.log(res)
this.payPrice = this.payPriceShow = res.data.price
this.payPostage = res.data.pay_postage
this.offlinePostage = res.data.offline_postage
this.invalidTime = res.data.expireTime
// TODO
// this.cartArr[0].payStatus = res.data.wechat_pay_status || 0
this.cartArr[0].payStatus = res.data.wechat_pay_status || 1
// TODO
// this.cartArr[1].payStatus = res.data.ali_pay_status || 0;
this.cartArr[1].payStatus = res.data.ali_pay_status || 1;
//#ifdef MP
this.cartArr[1].payStatus = false;
//#endif
//
// that.cartArr[2].title = ':' + res.data.userInfo.now_money;
this.cartArr[2].number = res.data.now_money;
this.cartArr[2].payStatus = res.data.yue_pay_status
if (res.data.offline_pay_status) {
this.cartArr[3].payStatus = 1
} else {
this.cartArr[3].payStatus = 0
}
//
this.cartArr[4].payStatus = res.data.friend_pay_status || 0;
uni.hideLoading();
}).catch(err => {
uni.hideLoading();
return this.$util.Tips({
title: err
})
})
},
payType(number, paytype, index, channelCode) {
this.active = index;
this.paytype = paytype;
this.number = number;
this.channelCode = channelCode
if (this.offlinePostage) {
if (paytype === 'offline') {
this.payPriceShow = this.$util.$h.Sub(this.payPrice, this.payPostage);
} else {
this.payPriceShow = this.payPrice;
}
}
},
formpost(url, postData) {
let tempform = document.createElement("form");
tempform.action = url;
tempform.method = "post";
tempform.target = "_self";
tempform.style.display = "none";
if (postData) {
for (let x in postData) {
let opt = document.createElement("input");
opt.name = x;
opt.value = postData[x];
tempform.appendChild(opt);
}
}
document.body.appendChild(tempform);
this.$nextTick(e => {
tempform.submit();
})
},
waitPay() {
uni.reLaunch({
url: '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=取消支付&type=3' +
'&status=2&totalPrice=' + this.payPriceShow
})
},
goPay(number, paytype, channelCode) {
let that = this;
if (!that.orderId) return that.$util.Tips({
title: '请选择要支付的订单'
});
if (paytype === 'yue' && parseFloat(number) < parseFloat(that.payPriceShow)) return that.$util.Tips({
title: '余额不足'
});
uni.showLoading({
title: '支付中'
});
if (paytype === 'friend' && that.orderId) {
uni.hideLoading();
return uni.navigateTo({
url: '/pages/users/payment_on_behalf/index?order_id=' + that.orderId + '&spread=' +
this.$store.state.app.uid,
success: res => {},
fail: () => {},
complete: () => {}
});
}
PayOrderApi.submitOrder({
id: that.orderId,
channelCode: channelCode,
displayMode: 'url', // TODO
// TODO
uni: that.orderId,
paytype: paytype,
type: that.friendPay ? 1 : 0,
// TODO quitUrl pc wap
// TODO returnUrl
// #ifdef H5
quitUrl: location.port ? location.protocol + '//' + location.hostname + ':' + location
.port +
'/pages/goods/order_details/index?order_id=' + this.orderId : location.protocol +
'//' + location.hostname +
'/pages/goods/order_details/index?order_id=' + this.orderId
// #endif
// #ifdef APP-PLUS
quitUrl: '/pages/goods/order_details/index?order_id=' + this.orderId
// #endif
}).then(res => {
// TODO
this.formpost(res.data.displayContent)
if (true) {
return;
}
let status = res.data.status,
orderId = res.data.result.orderId,
jsConfig = res.data.result.jsConfig,
goPages = '/pages/goods/order_pay_status/index?order_id=' + this.orderId + '&msg=' +
res
.msg +
'&type=3' + '&totalPrice=' + this.payPriceShow,
friendPay = '/pages/users/payment_on_behalf/index?order_id=' + this.orderId +
'&spread=' +
this.$store.state.app.uid
switch (status) {
case 'ORDER_EXIST':
case 'EXTEND_ORDER':
uni.hideLoading();
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages
});
case 'ALLINPAY_PAY':
uni.hideLoading();
// #ifdef MP
this.initIn = true
wx.openEmbeddedMiniProgram({
appId: 'wxef277996acc166c3',
extraData: {
cusid: jsConfig.cusid,
appid: jsConfig.appid,
version: jsConfig.version,
trxamt: jsConfig.trxamt,
reqsn: jsConfig.reqsn,
notify_url: jsConfig.notify_url,
body: jsConfig.body,
remark: jsConfig.remark,
validtime: jsConfig.validtime,
randomstr: jsConfig.randomstr,
paytype: jsConfig.paytype,
sign: jsConfig.sign,
signtype: jsConfig.signtype
}
})
this.jumpData = {
orderId: res.data.result.orderId,
msg: res.msg,
}
// #endif
// #ifdef APP-PLUS
plus.runtime.openURL(jsConfig.payinfo);
setTimeout(e => {
uni.reLaunch({
url: goPages
})
}, 1000)
// #endif
// #ifdef H5
this.formpost(res.data.result.pay_url, jsConfig)
// #endif
break;
case 'PAY_ERROR':
uni.hideLoading();
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages
});
break;
case 'SUCCESS':
uni.hideLoading();
if (paytype !== 'friend') {
return that.$util.Tips({
title: res.msg,
icon: 'success'
}, {
tab: 4,
url: goPages
});
} else {
return that.$util.Tips({
title: res.msg,
icon: 'success'
}, {
tab: 4,
url: friendPay
});
}
break;
case 'WECHAT_PAY':
that.toPay = true;
// #ifdef MP
/* that.toPay = true; */
let mp_pay_name = ''
if (uni.requestOrderPayment) {
mp_pay_name = 'requestOrderPayment'
} else {
mp_pay_name = 'requestPayment'
}
uni[mp_pay_name]({
timeStamp: jsConfig.timestamp,
nonceStr: jsConfig.nonceStr,
package: jsConfig.package,
signType: jsConfig.signType,
paySign: jsConfig.paySign,
success: function(res) {
uni.hideLoading();
if (that.BargainId || that.combinationId || that.pinkId ||
that
.seckillId || that.discountId)
return that.$util.Tips({
title: that.$t(`支付成功`),
icon: 'success'
}, {
tab: 4,
url: goPages
});
return that.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: 5,
url: goPages
});
},
fail: function(e) {
uni.hideLoading();
return that.$util.Tips({
title: '取消支付'
}, {
tab: 5,
url: goPages + '&status=2'
});
},
complete: function(e) {
uni.hideLoading();
//
if (res.errMsg == 'requestPayment:cancel' || e.errMsg == 'requestOrderPayment:cancel') return that.$util
.Tips({
title: '取消支付'
}, {
tab: 5,
url: goPages + '&status=2'
});
},
})
// #endif
// #ifdef H5
this.$wechat.pay(res.data.result.jsConfig).then(res => {
return that.$util.Tips({
title: '支付成功',
icon: 'success'
}, {
tab: 5,
url: goPages
});
}).catch(res => {
if (!this.$wechat.isWeixin()) {
uni.redirectTo({
url: goPages + '&msg=' + that.$t(`支付失败`) +
'&status=2'
// '&msg=&status=2'
})
}
if (res.errMsg == 'chooseWXPay:cancel') return that.$util.Tips({
title: '取消支付'
}, {
tab: 5,
url: goPages + '&status=2'
});
})
// #endif
// #ifdef APP-PLUS
uni.requestPayment({
provider: 'wxpay',
orderInfo: jsConfig,
success: (e) => {
let url = goPages;
uni.showToast({
title: '支付成功'
})
setTimeout(res => {
uni.redirectTo({
url: url
})
}, 2000)
},
fail: (e) => {
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + '支付失败';
uni.showModal({
content: '支付失败',
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: url
})
} else if (res.cancel) {}
}
})
},
complete: () => {
uni.hideLoading();
},
});
// #endif
break;
case 'PAY_DEFICIENCY':
uni.hideLoading();
//
return that.$util.Tips({
title: res.msg
}, {
tab: 5,
url: goPages + '&status=1'
});
break;
case "WECHAT_H5_PAY":
uni.hideLoading();
that.$util.Tips({
title: '等待支付中'
}, {
tab: 4,
url: goPages + '&status=0'
});
setTimeout(() => {
location.href = res.data.result.jsConfig.h5_url;
}, 1500);
break;
case 'ALIPAY_PAY':
//#ifdef H5
uni.hideLoading();
that.$util.Tips({
title: '等待支付中'
}, {
tab: 4,
url: goPages + '&status=0'
});
that.formContent = res.data.result.jsConfig;
setTimeout(() => {
document.getElementById('alipaysubmit').submit();
}, 1500);
//#endif
// #ifdef MP
uni.navigateTo({
url: `/pages/users/alipay_invoke/index?id=${orderId}&link=${jsConfig.qrCode}`
});
// #endif
// #ifdef APP-PLUS
uni.requestPayment({
provider: 'alipay',
orderInfo: jsConfig,
success: (e) => {
uni.showToast({
title: '支付成功'
})
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + '支付成功';
setTimeout(res => {
uni.redirectTo({
url: url
})
}, 2000)
},
fail: (e) => {
let url = '/pages/goods/order_pay_status/index?order_id=' +
orderId +
'&msg=' + '支付失败';
uni.showModal({
content: '支付失败',
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: url
})
} else if (res.cancel) {}
}
})
},
complete: () => {
uni.hideLoading();
},
});
// #endif
break;
}
}).catch(err => {
uni.hideLoading();
return that.$util.Tips({
title: err
}, () => {
that.$emit('onChangeFun', {
action: 'pay_fail'
});
});
})
}
}
}
</script>
<style lang="scss" scoped>
.page {
.pay-price {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
padding: 50rpx 0 40rpx 0;
.price {
color: #E93323;
margin-bottom: 20rpx;
display: flex;
align-items: flex-end;
.unit {
font-size: 34rpx;
font-weight: 500;
line-height: 41rpx;
}
.num {
font-size: 50rpx;
font-weight: 600;
}
}
.count-down {
display: flex;
align-items: center;
background-color: #fff;
padding: 8rpx 28rpx;
border-radius: 40rpx;
font-size: 24rpx;
color: #E93323;
.time {
margin-top: 0 !important;
}
/deep/.red {
margin: 0 !important;
}
}
}
.payment {
width: 690rpx;
border-radius: 14rpx 14rpx;
background-color: #fff;
z-index: 999;
margin: 0 30rpx;
.title {
color: #666666;
font-size: 26rpx;
padding: 30rpx 0 0 30rpx;
}
.payMoney {
font-size: 28rpx;
color: #333333;
text-align: center;
margin-top: 50rpx;
.font-color {
margin-left: 10rpx;
.money {
font-size: 40rpx;
}
}
}
}
.payment.on {
transform: translate3d(0, 0, 0);
}
.icon-xuanzhong11 {
color: #E93323 !important;
}
.payment .item {
border-bottom: 1rpx solid #eee;
height: 130rpx;
margin-left: 30rpx;
padding-right: 30rpx;
}
.payment .item:last-child {
border-bottom: none;
}
.payment .item .left {
flex: 1;
}
.payment .item .left .text {
flex: 1;
}
.payment .item .left .text .name {
font-size: 30rpx;
color: #333;
}
.payment .item .left .text .info {
font-size: 22rpx;
color: #999;
}
.payment .item .left .text .info .money {
color: #ff9900;
}
.payment .item .left .iconfont {
font-size: 50rpx;
color: #09bb07;
margin-right: 28rpx;
}
.payment .item .left .iconfont.icon-zhifubao {
color: #00aaea;
}
.payment .item .left .iconfont.icon-yuezhifu {
color: #ff9900;
}
.payment .item .left .iconfont.icon-yuezhifu1 {
color: #eb6623;
}
.payment .item .left .iconfont.icon-tonglianzhifu1 {
color: #305fd8;
}
.payment .item .iconfont {
font-size: 40rpx;
color: #ccc;
}
.icon-haoyoudaizhifu {
color: #F34C3E !important;
}
.btn {
position: fixed;
left: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
bottom: 30rpx;
bottom: calc(30rpx + constant(safe-area-inset-bottom)); /// IOS<11.2/
bottom: calc(30rpx + env(safe-area-inset-bottom)); /// IOS>11.2/
}
.wait-pay {
color: #aaa;
font-size: 24rpx;
padding-top: 20rpx;
}
.button {
width: 690rpx;
height: 90rpx;
border-radius: 45rpx;
color: #FFFFFF;
background-color: #E93323;
}
}
</style>

View File

@ -9,7 +9,7 @@
<view class="lines"></view>
<view class="point">{{point}} </view>
<countDown :is-day="false" :tip-text="' '" :day-text="' '" :hour-text="' : '" :minute-text="' : '" :second-text="' '"
:datatime="datatime" :is-col="true" :bgColor="bgColor" />
:datatime="datatime" :is-col="true" :bgColor="bgColor" />
</view>
<navigator url="/pages/activity/goods_seckill/index" hover-class="none" class="more acea-row row-center-wrapper">
GO<text class="iconfont icon-xiangyou"></text>

View File

@ -56,7 +56,7 @@
<text class='iconfont icon-jiantou'></text>
</view>
</view>
<!-- 积分展示 TODO -->
<!-- 积分展示 -->
<view class='item acea-row row-between-wrapper' v-if="orderInfoVo.type === 1 && productType==='normal'">
<view>积分抵扣</view>
<view class='discount acea-row row-middle'>
@ -275,16 +275,7 @@
* 获得订单确认信息
*/
getloadPreOrder: function() {
OrderApi.settlementOrder({
items: this.items,
deliveryType: this.deliveryType,
addressId: this.address.addressId > 0 && this.deliveryType === 1 ? this.address.addressId : undefined,
receiverName: this.deliveryType === 2 ? this.contacts : undefined,
receiverMobile: this.deliveryType === 2 ? this.contactsTel : undefined,
couponId: this.couponId > 0 ? this.couponId : undefined,
pointStatus: this.pointStatus,
// TODO
}).then(res => {
OrderApi.settlementOrder(this.getSettlementReqVO()).then(res => {
const orderInfoVo = res.data
this.orderInfoVo = orderInfoVo;
this.cartInfo = orderInfoVo.items;
@ -303,74 +294,79 @@
});
})
},
/**
* 输入
*/
bindHideKeyboard: function(e) {
this.mark = e.detail.value;
},
orderCreate: function(data) {
let that = this;
orderCreate(data).then(res => {
that.getOrderPay(res.data.orderNo, '支付成功');
}).catch(err => {
uni.hideLoading();
return that.$util.Tips({
title: err
});
});
},
SubOrder: function(e) {
SubOrder: function(e) {
//
if (!this.address.addressId && this.deliveryType === 1) {
if (!this.address.addressId && this.deliveryType === 1) {
return this.$util.Tips({
title: '请选择收货地址'
});
}
if (this.deliveryType === 2) {
if (this.contacts === "" || this.contactsTel === "") {
return this.$util.Tips({
title: '请填写联系人或联系人电话'
});
}
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
return this.$util.Tips({
title: '请填写正确的手机号'
});
}
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
return this.$util.Tips({
title: '请填写您的真实姓名'
});
}
if (this.storeList.length === 0) {
if (this.deliveryType === 2) {
if (this.contacts === "" || this.contactsTel === "") {
return this.$util.Tips({
title: '请填写联系人或联系人电话'
});
}
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
return this.$util.Tips({
title: '请填写正确的手机号'
});
}
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
return this.$util.Tips({
title: '请填写您的真实姓名'
});
}
if (this.storeList.length === 0) {
return this.$util.Tips({
title: '暂无门店,请选择其他方式'
});
}
}
const data = {
realName: this.contacts,
phone: this.contactsTel,
addressId: this.address.addressId,
couponId: this.couponId,
pointStatus: this.pointStatus,
preOrderNo: this.preOrderNo,
mark: this.mark,
storeId: this.system_store.id > 0 ? this.system_store.id : undefined,
deliveryType: this.deliveryType,
};
// #ifdef MP
openPaySubscribe().then(() => {
this.orderCreate(data);
});
// #endif
// #ifndef MP
this.orderCreate(data);
// #endif
}
// #ifdef MP
openPaySubscribe().then(() => {
this.orderCreate();
});
// #endif
// #ifndef MP
this.orderCreate();
// #endif
},
orderCreate: function() {
OrderApi.createOrder({
...this.getSettlementReqVO(),
mark: this.mark,
}).then(res => {
alert(res);
}).catch(err => {
uni.hideLoading();
return this.$util.Tips({
title: err
});
});
},
/**
* 获得结算请求 VO
*/
getSettlementReqVO() {
return {
items: this.items,
deliveryType: this.deliveryType,
addressId: this.address.addressId > 0 && this.deliveryType === 1 ? this.address.addressId : undefined,
pickUpStoreId: this.system_store.id > 0 && this.deliveryType === 2 ? this.system_store.id : undefined,
receiverName: this.deliveryType === 2 ? this.contacts : undefined,
receiverMobile: this.deliveryType === 2 ? this.contactsTel : undefined,
couponId: this.couponId > 0 ? this.couponId : undefined,
pointStatus: this.pointStatus,
// TODO
}
},
/**
* 输入备注
*/
bindHideKeyboard: function(e) {
this.mark = e.detail.value;
},
// ========== ==========