jufubao-takeorder 1.0.2-beta4 → 1.0.2-beta6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/JfbTakeorderFilterOrderList/Api.js +16 -31
- package/src/components/JfbTakeorderFilterOrderList/Attr.js +10 -6
- package/src/components/JfbTakeorderFilterOrderList/JfbTakeorderFilterOrderList.vue +304 -161
- package/src/components/JfbTakeorderFilterOrderList/Mock.js +1 -1
- package/src/components/JfbTakeorderFilterOrderList/cusAttr/advanced.js +26 -0
- package/src/components/JfbTakeorderFilterOrderList/cusAttr/content.js +9 -0
- package/src/components/JfbTakeorderFilterOrderList/cusAttr/style.js +11 -0
- package/src/components/JfbTakeorderIndex/Api.js +47 -1
- package/src/components/JfbTakeorderIndex/JfbTakeorderIndex.vue +221 -129
- package/src/components/JfbTakeorderIndex/Mock.js +4 -4
- package/src/components/JfbTakeorderIndex/components/cityPicker.vue +29 -21
- package/src/components/JfbTakeorderOrderDetail/Api.js +102 -0
- package/src/components/JfbTakeorderOrderDetail/JfbTakeorderOrderDetail.vue +1031 -665
- package/src/components/JfbTakeorderOrderDetail/Mock.js +9 -9
- package/src/components/JfbTakeorderOrderDetail/components/CusEditQuote.vue +2 -13
- package/src/components/JfbTakeorderOrderDetail/components/products.vue +16 -13
- package/src/components/JfbTakeorderOrderList/Api.js +16 -31
- package/src/components/JfbTakeorderOrderList/JfbTakeorderOrderList.vue +259 -123
- package/src/components/JfbTakeorderOrderList/Mock.js +1 -1
- package/src/components/JfbTakeorderOrderList/cusAttr/content.js +5 -5
- package/src/components/JfbTakeorderVoiceSwitch/Api.js +14 -33
- package/src/components/JfbTakeorderVoiceSwitch/JfbTakeorderVoiceSwitch.vue +154 -105
- package/src/components/JfbTakeorderVoiceSwitch/Mock.js +2 -10
- package/src/components/JfbTakeorderFilterOrderList/components/order.vue +0 -277
- package/src/components/JfbTakeorderIndex/components/order.vue +0 -273
- package/src/components/JfbTakeorderOrderList/components/order.vue +0 -273
|
@@ -5,16 +5,16 @@ import { customVal, dataVal } from "@/utils/AttrTools";
|
|
|
5
5
|
export default (data, gValue, gColor, oldData = {}) => {
|
|
6
6
|
return [
|
|
7
7
|
{
|
|
8
|
-
label: '
|
|
8
|
+
label: '订单状态:',
|
|
9
9
|
ele: 'xd-select-list',
|
|
10
|
-
valueKey: '
|
|
11
|
-
value: data['
|
|
10
|
+
valueKey: 'orderTab',
|
|
11
|
+
value: data['orderTab'] || '',
|
|
12
12
|
groupKey: 'content',
|
|
13
13
|
multiple: false,
|
|
14
14
|
className: 'input80',
|
|
15
15
|
list: [
|
|
16
|
-
{ label: '报价中', value: '
|
|
17
|
-
{ label: '待上报', value: '
|
|
16
|
+
{ label: '报价中', value: 'quoting' },
|
|
17
|
+
{ label: '待上报', value: 'wait_report' },
|
|
18
18
|
],
|
|
19
19
|
inline: false,
|
|
20
20
|
},
|
|
@@ -6,51 +6,32 @@
|
|
|
6
6
|
*/
|
|
7
7
|
module.exports = [
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
path: '/api/account/film/list-film-square',
|
|
9
|
+
mapFnName: 'getUserConfig',
|
|
10
|
+
title: '获取用户配置',
|
|
11
|
+
path: '/takeorder/v1/user-config',
|
|
13
12
|
isRule: false,
|
|
14
|
-
params: {
|
|
15
|
-
last_key: ['当前页', 'Number', '必选'],
|
|
16
|
-
page_size: ['每页数量', 'Number', '必选'],
|
|
17
|
-
},
|
|
18
|
-
isConsole: true,
|
|
19
|
-
disabled: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
//设置方法名字当别忘记加上【模块名字】:Voice
|
|
23
|
-
mapFnName: 'updateVoiceFilmPaiqiDate',
|
|
24
|
-
title: '更新排期',
|
|
25
|
-
path: '/api/account/film/paiqi-date',
|
|
26
|
-
isRule: false,
|
|
27
|
-
params: {
|
|
28
|
-
film_id: ['电影id', 'Number', '必选'],
|
|
29
|
-
cinema_id: ['影院id', 'Number', '必选'],
|
|
30
|
-
},
|
|
13
|
+
params: {},
|
|
31
14
|
isConsole: true,
|
|
32
15
|
disabled: true,
|
|
33
16
|
},
|
|
34
17
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
path: '/api/account/film/paiqi-date',
|
|
18
|
+
mapFnName: 'openNewNotify',
|
|
19
|
+
title: '是否开启新订单通知音频',
|
|
20
|
+
path: '/takeorder/v1/user-config/is-open-new-order-notify-audio',
|
|
39
21
|
isRule: false,
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
data: {
|
|
23
|
+
is_open: ['是否开启', 'String', '必填'],
|
|
42
24
|
},
|
|
43
25
|
isConsole: true,
|
|
44
26
|
disabled: true,
|
|
45
27
|
},
|
|
46
28
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
path: '/api/account/film/paiqi-date',
|
|
29
|
+
mapFnName: 'openWinNotify',
|
|
30
|
+
title: '是否开启中标通知音频',
|
|
31
|
+
path: '/takeorder/v1/user-config/is-open-win-order-audio',
|
|
51
32
|
isRule: false,
|
|
52
|
-
|
|
53
|
-
|
|
33
|
+
data: {
|
|
34
|
+
is_open: ['是否开启', 'String', '必填'],
|
|
54
35
|
},
|
|
55
36
|
isConsole: true,
|
|
56
37
|
disabled: true,
|
|
@@ -2,141 +2,190 @@
|
|
|
2
2
|
<view
|
|
3
3
|
class="jfb-takeorder-voice-switch"
|
|
4
4
|
@click="handleEditxSelect"
|
|
5
|
-
:class="{ editx
|
|
5
|
+
:class="{ editx: isEditx && active }"
|
|
6
6
|
>
|
|
7
7
|
<!--#ifdef H5-->
|
|
8
8
|
<view
|
|
9
9
|
class="jfb-takeorder-voice-switch__edit"
|
|
10
|
-
:class="{ editx
|
|
10
|
+
:class="{ editx: isEditx && active }"
|
|
11
11
|
v-if="isEditx && active"
|
|
12
12
|
>
|
|
13
13
|
<view class="jfb-takeorder-voice-switch__edit-icon" @click.stop="delEdit">
|
|
14
|
-
<xd-font-icon
|
|
14
|
+
<xd-font-icon
|
|
15
|
+
icon="iconshanchu-01"
|
|
16
|
+
color="#fff"
|
|
17
|
+
size="30"
|
|
18
|
+
></xd-font-icon>
|
|
15
19
|
</view>
|
|
16
20
|
</view>
|
|
17
21
|
<!-- #endif -->
|
|
18
22
|
<view class="jfb-takeorder-voice-switch__body">
|
|
19
23
|
<view class="jfb-takeorder-voice-switch__body-item">
|
|
20
24
|
<view>新订单提示音</view>
|
|
21
|
-
<switch
|
|
25
|
+
<switch
|
|
26
|
+
@change="switchNewChange"
|
|
27
|
+
:checked="newOrder"
|
|
28
|
+
:color="mainColor"
|
|
29
|
+
style="transform: scale(0.5)"
|
|
30
|
+
/>
|
|
22
31
|
</view>
|
|
23
32
|
<view class="jfb-takeorder-voice-switch__body-item">
|
|
24
33
|
<view>中标提示音</view>
|
|
25
|
-
<switch
|
|
34
|
+
<switch
|
|
35
|
+
@change="switchBingoChange"
|
|
36
|
+
:checked="bingo"
|
|
37
|
+
:color="mainColor"
|
|
38
|
+
style="transform: scale(0.5)"
|
|
39
|
+
/>
|
|
26
40
|
</view>
|
|
27
|
-
<view class="jfb-takeorder-voice-switch__body-notice"
|
|
41
|
+
<view class="jfb-takeorder-voice-switch__body-notice"
|
|
42
|
+
>没有声音?尝试<text :style="{ color: mainColor }">点击触发</text></view
|
|
43
|
+
>
|
|
28
44
|
</view>
|
|
29
45
|
</view>
|
|
30
46
|
</template>
|
|
31
47
|
|
|
32
48
|
<script>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
50
|
+
import { jfbRootExec } from "@/utils/xd.event";
|
|
51
|
+
import JfbTakeorderVoiceSwitchMixin from "./JfbTakeorderVoiceSwitchMixin";
|
|
52
|
+
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
53
|
+
import componentsMixins from "@/mixins/componentsMixins";
|
|
54
|
+
import extsMixins from "@/mixins/extsMixins";
|
|
55
|
+
export default {
|
|
56
|
+
name: "JfbTakeorderVoiceSwitch",
|
|
57
|
+
components: {
|
|
58
|
+
XdFontIcon,
|
|
59
|
+
},
|
|
60
|
+
mixins: [componentsMixins, extsMixins, JfbTakeorderVoiceSwitchMixin],
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
bingo: false,
|
|
64
|
+
newOrder: false,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
watch: {
|
|
68
|
+
container(value, oldValue) {
|
|
69
|
+
if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
|
|
70
|
+
if (this.$configProject["isPreview"]) this.init(value);
|
|
43
71
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
72
|
+
},
|
|
73
|
+
created() {
|
|
74
|
+
this.init(this.container);
|
|
75
|
+
|
|
76
|
+
//todo
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
onJfbLoad(options) {
|
|
80
|
+
// 获取用户配置
|
|
81
|
+
this.getUserConfig();
|
|
52
82
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
83
|
+
/**
|
|
84
|
+
* 获取用户配置
|
|
85
|
+
*/
|
|
86
|
+
getUserConfig() {
|
|
87
|
+
jfbRootExec("getUserConfig", {
|
|
88
|
+
vm: this,
|
|
89
|
+
data: {},
|
|
90
|
+
})
|
|
91
|
+
.then((res) => {
|
|
92
|
+
// 回显配置
|
|
93
|
+
this.newOrder = res.is_open_new_order_notify_audio === "Y";
|
|
94
|
+
this.bingo = res.is_open_win_order_audio === "Y";
|
|
95
|
+
})
|
|
96
|
+
.catch((error) => {
|
|
97
|
+
this.$xdLog.catch(error);
|
|
98
|
+
});
|
|
58
99
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
100
|
+
/**
|
|
101
|
+
* @description 监听事件变化
|
|
102
|
+
* @param container {object} 业务组件对象自己
|
|
103
|
+
*/
|
|
104
|
+
init(container) {},
|
|
105
|
+
switchNewChange(e) {
|
|
106
|
+
const isOpen = e.detail.value;
|
|
107
|
+
this.newOrder = isOpen;
|
|
108
|
+
// 调用接口更新新订单提示音配置
|
|
109
|
+
jfbRootExec("openNewNotify", {
|
|
110
|
+
vm: this,
|
|
111
|
+
data: {
|
|
112
|
+
is_open: isOpen ? "Y" : "N",
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
.then((res) => {
|
|
116
|
+
// 接口调用成功
|
|
117
|
+
})
|
|
118
|
+
.catch((error) => {
|
|
119
|
+
// 接口调用失败,回滚状态
|
|
120
|
+
this.newOrder = !isOpen;
|
|
121
|
+
this.$xdLog.catch(error);
|
|
122
|
+
});
|
|
63
123
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
console.log('event.onJfbBack', options)
|
|
107
|
-
},
|
|
108
|
-
onJfbUpdate(...data) {
|
|
109
|
-
console.log('event.onJfbUpdate', data)
|
|
110
|
-
},
|
|
111
|
-
onJfbCustomEvent(options) {
|
|
112
|
-
console.log('event.onJfbReachBottom', options)
|
|
113
|
-
},
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
124
|
+
switchBingoChange(e) {
|
|
125
|
+
const isOpen = e.detail.value;
|
|
126
|
+
this.bingo = isOpen;
|
|
127
|
+
// 调用接口更新中标提示音配置
|
|
128
|
+
jfbRootExec("openWinNotify", {
|
|
129
|
+
vm: this,
|
|
130
|
+
data: {
|
|
131
|
+
is_open: isOpen ? "Y" : "N",
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
.then((res) => {
|
|
135
|
+
// 接口调用成功
|
|
136
|
+
})
|
|
137
|
+
.catch((error) => {
|
|
138
|
+
// 接口调用失败,回滚状态
|
|
139
|
+
this.bingo = !isOpen;
|
|
140
|
+
this.$xdLog.catch(error);
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
onJfbScroll(options) {
|
|
144
|
+
console.log("event.onJfbScroll", options);
|
|
145
|
+
},
|
|
146
|
+
onJfbReachBottom(options) {
|
|
147
|
+
console.log("event.onJfbReachBottom", options);
|
|
148
|
+
},
|
|
149
|
+
onJfbShow(options) {
|
|
150
|
+
console.log("event.onJfbShow", options);
|
|
151
|
+
},
|
|
152
|
+
onJfbHide(options) {
|
|
153
|
+
console.log("event.onJfbHide", options);
|
|
154
|
+
},
|
|
155
|
+
onJfbBack(options) {
|
|
156
|
+
console.log("event.onJfbBack", options);
|
|
157
|
+
},
|
|
158
|
+
onJfbUpdate(...data) {
|
|
159
|
+
console.log("event.onJfbUpdate", data);
|
|
160
|
+
},
|
|
161
|
+
onJfbCustomEvent(options) {
|
|
162
|
+
console.log("event.onJfbReachBottom", options);
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
117
166
|
</script>
|
|
118
167
|
|
|
119
168
|
<style scoped lang="less">
|
|
120
|
-
|
|
169
|
+
@import "./JfbTakeorderVoiceSwitchLess.less";
|
|
121
170
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
171
|
+
.jfb-takeorder-voice-switch {
|
|
172
|
+
&__body {
|
|
173
|
+
&-item {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: space-between;
|
|
177
|
+
padding: 26rpx 32rpx;
|
|
178
|
+
background: #fff;
|
|
179
|
+
margin: 16rpx;
|
|
180
|
+
border-radius: 20rpx;
|
|
181
|
+
color: #666666;
|
|
182
|
+
font-size: 28rpx;
|
|
183
|
+
}
|
|
184
|
+
&-notice {
|
|
185
|
+
font-size: 24rpx;
|
|
186
|
+
margin-left: 32rpx;
|
|
187
|
+
color: #666;
|
|
140
188
|
}
|
|
141
189
|
}
|
|
190
|
+
}
|
|
142
191
|
</style>
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = {
|
|
4
|
-
|
|
5
|
-
getVoiceByIdFilmSquate:{},
|
|
6
|
-
|
|
7
|
-
updateVoiceFilmPaiqiDate:{},
|
|
8
|
-
|
|
9
|
-
removeVoiceFilmAddress:{},
|
|
10
|
-
|
|
11
|
-
addVoiceFilmcart:{},
|
|
12
|
-
|
|
3
|
+
module.exports = {
|
|
4
|
+
getUserConfig: { "is_open_new_order_notify_audio": "N", "is_open_win_order_audio": "N", "request_id": "b5d506434c8ef2d0" },
|
|
13
5
|
}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="order-wrap">
|
|
3
|
-
<view v-if="isNeedCutDown" :style="{ background: mainColor }" class="order-time">
|
|
4
|
-
<XdFontIcon
|
|
5
|
-
style="margin: 0 24rpx 0 36rpx"
|
|
6
|
-
icon="iconshijian-01"
|
|
7
|
-
size="30"
|
|
8
|
-
></XdFontIcon>
|
|
9
|
-
剩余报价时间:<text v-if="item.remainingTime > 0">{{
|
|
10
|
-
formatCountdown(item.remainingTime)
|
|
11
|
-
}}</text
|
|
12
|
-
>,参与报价<text style="color: #ffeb3b">{{ item.people }}</text
|
|
13
|
-
>人</view
|
|
14
|
-
>
|
|
15
|
-
<view class="order-title">
|
|
16
|
-
<view class="order-title-left">
|
|
17
|
-
<view>{{ item.shop_name }}</view>
|
|
18
|
-
<text>|</text>
|
|
19
|
-
<view>{{ item.brand_name }}</view>
|
|
20
|
-
</view>
|
|
21
|
-
<view class="order-title-right">{{ item.city }}</view>
|
|
22
|
-
</view>
|
|
23
|
-
<view
|
|
24
|
-
v-for="(Pitem, Pindex) in item.products"
|
|
25
|
-
:key="Pindex"
|
|
26
|
-
class="order-product"
|
|
27
|
-
>
|
|
28
|
-
<image :src="Pitem.product_thumb"></image>
|
|
29
|
-
<view class="order-product-info">
|
|
30
|
-
<view class="order-product-info-name">{{ Pitem.product_name }}</view>
|
|
31
|
-
<view class="order-product-info-sku"
|
|
32
|
-
>规格:{{ Pitem.product_sku }}</view
|
|
33
|
-
>
|
|
34
|
-
<view class="order-product-info-price">
|
|
35
|
-
<view class="order-product-info-price-left"
|
|
36
|
-
><text>¥ </text>{{ Pitem.minPrice }}<text class="range">~</text
|
|
37
|
-
><text>¥ </text>{{ Pitem.maxPrice }}</view
|
|
38
|
-
>
|
|
39
|
-
<view class="order-product-info-price-right"
|
|
40
|
-
><XdFontIcon
|
|
41
|
-
icon="icondanchuangguanbi_xian"
|
|
42
|
-
color="#999"
|
|
43
|
-
size="14"
|
|
44
|
-
></XdFontIcon
|
|
45
|
-
><view>{{ Pitem.num }}</view></view
|
|
46
|
-
>
|
|
47
|
-
</view>
|
|
48
|
-
</view>
|
|
49
|
-
</view>
|
|
50
|
-
<view class="order-price">
|
|
51
|
-
<view class="order-price-left">
|
|
52
|
-
<view class="order-price-left-market"
|
|
53
|
-
>市场原价:¥{{ item.market_price }}(仅供参考)</view
|
|
54
|
-
>
|
|
55
|
-
<view class="order-price-left-settle"
|
|
56
|
-
>结算价格:<view
|
|
57
|
-
><text>¥ </text>{{ item.minPrice }}<text class="range">~</text
|
|
58
|
-
><text>¥ </text>{{ item.maxPrice }}</view
|
|
59
|
-
></view
|
|
60
|
-
>
|
|
61
|
-
</view>
|
|
62
|
-
<view>
|
|
63
|
-
<XdButton @click="handleClick" type="primary" size="small"
|
|
64
|
-
>报价</XdButton
|
|
65
|
-
>
|
|
66
|
-
</view>
|
|
67
|
-
</view>
|
|
68
|
-
</view>
|
|
69
|
-
</template>
|
|
70
|
-
|
|
71
|
-
<script>
|
|
72
|
-
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
73
|
-
import XdButton from "@/components/XdButton/XdButton";
|
|
74
|
-
|
|
75
|
-
export default {
|
|
76
|
-
name: "order",
|
|
77
|
-
components: {
|
|
78
|
-
XdFontIcon,
|
|
79
|
-
XdButton,
|
|
80
|
-
},
|
|
81
|
-
data() {
|
|
82
|
-
return {
|
|
83
|
-
isUpdating: false,
|
|
84
|
-
countdownTimer: null,
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
props: {
|
|
88
|
-
mainColor: {
|
|
89
|
-
type: String,
|
|
90
|
-
default: "",
|
|
91
|
-
},
|
|
92
|
-
item: {
|
|
93
|
-
type: Object,
|
|
94
|
-
default: () => {},
|
|
95
|
-
},
|
|
96
|
-
isNeedCutDown: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
default: true,
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
computed: {},
|
|
102
|
-
watch: {
|
|
103
|
-
// 当父组件更新了 order.status 时,停止倒计时
|
|
104
|
-
'item.status'(newVal) {
|
|
105
|
-
if (newVal !== 'pending') {
|
|
106
|
-
this.clearCountdownTimer();
|
|
107
|
-
this.isUpdating = false; // 重置更新状态
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
// 当父组件更新了 order.remainingTime 时(例如页面重新显示时的校准),重启倒计时
|
|
111
|
-
'item.remainingTime'(newVal) {
|
|
112
|
-
if (this.item.status === 'pending' && newVal > 0) {
|
|
113
|
-
this.startCountdown();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
created() {
|
|
118
|
-
// 组件创建时,如果是待支付状态,就启动倒计时
|
|
119
|
-
if (this.item.remainingTime > 0&&this.isNeedCutDown) {
|
|
120
|
-
this.startCountdown();
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
destroyed() {
|
|
124
|
-
// 组件销毁时,清理定时器
|
|
125
|
-
this.clearCountdownTimer();
|
|
126
|
-
},
|
|
127
|
-
methods: {
|
|
128
|
-
formatCountdown(seconds) {
|
|
129
|
-
const mins = Math.floor(seconds / 60);
|
|
130
|
-
const secs = seconds % 60;
|
|
131
|
-
return `${mins.toString().padStart(2, "0")}:${secs
|
|
132
|
-
.toString()
|
|
133
|
-
.padStart(2, "0")}`;
|
|
134
|
-
},
|
|
135
|
-
// 数字补零(小于10补前导零)
|
|
136
|
-
padZero(num) {
|
|
137
|
-
return num < 10 ? `0${num}` : num;
|
|
138
|
-
},
|
|
139
|
-
startCountdown() {
|
|
140
|
-
this.clearCountdownTimer();
|
|
141
|
-
this.countdownTimer = setInterval(() => {
|
|
142
|
-
// 这里我们不直接修改 props,而是在倒计时结束时通知父组件
|
|
143
|
-
if (this.item.remainingTime <= 1) {
|
|
144
|
-
// 当倒计时即将结束时
|
|
145
|
-
this.clearCountdownTimer();
|
|
146
|
-
this.isUpdating = true; // 显示“更新中”状态
|
|
147
|
-
this.$emit("expire", this.item.id); // 通知父组件:我过期了!
|
|
148
|
-
} else {
|
|
149
|
-
// 为了UI流畅,可以在这里更新本地倒计时显示,但最终数据以父组件为准
|
|
150
|
-
// 注意:这是一个小技巧,避免每秒都向父组件发送事件
|
|
151
|
-
this.$set(this.item, "remainingTime", this.item.remainingTime - 1);
|
|
152
|
-
}
|
|
153
|
-
}, 1000);
|
|
154
|
-
},
|
|
155
|
-
clearCountdownTimer() {
|
|
156
|
-
if (this.countdownTimer) {
|
|
157
|
-
clearInterval(this.countdownTimer);
|
|
158
|
-
this.countdownTimer = null;
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
handleClick() {
|
|
162
|
-
this.$emit("btnEvent", this.item);
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
</script>
|
|
167
|
-
|
|
168
|
-
<style lang="less" scoped>
|
|
169
|
-
.order {
|
|
170
|
-
&-wrap {
|
|
171
|
-
background: #fff;
|
|
172
|
-
color: #333;
|
|
173
|
-
margin: 16rpx;
|
|
174
|
-
border-radius: 20rpx;
|
|
175
|
-
}
|
|
176
|
-
&-time {
|
|
177
|
-
color: #fff;
|
|
178
|
-
font-size: 24rpx;
|
|
179
|
-
padding: 20rpx 0;
|
|
180
|
-
border-radius: 20rpx 20rpx 0 0;
|
|
181
|
-
display: flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
}
|
|
184
|
-
&-title {
|
|
185
|
-
display: flex;
|
|
186
|
-
justify-content: space-between;
|
|
187
|
-
padding: 24rpx 32rpx;
|
|
188
|
-
border-bottom: 1px solid #f4f4f4;
|
|
189
|
-
&-left {
|
|
190
|
-
display: flex;
|
|
191
|
-
align-items: center;
|
|
192
|
-
}
|
|
193
|
-
&-right {
|
|
194
|
-
font-weight: 500;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
&-product {
|
|
198
|
-
display: flex;
|
|
199
|
-
padding: 16rpx 32rpx;
|
|
200
|
-
border-bottom: 1px solid #f4f4f4;
|
|
201
|
-
& > image {
|
|
202
|
-
width: 180rpx;
|
|
203
|
-
height: 180rpx;
|
|
204
|
-
flex-shrink: 0;
|
|
205
|
-
border: 10rpx;
|
|
206
|
-
}
|
|
207
|
-
&-info {
|
|
208
|
-
margin-left: 24rpx;
|
|
209
|
-
&-name {
|
|
210
|
-
.uni-max-cut(2,80);
|
|
211
|
-
margin-bottom: 10rpx;
|
|
212
|
-
}
|
|
213
|
-
&-sku {
|
|
214
|
-
font-size: 24rpx;
|
|
215
|
-
color: #999;
|
|
216
|
-
}
|
|
217
|
-
&-price {
|
|
218
|
-
margin-top: 10rpx;
|
|
219
|
-
display: flex;
|
|
220
|
-
justify-content: space-between;
|
|
221
|
-
align-items: center;
|
|
222
|
-
&-left {
|
|
223
|
-
color: #ff2c18;
|
|
224
|
-
font-size: 32rpx;
|
|
225
|
-
font-weight: 500;
|
|
226
|
-
& > text {
|
|
227
|
-
font-size: 24rpx;
|
|
228
|
-
margin-right: 10rpx;
|
|
229
|
-
}
|
|
230
|
-
.range {
|
|
231
|
-
margin: 0 10rpx;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
&-right {
|
|
235
|
-
color: #999;
|
|
236
|
-
display: flex;
|
|
237
|
-
align-items: baseline;
|
|
238
|
-
& > view {
|
|
239
|
-
margin-left: 10rpx;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
&-price {
|
|
246
|
-
display: flex;
|
|
247
|
-
justify-content: space-between;
|
|
248
|
-
align-items: center;
|
|
249
|
-
padding: 24rpx 32rpx;
|
|
250
|
-
border-radius: 0 0 20rpx 20rpx;
|
|
251
|
-
&-left {
|
|
252
|
-
&-market {
|
|
253
|
-
font-size: 24rpx;
|
|
254
|
-
color: #999;
|
|
255
|
-
margin-bottom: 10rpx;
|
|
256
|
-
}
|
|
257
|
-
&-settle {
|
|
258
|
-
font-size: 24rpx;
|
|
259
|
-
display: flex;
|
|
260
|
-
align-items: center;
|
|
261
|
-
& > view {
|
|
262
|
-
color: #ff2c18;
|
|
263
|
-
font-size: 32rpx;
|
|
264
|
-
font-weight: 500;
|
|
265
|
-
& > text {
|
|
266
|
-
font-size: 24rpx;
|
|
267
|
-
margin-right: 10rpx;
|
|
268
|
-
}
|
|
269
|
-
.range {
|
|
270
|
-
margin: 0 10rpx;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
</style>
|