Skip to content

Commit f0b05be

Browse files
committed
加入预约核销
1 parent d7f3f2f commit f0b05be

4 files changed

Lines changed: 230 additions & 4 deletions

File tree

api/coupon/coupon.js

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,53 @@ export function getIntegralUserDetail(_that,_data){
119119
}
120120
})
121121
});
122-
}
122+
}
123+
124+
export function getReserveGoodsConfirmOrder(_that,_data){
125+
return new Promise(function(reslove,reject){
126+
_that.context.get({
127+
url: url.listReserveGoodsConfirmOrder,
128+
data:_data,
129+
success: function(res) {
130+
if(res.data.code != 0){
131+
reject(res.data.msg);
132+
return ;
133+
}
134+
reslove(res.data);
135+
},
136+
fail: function(e) {
137+
reject(e);
138+
}
139+
})
140+
});
141+
}
142+
143+
144+
export function saveReserveGoodsConfirmOrder(_that,_data){
145+
return new Promise(function(reslove,reject){
146+
// debugger
147+
_that.context.post({
148+
url: url.saveReserveGoodsConfirmOrder,
149+
data:_data,
150+
success: function(res) {
151+
if (res.data.code == 0){
152+
reslove(res);
153+
}else {
154+
// debugger
155+
wx.showToast({
156+
title: "核销状态:" + res.data.msg,
157+
icon: 'none',
158+
duration: 3000
159+
})
160+
}
161+
},
162+
fail: function(e) {
163+
wx.showToast({
164+
title: "服务器异常了",
165+
icon: 'none',
166+
duration: 3000
167+
})
168+
}
169+
})
170+
});
171+
}

constant/url.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ export default {
184184
queryOwners: baseUrl+"app/owner.queryOwners",
185185
queryOwnerAccount: baseUrl+"app/account/queryOwnerAccount",
186186
useIntegral: baseUrl+"app/integral.useIntegral",
187-
listIntegralUserDetail: baseUrl+"app/integral.listIntegralUserDetail",
187+
listIntegralUserDetail: baseUrl+"app/integral.listIntegralUserDetail",
188+
listReserveGoodsConfirmOrder: baseUrl+"app/reserveOrder.listReserveGoodsConfirmOrder",
189+
saveReserveGoodsConfirmOrder: baseUrl+"app/reserveOrder.saveReserveGoodsConfirmOrder",
190+
191+
188192

189193

190194

pages.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,7 @@
566566
{
567567
"navigationBarTitleText": "核销优惠券",
568568
"enablePullDownRefresh": false
569-
}
570-
569+
}
571570
}
572571
,{
573572
"path" : "pages/coupon/writeOffIntegral",
@@ -578,6 +577,15 @@
578577
}
579578

