|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <view class="content">
|
|
|
+ <view class="content page-contanier" :class="['qn-page-' + theme]">
|
|
|
<view class="" style="background-color: #4076d6;height: 100rpx;">
|
|
|
|
|
|
</view>
|
|
|
@@ -90,9 +90,10 @@
|
|
|
<its-calendar :sta_num="start_time" :end_num="end_time" :int_num="30" @getTime="getTime"></its-calendar>
|
|
|
<!-- 指派 -->
|
|
|
<scroll-view scroll-x="true" class="zp-wrap" v-if="timed">
|
|
|
- <view class="zp-item" v-for="ygitem in yg.list" @click="choosYg(ygitem)">
|
|
|
- <image src="" mode="" class="zp-logo"></image>
|
|
|
- <view class="zp-name">随机指派</view>
|
|
|
+ <view class="zp-item" v-for="ygitem in yg.list" @click="choosYg(ygitem)"
|
|
|
+ :class="{'choose': ygitem.uid == choose_yg.uid}">
|
|
|
+ <image :src="ygitem.avatar" mode="" class="zp-logo"></image>
|
|
|
+ <view class="zp-name">{{ygitem.staffName}}</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
<!-- 结算 -->
|
|
|
@@ -100,15 +101,53 @@
|
|
|
<view class="" style="height: 110rpx;"></view>
|
|
|
<view class="tj-dd">
|
|
|
<view class="">
|
|
|
- <text style="font-size: 26rpx;color: #999;">提交</text>
|
|
|
+ <text style="font-size: 26rpx;color: #999;">实付</text>
|
|
|
<text style="color: #CE372E;font-size: 44rpx;font-weight: bold;padding-left: 10rpx;"
|
|
|
- class="rmb">1000</text>
|
|
|
- <text style="font-size: 22rpx;color: #333333;font-weight: bold;">(包含预约费¥3元)</text>
|
|
|
+ class="rmb">{{order_detail.pay_price || '0'}}</text>
|
|
|
+ <!-- <text style="font-size: 22rpx;color: #333333;font-weight: bold;">(包含预约费¥3元)</text> -->
|
|
|
</view>
|
|
|
- <view class="tj-btn">
|
|
|
+ <view class="tj-btn" @click="canpay?selPayFun():''" :class="{'canpay': canpay}">
|
|
|
提交
|
|
|
</view>
|
|
|
+ <!-- <view class="tj-btn" @click="selPayFun()" :class="{'canpay': canpay}">
|
|
|
+ 提交
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
+ <u-popup v-model="payPop" mode="bottom" :border-radius="12">
|
|
|
+ <view class="pay-pop-view">
|
|
|
+ <view class="pay-sel-title clearfix">
|
|
|
+ <text class="float_left">付款方式</text>
|
|
|
+ <text class="float_right ibonfont ibonguanbi" @click="closePayPop"></text>
|
|
|
+ </view>
|
|
|
+ <view class="pay-ul">
|
|
|
+ <view class="pay-li" @click="pay_type = 1">
|
|
|
+ <text class="ibonfont ibonhuodaofukuan"></text>
|
|
|
+ <view class="pay-name clearfix"
|
|
|
+ :class="[order_detail.pay_price*1 > Number(order_detail.memberBalance) ? 'balance-pay-name' : '']">
|
|
|
+ <view class="float_left">
|
|
|
+ <text>余额</text>
|
|
|
+ <text class="balace-num">(余额:¥{{ Number(order_detail.memberBalance) }})</text>
|
|
|
+ </view>
|
|
|
+ <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 1"></text>
|
|
|
+ <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="pay-li" @click="pay_type = 2" v-if="order_detail.pay_price*1 > 0">
|
|
|
+ <text class="ibonfont ibonweixinzhifu"></text>
|
|
|
+ <view class="pay-name clearfix ">
|
|
|
+ <view class="float_left">
|
|
|
+ <text>微信</text>
|
|
|
+ </view>
|
|
|
+ <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 2"></text>
|
|
|
+ <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="pay-btn primary-btn" @click="submit">
|
|
|
+ <text>确定</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -120,6 +159,8 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ payPop: false,
|
|
|
+ canpay: false,
|
|
|
good_id: '',
|
|
|
item_detail: {},
|
|
|
mjly: '',
|
|
|
@@ -138,15 +179,19 @@
|
|
|
loadingType: 'loadmore',
|
|
|
loaded: false,
|
|
|
},
|
|
|
- choose_yg: {},
|
|
|
+ choose_yg: {
|
|
|
+
|
|
|
+ },
|
|
|
choose_store: {},
|
|
|
- choose_time: {},
|
|
|
- count_detail: {}, //计算结果
|
|
|
+ choose_time: '',
|
|
|
+ choose_time_detail: '',
|
|
|
+ order_detail: {}, //计算结果
|
|
|
timed: false, //是否选择完时间
|
|
|
store_choose_show: false, //门店选择弹出层开关
|
|
|
start_time: 0,
|
|
|
end_time: 24,
|
|
|
- yyshow: true
|
|
|
+ yyshow: true,
|
|
|
+ pay_type: 1, //1余额2微信3支付宝
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -159,29 +204,44 @@
|
|
|
},
|
|
|
watch: {
|
|
|
choose_store(newval, oldval) {
|
|
|
+ this.choose_yg = {}
|
|
|
if (newval.openTime.isAllDay != 1) {
|
|
|
let start = newval.openTime.start.split(':')
|
|
|
let end = newval.openTime.end.split(':')
|
|
|
- if(start[1]>30) {
|
|
|
- this.start_time = start[0]*1 + 1
|
|
|
- }else {
|
|
|
- this.start_time = start[0]*1
|
|
|
+ if (start[1] > 30) {
|
|
|
+ this.start_time = start[0] * 1 + 1
|
|
|
+ } else {
|
|
|
+ this.start_time = start[0] * 1
|
|
|
}
|
|
|
- this.end_time = end[0]*1
|
|
|
+ this.end_time = end[0] * 1
|
|
|
console.log(this.start_time)
|
|
|
- return;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.start_time = 0
|
|
|
this.end_time = 24
|
|
|
console.log(this.start_time)
|
|
|
- return;
|
|
|
+ }
|
|
|
+ if (this.choose_time != '') {
|
|
|
+ console.log(this.choose_time, 'this.choose_time ')
|
|
|
+ this.getYgList('reload')
|
|
|
}
|
|
|
},
|
|
|
choose_time(newval, oldval) {
|
|
|
this.getYgList('reload')
|
|
|
},
|
|
|
choose_yg(newval, oldval) {
|
|
|
- this.getYgYyTimeArea()
|
|
|
+ if (newval.staffName && newval.uid != 0) {
|
|
|
+ this.getYgYyTimeArea()
|
|
|
+ }else {
|
|
|
+ if(newval.staffName == '随机指派' && this.choose_time) {
|
|
|
+ this.canpay = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ choose_time_detail(newval, oldval) {
|
|
|
+ if (this.choose_store && this.choose_yg.uid != 0) {
|
|
|
+ this.getYgYyTimeArea()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onLoad(opt) {
|
|
|
@@ -221,7 +281,8 @@
|
|
|
console.log(e);
|
|
|
this.timed = true
|
|
|
this.choose_time = e.time.split(' ')[0]
|
|
|
-
|
|
|
+ this.choose_time_detail = e.time.split(' ')[1]
|
|
|
+
|
|
|
},
|
|
|
//计算价格
|
|
|
calculation() {
|
|
|
@@ -232,6 +293,7 @@
|
|
|
data
|
|
|
}) => {
|
|
|
console.log(data, 'price')
|
|
|
+ this.order_detail = data
|
|
|
}).catch(err => {
|
|
|
|
|
|
})
|
|
|
@@ -250,7 +312,7 @@
|
|
|
// 获取门店列表
|
|
|
getStoreList() {
|
|
|
console.log('获取门店列表')
|
|
|
- let item = this.store
|
|
|
+ let item = this.store
|
|
|
if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
|
|
|
return
|
|
|
}
|
|
|
@@ -280,7 +342,7 @@
|
|
|
//获取员工列表
|
|
|
getYgList(type) {
|
|
|
let item = this.yg
|
|
|
- if(type == 'reload') {
|
|
|
+ if (type == 'reload') {
|
|
|
item.list = []
|
|
|
item.loadingType = 'loadmore'
|
|
|
}
|
|
|
@@ -289,23 +351,158 @@
|
|
|
}
|
|
|
item.loadingType = 'loading'
|
|
|
this.$u.api.getTimeYgList({
|
|
|
- time: this.choose_time
|
|
|
- }).then(({data}) => {
|
|
|
- if(data != '当天未找到员工') {
|
|
|
- item.list = data
|
|
|
- }
|
|
|
-
|
|
|
+ time: this.choose_time,
|
|
|
+ 'SHOP-TOKEN': this.choose_store.token
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ let arr = [{
|
|
|
+ uid: 0,
|
|
|
+ staffName: '随机指派'
|
|
|
+ }]
|
|
|
+ item.list = arr.concat(data)
|
|
|
+
|
|
|
item.loadingType = 'nomore'
|
|
|
})
|
|
|
},
|
|
|
+ cannot(title = '该员工不在工作时间') {
|
|
|
+ uni.showToast({
|
|
|
+ title: title,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ // this.choose_yg = {
|
|
|
+ // uid: 0,
|
|
|
+ // staffName: '随机指派'
|
|
|
+ // }
|
|
|
+ this.canpay = false
|
|
|
+ },
|
|
|
//判断是否能预约员工
|
|
|
getYgYyTimeArea() {
|
|
|
- this.$u.api.getYgYyTimeArea({
|
|
|
- time: this.choose_time,
|
|
|
- uid: this.choose_yg.id
|
|
|
- }).then(({data}) => {
|
|
|
+ let that = this
|
|
|
+ that.$u.api.getYgYyTimeArea({
|
|
|
+ time: that.choose_time,
|
|
|
+ uid: that.choose_yg.uid
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ console.log()
|
|
|
+ let choose_time = that.choose_time_detail.replace(/\:/g, '')
|
|
|
+ let worktime = [data.time_slot[0][0].replace(/\:/g, ''), data.time_slot[0][1].replace(/\:/g,
|
|
|
+ '')]
|
|
|
+ // 判断员工是否在工作时间
|
|
|
+ console.log(choose_time, worktime)
|
|
|
+ if (choose_time * 1 >= worktime[0] * 1 && choose_time * 1 <= worktime[1] * 1) {
|
|
|
+ this.canpay = true
|
|
|
+ } else {
|
|
|
+ that.cannot()
|
|
|
+ }
|
|
|
+ if(data.reserved.length > 0 ) {
|
|
|
+ for(let i = 0;i< data.reserved.length; i++) {
|
|
|
+ console.log(i)
|
|
|
+ if( that.choose_time_detail == data.reserved[i]) {
|
|
|
+ that.cannot('该员工已有预约')
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
})
|
|
|
+ },
|
|
|
+ choosYg(item) {
|
|
|
+ this.choose_yg = item
|
|
|
+ // //查看员工是否有空
|
|
|
+ // if (this.choose_yg.uid != 0) {
|
|
|
+ // this.getYgYyTimeArea()
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ selPayFun() {
|
|
|
+ // if (!this.is_notExpress) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ this.payPop = true;
|
|
|
+ },
|
|
|
+ // 创建项目订单
|
|
|
+ createItemOrder() {
|
|
|
+ let that = this
|
|
|
+ that.$u.api.createItemOrder({
|
|
|
+ "order_id": that.order_detail.order_id,
|
|
|
+ "time": that.choose_time + ' ' + that.choose_time_detail, //预约时间
|
|
|
+ "staff_id": that.choose_yg.uid, //0随机排员工 指定员工传入员工id
|
|
|
+ "pay_type": 2, //1余额2微信3支付宝
|
|
|
+ "source": 3, //微信8h5支付3小程序支付0app支付
|
|
|
+ "remarks": that.mjly, //备注
|
|
|
+ "SHOP-TOKEN": that.choose_store.token
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ let that = this
|
|
|
+ // 判断余额是否足够
|
|
|
+
|
|
|
+ if(that.pay_type == 1 && (that.order_detail.pay_price*1 > that.order_detail.memberBalance*1)) {
|
|
|
+ return this.$u.toast('抱歉,您的可用余额不足');
|
|
|
+ }
|
|
|
+ that.$u.api.createItemOrder({
|
|
|
+ "order_id": that.order_detail.order_id,
|
|
|
+ "time": that.choose_time + ' ' + that.choose_time_detail, //预约时间
|
|
|
+ "staff_id": that.choose_yg.uid, //0随机排员工 指定员工传入员工id
|
|
|
+ "pay_type": that.pay_type, //1余额2微信3支付宝
|
|
|
+ "source": that.pay_type == 2 ? 3: '',
|
|
|
+ "remarks": that.mjly, //备注
|
|
|
+ "SHOP-TOKEN": that.choose_store.token
|
|
|
+ }).then(({
|
|
|
+ data
|
|
|
+ }) => {
|
|
|
+ // 余额支付
|
|
|
+ if(that.pay_type == 1) {
|
|
|
+ console.log(data)
|
|
|
+ if(data == '支付成功' || data.data == '支付成功') {
|
|
|
+ that.payPop = false
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pagesT/money/paySuccess?price=' + that.order_detail.pay_price + '&isyy=1'
|
|
|
+ })
|
|
|
+ }, 200);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 微信支付
|
|
|
+ if(that.pay_type == 2) {
|
|
|
+ // data.data
|
|
|
+ let payInfo = data.data
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: payInfo.timeStamp, //当前时间
|
|
|
+ nonceStr: payInfo.nonceStr, //随机字符串,长度在32一下
|
|
|
+ package: payInfo.package, //统一单接口返回的prepay_id
|
|
|
+ signType: payInfo.signType, //签名算法,目前支持MD5
|
|
|
+ paySign: payInfo.paySign, //签名
|
|
|
+ success: res => {
|
|
|
+ // 订单审核,取消订单提醒
|
|
|
+ that.payPop = false
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pagesT/money/paySuccess?price=' + that.order_detail.pay_price + '&isyy=1'
|
|
|
+ })
|
|
|
+
|
|
|
+ }, 200);
|
|
|
+ },
|
|
|
+ fail: async err => {
|
|
|
+ that.payPop = false
|
|
|
+ console.log('支付失败');
|
|
|
+ await setTimeout(() => {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pagesT/order/orderT?state=0'
|
|
|
+ });
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -426,6 +623,8 @@
|
|
|
height: 216rpx;
|
|
|
white-space: nowrap;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
.zp-item {
|
|
|
display: inline-block;
|
|
|
margin-right: 15rpx;
|
|
|
@@ -446,6 +645,7 @@
|
|
|
}
|
|
|
|
|
|
.zp-name {
|
|
|
+ margin-top: 15rpx;
|
|
|
width: 100%;
|
|
|
text-align: center;
|
|
|
font-size: 30rpx;
|
|
|
@@ -453,6 +653,15 @@
|
|
|
color: #333333;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .choose {
|
|
|
+ background-color: #262261 !important;
|
|
|
+
|
|
|
+ .zp-name {
|
|
|
+ color: #fff !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.tj-dd {
|
|
|
@@ -471,13 +680,17 @@
|
|
|
height: 75rpx;
|
|
|
line-height: 75rpx;
|
|
|
color: #fff;
|
|
|
- background-color: #d84840;
|
|
|
+ background-color: #999;
|
|
|
border-radius: 10rpx;
|
|
|
text-align: center;
|
|
|
font-size: 28rpx;
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ .canpay {
|
|
|
+ background-color: #d84840;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.rmb {
|
|
|
@@ -566,4 +779,90 @@
|
|
|
border: 1px solid #262261;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .pay-pop-view {
|
|
|
+ background-color: #ffffff;
|
|
|
+ border-top-left-radius: 12upx;
|
|
|
+ border-top-right-radius: 12upx;
|
|
|
+ font-size: 28upx;
|
|
|
+
|
|
|
+ .pay-sel-title {
|
|
|
+ padding: 0 30upx;
|
|
|
+ line-height: 88upx;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 32upx;
|
|
|
+
|
|
|
+ .ibonfont {
|
|
|
+ color: #999;
|
|
|
+ font-weight: 400;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .pay-btn {
|
|
|
+ height: 90upx;
|
|
|
+ line-height: 90upx;
|
|
|
+ color: #000;
|
|
|
+ font-size: 32upx;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #108ee9;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pay-ul {
|
|
|
+ .pay-li {
|
|
|
+ line-height: 100upx;
|
|
|
+
|
|
|
+ .ibonfont {
|
|
|
+ padding-left: 30upx;
|
|
|
+ font-size: 46upx;
|
|
|
+ vertical-align: middle;
|
|
|
+ margin-right: 24upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ibonweixinzhifu {
|
|
|
+ color: #04be02;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ibonumidd17 {
|
|
|
+ color: #108ee9;
|
|
|
+ }
|
|
|
+
|
|
|
+ .ibonhuodaofukuan {
|
|
|
+ color: #f2b844;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pay-name {
|
|
|
+ width: 650upx;
|
|
|
+ display: inline-block;
|
|
|
+ padding-right: 30upx;
|
|
|
+ vertical-align: middle;
|
|
|
+ border-bottom: 1px solid #f5f5f5;
|
|
|
+
|
|
|
+ .ibonxuanze1,
|
|
|
+ .ibonweixuanze {
|
|
|
+ margin-right: 0;
|
|
|
+ padding-left: 0;
|
|
|
+ font-size: 38upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .balace-num {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #6c6c6c;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .balance-pay-name {
|
|
|
+ position: relative;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
+
|
|
|
+ .balance-tip {
|
|
|
+ position: absolute;
|
|
|
+ font-size: 22rpx;
|
|
|
+ line-height: 36rpx;
|
|
|
+ bottom: 10rpx;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|