580579
}
580+
,{
581+
"path" : "pages/coupon/wirteOffReserve",
582+
"style" :
583+
{
584+
"navigationBarTitleText": "核销预约",
585+
"enablePullDownRefresh": false
586+
}
587+
588+
}
581589
],
582590
"globalStyle": {
583591
"navigationBarTextStyle": "white",

pages/coupon/wirteOffReserve.vue

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<template>
2+
<view>
3+
<view class="cu-bar bg-white search ">
4+
<view class="search-form round">
5+
<text class="cuIcon-search"></text>
6+
<input type="text" placeholder="输入核销码" v-model="reserveQrcode" confirm-type="search"></input>
7+
</view>
8+
<view class="action">
9+
<button class="cu-btn bg-gradual-green shadow-blur round" @click="navigateToScan()">扫码</button>
10+
<button style="margin-left: 10px;" class="cu-btn bg-gradual-red shadow-blur round"
11+
@click="comfirmTimeId(reserveQrcode)">核销</button>
12+
</view>
13+
</view>
14+
<view v-if="reserveOrders && reserveOrders.length>0">
15+
<view v-for="(item,index) in reserveOrders" :key="index"
16+
class="bg-white margin-top margin-right-xs radius margin-left-xs padding">
17+
<view class="flex padding-bottom-xs solid-bottom justify-between">
18+
<view style="font-size: 14px;">单号<span style="margin-left: 10px;"
19+
class="text-gray">{{item.orderId}}</span></view>
20+
</view>
21+
<view class="flex margin-top justify-between">
22+
<view class="text-gray">商品/服务</view>
23+
<view class="text-gray">{{item.goodsName}}</view>
24+
</view>
25+
<view class="flex margin-top-xs justify-between">
26+
<view class="text-gray">核销数量</view>
27+
<view class="text-gray">{{item.quantity}}</view>
28+
</view>
29+
<view class="flex margin-top-xs justify-between">
30+
<view class="text-gray">预约日期</view>
31+
<view class="text-gray">{{item.appointmentTime}}</view>
32+
</view>
33+
<view class="flex margin-top-xs justify-between">
34+
<view class="text-gray">预约小时</view>
35+
<view class="text-gray">{{item.hours}}</view>
36+
</view>
37+
<view class="flex margin-top-xs justify-between">
38+
<view class="text-gray">预约人</view>
39+
<view class="text-gray">{{item.personName}}({{item.personTel}})</view>
40+
</view>
41+
<view class="flex margin-top-xs justify-between">
42+
<view class="text-gray">核销时间</view>
43+
<view class="text-gray">{{item.createTime}}</view>
44+
</view>
45+
</view>
46+
</view>
47+
<view v-else>
48+
<no-data-page></no-data-page>
49+
</view>
50+
</view>
51+
</template>
52+
53+
<script>
54+
import noDataPage from '@/components/no-data-page/no-data-page.vue'
55+
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
56+
import url from '../../constant/url.js'
57+
import {
58+
getCurrentCommunity
59+
} from '../../api/community/community.js'
60+
import {
61+
getReserveGoodsConfirmOrder,
62+
saveReserveGoodsConfirmOrder
63+
} from '@/api/coupon/coupon.js'
64+
// 防止多次点击
65+
import {
66+
preventClick
67+
} from '@/lib/java110/utils/common.js';
68+
import Vue from 'vue'
69+
Vue.prototype.$preventClick = preventClick;
70+
export default {
71+
data() {
72+
return {
73+
onoff: true,
74+
orderImg: url.baseUrl + 'img/order.png',
75+
reserveOrders: [],
76+
page: 1,
77+
loadingStatus: 'loading',
78+
loadingContentText: {
79+
contentdown: '上拉加载更多',
80+
contentrefresh: '加载中',
81+
contentnomore: '没有更多'
82+
},
83+
reserveQrcode: '',
84+
modal: {
85+
showModal: false,
86+
title: '暂停原因',
87+
text: '请填写暂停原因'
88+
}
89+
}
90+
},
91+
components: {
92+
noDataPage,
93+
uniLoadMore
94+
},
95+
onLoad() {
96+
this.java110Context.onLoad();
97+
this._loadReserveUserDetail();
98+
},
99+
onShow() {
100+
let _userInfo = this.java110Context.getUserInfo();
101+
let _storeId = _userInfo.storeId;
102+
this.storeId = _storeId;
103+
},
104+
methods: {
105+
106+
// 获取核销订单
107+
_loadReserveUserDetail: function() {
108+
let _that = this;
109+
getReserveGoodsConfirmOrder(this, {
110+
page: 1,
111+
row: 100,
112+
communityId: getCurrentCommunity().communityId
113+
}).then(_data => {
114+
_that.reserveOrders = _data.data;
115+
})
116+
},
117+
navigateToScan() {
118+
setTimeout(() => {
119+
uni.navigateTo({
120+
url: `/pages/appointment/hou_one`
121+
})
122+
}, 300)
123+
},
124+
comfirmTimeId(timeId) {
125+
// debugger
126+
let _that = this;
127+
if (!timeId) {
128+
return;
129+
}
130+
_that.reserveQrcode = timeId;
131+
setTimeout(function() {
132+
uni.showModal({
133+
cancelText: "取消", // 取消按钮的文字
134+
confirmText: "核销",
135+
content: "核销码:" + timeId,
136+
success: (res) => {
137+
if (res.confirm) {
138+
wx.showToast({
139+
title: "请稍后",
140+
icon: 'none'
141+
});
142+
saveReserveGoodsConfirmOrder(_that, {
143+
timeId: timeId,
144+
communityId: getCurrentCommunity().communityId
145+
}).then(function(_res) {
146+
uni.showToast({
147+
title: '操作成功'
148+
});
149+
_that.reserveQrcode = "";
150+
wx.hideLoading();
151+
_that._loadReserveUserDetail();
152+
});
153+
}
154+
}
155+
});
156+
}, 1000);
157+
158+
},
159+
}
160+
}
161+
</script>
162+
163+
<style>
164+
165+
</style>

0 commit comments

Comments
 (0)