jufubao-takeorder 1.0.2-beta1 → 1.0.2-beta10

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.
Files changed (60) hide show
  1. package/package.json +1 -1
  2. package/src/components/JfbTakeorderFilterOrderList/Api.js +43 -0
  3. package/src/components/JfbTakeorderFilterOrderList/Attr.js +16 -0
  4. package/src/components/JfbTakeorderFilterOrderList/JfbTakeorderFilterOrderList.vue +353 -0
  5. package/src/components/{JfbTakeorderUnquotedDetail/JfbTakeorderUnquotedDetailLess.less → JfbTakeorderFilterOrderList/JfbTakeorderFilterOrderListLess.less} +2 -2
  6. package/src/components/{JfbTakeorderUnquotedDetail/JfbTakeorderUnquotedDetailMixin.js → JfbTakeorderFilterOrderList/JfbTakeorderFilterOrderListMixin.js} +1 -1
  7. package/src/components/JfbTakeorderFilterOrderList/Mock.js +13 -0
  8. package/src/components/JfbTakeorderFilterOrderList/cusAttr/advanced.js +26 -0
  9. package/src/components/JfbTakeorderFilterOrderList/cusAttr/content.js +9 -0
  10. package/src/components/JfbTakeorderFilterOrderList/cusAttr/style.js +11 -0
  11. package/src/components/JfbTakeorderIndex/Api.js +38 -24
  12. package/src/components/JfbTakeorderIndex/Attr.js +9 -41
  13. package/src/components/JfbTakeorderIndex/JfbTakeorderIndex.vue +823 -85
  14. package/src/components/JfbTakeorderIndex/Mock.js +4 -4
  15. package/src/components/JfbTakeorderIndex/components/cityPicker.vue +307 -0
  16. package/src/components/JfbTakeorderIndex/cusAttr/advanced.js +26 -0
  17. package/src/components/JfbTakeorderIndex/cusAttr/content.js +9 -0
  18. package/src/components/JfbTakeorderIndex/cusAttr/style.js +11 -0
  19. package/src/components/JfbTakeorderOrderDetail/Api.js +125 -0
  20. package/src/components/JfbTakeorderOrderDetail/Attr.js +16 -0
  21. package/src/components/JfbTakeorderOrderDetail/JfbTakeorderOrderDetail.vue +1211 -0
  22. package/src/components/{JfbTakeorderUnquotedList/JfbTakeorderUnquotedListLess.less → JfbTakeorderOrderDetail/JfbTakeorderOrderDetailLess.less} +2 -2
  23. package/src/components/{JfbTakeorderQuotedDetail/JfbTakeorderQuotedDetailMixin.js → JfbTakeorderOrderDetail/JfbTakeorderOrderDetailMixin.js} +1 -1
  24. package/src/components/JfbTakeorderOrderDetail/Mock.js +13 -0
  25. package/src/components/JfbTakeorderOrderDetail/components/CusEditQuote.vue +150 -0
  26. package/src/components/JfbTakeorderOrderDetail/components/products.vue +141 -0
  27. package/src/components/JfbTakeorderOrderDetail/cusAttr/advanced.js +12 -0
  28. package/src/components/JfbTakeorderOrderDetail/cusAttr/content.js +233 -0
  29. package/src/components/JfbTakeorderOrderDetail/cusAttr/style.js +11 -0
  30. package/src/components/JfbTakeorderOrderList/Api.js +43 -0
  31. package/src/components/JfbTakeorderOrderList/Attr.js +16 -0
  32. package/src/components/JfbTakeorderOrderList/JfbTakeorderOrderList.vue +320 -0
  33. package/src/components/{JfbTakeorderQuotedList/JfbTakeorderQuotedListLess.less → JfbTakeorderOrderList/JfbTakeorderOrderListLess.less} +2 -2
  34. package/src/components/{JfbTakeorderQuotedList/JfbTakeorderQuotedListMixin.js → JfbTakeorderOrderList/JfbTakeorderOrderListMixin.js} +1 -1
  35. package/src/components/JfbTakeorderOrderList/Mock.js +13 -0
  36. package/src/components/JfbTakeorderOrderList/cusAttr/advanced.js +26 -0
  37. package/src/components/JfbTakeorderOrderList/cusAttr/content.js +23 -0
  38. package/src/components/JfbTakeorderOrderList/cusAttr/style.js +11 -0
  39. package/src/components/JfbTakeorderVoiceSwitch/Api.js +39 -0
  40. package/src/components/JfbTakeorderVoiceSwitch/Attr.js +12 -0
  41. package/src/components/JfbTakeorderVoiceSwitch/JfbTakeorderVoiceSwitch.vue +191 -0
  42. package/src/components/{JfbTakeorderQuotedDetail/JfbTakeorderQuotedDetailLess.less → JfbTakeorderVoiceSwitch/JfbTakeorderVoiceSwitchLess.less} +2 -2
  43. package/src/components/{JfbTakeorderUnquotedList/JfbTakeorderUnquotedListMixin.js → JfbTakeorderVoiceSwitch/JfbTakeorderVoiceSwitchMixin.js} +1 -1
  44. package/src/components/JfbTakeorderVoiceSwitch/Mock.js +5 -0
  45. package/src/components/JfbTakeorderQuotedDetail/Api.js +0 -58
  46. package/src/components/JfbTakeorderQuotedDetail/Attr.js +0 -48
  47. package/src/components/JfbTakeorderQuotedDetail/JfbTakeorderQuotedDetail.vue +0 -113
  48. package/src/components/JfbTakeorderQuotedDetail/Mock.js +0 -13
  49. package/src/components/JfbTakeorderQuotedList/Api.js +0 -58
  50. package/src/components/JfbTakeorderQuotedList/Attr.js +0 -48
  51. package/src/components/JfbTakeorderQuotedList/JfbTakeorderQuotedList.vue +0 -113
  52. package/src/components/JfbTakeorderQuotedList/Mock.js +0 -13
  53. package/src/components/JfbTakeorderUnquotedDetail/Api.js +0 -58
  54. package/src/components/JfbTakeorderUnquotedDetail/Attr.js +0 -48
  55. package/src/components/JfbTakeorderUnquotedDetail/JfbTakeorderUnquotedDetail.vue +0 -113
  56. package/src/components/JfbTakeorderUnquotedDetail/Mock.js +0 -13
  57. package/src/components/JfbTakeorderUnquotedList/Api.js +0 -58
  58. package/src/components/JfbTakeorderUnquotedList/Attr.js +0 -48
  59. package/src/components/JfbTakeorderUnquotedList/JfbTakeorderUnquotedList.vue +0 -113
  60. package/src/components/JfbTakeorderUnquotedList/Mock.js +0 -13
@@ -0,0 +1,320 @@
1
+ <template>
2
+ <view
3
+ class="jfb-takeorder-order-list"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx: isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-takeorder-order-list__edit"
10
+ :class="{ editx: isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-takeorder-order-list__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon
15
+ icon="iconshanchu-01"
16
+ color="#fff"
17
+ size="30"
18
+ ></xd-font-icon>
19
+ </view>
20
+ </view>
21
+ <!-- #endif -->
22
+ <view class="jfb-takeorder-order-list__body">
23
+ <!-- <view
24
+ v-if="showNew"
25
+ @click="handleRefresh"
26
+ :style="{ color: warningColor, background: newBackgroundColor }"
27
+ class="jfb-takeorder-quoted-list__body-new"
28
+ ><XdFontIcon size="24" icon="iconIM"></XdFontIcon>
29
+ <view>新的订单来了,点我立即刷新</view></view
30
+ > -->
31
+ <view v-for="(item, index) in orderList" :key="index">
32
+ <CusTakeorder
33
+ :item="item"
34
+ :mainColor="mainColor"
35
+ @expire="handleOrderExpire"
36
+ @btnEvent="handleBtnEvent"
37
+ ></CusTakeorder>
38
+ </view>
39
+ <xd-no-data
40
+ icon-type="order"
41
+ :scale-size="2"
42
+ v-if="orderList && orderList.length === 0"
43
+ >暂无订单</xd-no-data
44
+ >
45
+ </view>
46
+ </view>
47
+ </template>
48
+
49
+ <script>
50
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
51
+ import { jfbRootExec } from "@/utils/xd.event";
52
+ import JfbTakeorderOrderListMixin from "./JfbTakeorderOrderListMixin";
53
+ import { getContainerPropsValue } from "@/utils/xd.base";
54
+ import componentsMixins from "@/mixins/componentsMixins";
55
+ import extsMixins from "@/mixins/extsMixins";
56
+ import CusTakeorder from "@/components/CusTakeorder/CusTakeorder";
57
+ import getServiceUrl from "@/common/getServiceUrl";
58
+ import XdNoData from "@/components/XdNoData/XdNoData";
59
+ import { mapActions } from "vuex";
60
+ const Color = require("color");
61
+ export default {
62
+ name: "JfbTakeorderOrderList",
63
+ components: {
64
+ XdFontIcon,
65
+ CusTakeorder,
66
+ XdNoData,
67
+ },
68
+ mixins: [componentsMixins, extsMixins, JfbTakeorderOrderListMixin],
69
+ data() {
70
+ return {
71
+ newBackgroundColor: "",
72
+ showNew: false,
73
+ pollTimer: null, // 轮询定时器
74
+ orderList: [],
75
+ order_type: "hourdash",
76
+ orderTab: "index",
77
+ page_size: 10,
78
+ page_token: 1,
79
+ hasNext: true,
80
+ next_page_token: "",
81
+ order_detail_path: "",
82
+ isPreview: false,
83
+ isOpenNew: "N",
84
+ isOpenWin: "N",
85
+ max_id: 0,
86
+ };
87
+ },
88
+ watch: {
89
+ container(value, oldValue) {
90
+ if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
91
+ if (this.$configProject["isPreview"]) this.init(value);
92
+ },
93
+ },
94
+ created() {
95
+ this.init(this.container);
96
+ },
97
+ destroyed() {
98
+ this.stopPolling();
99
+ },
100
+ methods: {
101
+ ...mapActions(["voiceAlert", "playWebSpeech", "playAudioFile"]),
102
+ onJfbLoad(options) {
103
+ // 获取订单列表
104
+ this.getList();
105
+ if (!this.isPreview) {
106
+ jfbRootExec("getUserConfig", {
107
+ vm: this,
108
+ data: {},
109
+ }).then((configRes) => {
110
+ this.isOpenNew = configRes.is_open_new_order_notify_audio;
111
+ this.isOpenWin = configRes.is_open_win_order_audio;
112
+ // 立即调用一次
113
+ this.handleGetNew();
114
+ // 启动定时器,每5秒调用一次
115
+ this.startPolling();
116
+ });
117
+ }
118
+ },
119
+ /**
120
+ * @description 监听事件变化
121
+ * @param container {object} 业务组件对象自己
122
+ */
123
+ init(container) {
124
+ this.newBackgroundColor = Color(this.warningColor).alpha(0.15).toString();
125
+ this.orderTab = getContainerPropsValue(
126
+ container,
127
+ "content.orderTab",
128
+ "index"
129
+ );
130
+ this.order_detail_path = getContainerPropsValue(
131
+ container,
132
+ "content.order_detail_path",
133
+ { value: "" }
134
+ ).value;
135
+ if (this.$configProject["isPreview"]) {
136
+ this.isPreview = true;
137
+ }
138
+ },
139
+ /**
140
+ * 获取订单列表
141
+ */
142
+ getList() {
143
+ // 构建请求参数
144
+ const params = {
145
+ tab: this.orderTab,
146
+ order_type: this.order_type,
147
+ page_token: this.page_token,
148
+ page_size: this.page_size,
149
+ };
150
+
151
+ return jfbRootExec("getOrderList", {
152
+ vm: this,
153
+ data: params,
154
+ })
155
+ .then((res) => {
156
+ // 设置订单列表数据
157
+ let list = res.list.map((item) => {
158
+ item.product_list = item.product_list.map((prod, i) => {
159
+ prod["product_thumb"] = prod.product_thumb
160
+ ? getServiceUrl(prod.product_thumb, "size3")
161
+ : "";
162
+ return prod;
163
+ });
164
+ return item;
165
+ });
166
+ if (this.page_token === 1) {
167
+ this.orderList = list;
168
+ } else {
169
+ this.orderList = this.orderList.concat(list);
170
+ }
171
+ this.hasNext = res.next_page_token !== "";
172
+ this.next_page_token = res.next_page_token;
173
+ })
174
+ .catch((err) => {
175
+ console.error("获取订单列表失败:", err);
176
+ });
177
+ },
178
+ handleBtnEvent({ item, btn }) {
179
+ // 跳转到订单详情页
180
+ this.$xdUniHelper.navigateTo({
181
+ url: `${this.order_detail_path}?order_id=${item.order_id}`,
182
+ });
183
+ },
184
+ /**
185
+ * 处理子组件派发的 'expire' 事件
186
+ * 订单倒计时结束后,从列表中删除该订单
187
+ */
188
+ handleOrderExpire(order) {
189
+ if (this.isPreview) return;
190
+ const orderIndex = this.orderList.findIndex(
191
+ (item) => item.order_id === order.order_id
192
+ );
193
+ if (orderIndex === -1) return;
194
+ //如果用户状态为已报价,倒计时结束后则刷新列表,并return
195
+ if (order.user_quotation_status === "quoted") {
196
+ this.handleRefresh();
197
+ return;
198
+ }
199
+ // 从列表中删除该订单
200
+ this.orderList.splice(orderIndex, 1);
201
+ },
202
+ /**
203
+ * 刷新列表
204
+ */
205
+ handleRefresh() {
206
+ // 重置分页
207
+ this.page_token = 1;
208
+ this.hasNext = true;
209
+ this.next_page_token = "";
210
+ // 重新获取列表
211
+ this.getList();
212
+ this.showNew = false;
213
+ },
214
+ /**
215
+ * 获取新订单通知
216
+ */
217
+ handleGetNew() {
218
+ jfbRootExec("getNewOrderNotify", {
219
+ vm: this,
220
+ data: {
221
+ order_type: this.order_type,
222
+ max_id: this.max_id,
223
+ },
224
+ }).then((res) => {
225
+ if (res.is_exist_new_order && res.is_exist_win_order) {
226
+ if (this.isOpenNew === "Y") {
227
+ this.voiceAlert({
228
+ type: "new",
229
+ filePath: "https://img.jufubao.cn/takeorder/new_order.mp3",
230
+ });
231
+ }
232
+ if (this.isOpenWin === "Y") {
233
+ setTimeout(() => {
234
+ this.voiceAlert({
235
+ type: "win",
236
+ filePath: "https://img.jufubao.cn/takeorder/wait_order.mp3",
237
+ });
238
+ }, 1000);
239
+ }
240
+ } else if (res.is_exist_new_order) {
241
+ if (this.isOpenNew === "Y") {
242
+ this.voiceAlert({
243
+ type: "new",
244
+ filePath: "https://img.jufubao.cn/takeorder/new_order.mp3",
245
+ });
246
+ }
247
+ } else if (res.is_exist_win_order) {
248
+ if (this.isOpenWin === "Y") {
249
+ this.voiceAlert({
250
+ type: "win",
251
+ filePath: "https://img.jufubao.cn/takeorder/wait_order.mp3",
252
+ });
253
+ }
254
+ }
255
+ if (res.new_order_max_id > this.max_id) {
256
+ this.max_id = res.new_order_max_id;
257
+ }
258
+ this.showNew = res.is_exist_new_order;
259
+ });
260
+ },
261
+ /**
262
+ * 启动轮询定时器
263
+ */
264
+ startPolling() {
265
+ // 如果已经存在定时器,先清除
266
+ if (this.pollTimer) {
267
+ clearInterval(this.pollTimer);
268
+ }
269
+ // 每5秒调用一次接口
270
+ this.pollTimer = setInterval(() => {
271
+ this.handleGetNew();
272
+ }, 5000);
273
+ },
274
+ /**
275
+ * 停止轮询定时器
276
+ */
277
+ stopPolling() {
278
+ if (this.pollTimer) {
279
+ clearInterval(this.pollTimer);
280
+ this.pollTimer = null;
281
+ }
282
+ },
283
+ onJfbScroll(options) {},
284
+ onJfbReachBottom(options) {
285
+ if (this.hasNext) {
286
+ this.page_token = this.next_page_token;
287
+ this.getList();
288
+ }
289
+ },
290
+ onJfbShow(options) {
291
+ this.onJfbLoad(options);
292
+ },
293
+ onJfbHide(options) {
294
+ // 页面隐藏时暂停轮询
295
+ this.stopPolling();
296
+ console.log("event.onJfbHide", options);
297
+ },
298
+ onJfbBack(options) {
299
+ console.log("event.onJfbBack", options);
300
+ },
301
+ onJfbUpdate(...data) {
302
+ console.log("event.onJfbUpdate", data);
303
+ },
304
+ onJfbCustomEvent(options) {
305
+ console.log("event.onJfbReachBottom", options);
306
+ },
307
+ },
308
+ };
309
+ </script>
310
+
311
+ <style scoped lang="less">
312
+ @import "./JfbTakeorderOrderListLess.less";
313
+
314
+ .jfb-takeorder-order-list {
315
+ &__body {
316
+ // 订单列表容器样式
317
+ padding: 0;
318
+ }
319
+ }
320
+ </style>
@@ -12,7 +12,7 @@
12
12
  }
13
13
 
14
14
  //start
15
- .jfb-takeorder-quoted-list {
15
+ .jfb-takeorder-order-list {
16
16
  box-sizing: border-box;
17
17
 
18
18
  &__body{
@@ -71,7 +71,7 @@
71
71
 
72
72
 
73
73
  /**notPreview**/
74
- .jfb-takeorder-quoted-list {
74
+ .jfb-takeorder-order-list {
75
75
  //&:before {
76
76
  //content: " ";
77
77
  //display: table;
@@ -16,7 +16,7 @@ export default {
16
16
  //@EndAttrData
17
17
 
18
18
  // #endif
19
- cssRoot: 'jfb-takeorder-quoted-list'
19
+ cssRoot: 'jfb-takeorder-order-list'
20
20
  }
21
21
  },
22
22
  created() {
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+
5
+ getOrderList: { "list": [{ "order_id": "h867336984252252161", "order_status": "quoting", "shop_name": "星巴克(平谷国泰店)", "brand_name": "星巴克", "province_name": "平谷区", "market_amount": 525, "suggest_min_quotation": 116, "suggest_max_quotation": 171, "rest_quotation_time": 12, "rest_receive_time": 0, "rest_report_time": 0, "quotation_person_count": 0, "user_quotation": 0, "user_quotation_status": "wait_quote", "product_list": [{ "product_name": "星巴克经典咖啡", "product_sku_name": "大杯\/特别热\/经典糖\/标准\/全脂牛奶", "product_thumb": "https:\/\/www.shuomingshu.cn\/wp-content\/uploads\/images\/2023\/01\/07\/dc0bdf6bfedb4038911ec6550fd31d62_5t1vcuagbok.jpg", "product_num": 5, "market_price": 382, "suggest_min_quotation": 23, "suggest_max_quotation": 34, "user_quotation": 0 }], "button_list": [] }], "next_page_token": "", "request_id": "c1dfb0423e9c83df" },
6
+
7
+ updateOrderFilmPaiqiDate:{},
8
+
9
+ removeOrderFilmAddress:{},
10
+
11
+ addOrderFilmcart:{},
12
+
13
+ }
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+ import {
3
+ dataVal,
4
+ statusDataVal,
5
+ statusShow
6
+ } from "@/utils/AttrTools";
7
+ export default (data, gValue, gColor, oldData = {}) => {
8
+ return [
9
+ {
10
+ label: '订单详情',
11
+ ele: 'xd-select-pages-path',
12
+ labelInline: true,
13
+ valueKey: 'order_detail_path',
14
+ placeholder: '请选择订单详情页面',
15
+ className: 'input100',
16
+ value: dataVal({ data, key: 'order_detail_path', dValue: null, gValue }),
17
+ groupKey: 'advanced',
18
+ inline: false,
19
+ setting: {
20
+ mode: 'new',
21
+ router: XdBus.getParentApi('getPagesTree'),
22
+ },
23
+ },
24
+ ].filter(i => i)
25
+ }
26
+
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ import { customVal, dataVal } from "@/utils/AttrTools";
4
+
5
+ export default (data, gValue, gColor, oldData = {}) => {
6
+ return [
7
+ {
8
+ label: '订单状态:',
9
+ ele: 'xd-select-list',
10
+ valueKey: 'orderTab',
11
+ value: data['orderTab'] || '',
12
+ groupKey: 'content',
13
+ multiple: false,
14
+ className: 'input80',
15
+ list: [
16
+ { label: '报价中', value: 'quoting' },
17
+ { label: '待上报', value: 'wait_report' },
18
+ ],
19
+ inline: false,
20
+ },
21
+ ].filter(i => i)
22
+ }
23
+
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+ import {
3
+ dataVal,
4
+ statusShow,
5
+ statusDataVal,
6
+ } from "@/utils/AttrTools";
7
+
8
+ export default function (data, gValue, gColor, oldData) {
9
+ return [].filter(i => i)
10
+ }
11
+
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+ /**
3
+ * @description 接口配置,
4
+ * 在设置方法名字当时候,别忘记加上【模块名字】:Voice
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getUserConfig',
10
+ title: '获取用户配置',
11
+ path: '/takeorder/v1/user-config',
12
+ isRule: false,
13
+ params: {},
14
+ isConsole: true,
15
+ disabled: true,
16
+ },
17
+ {
18
+ mapFnName: 'openNewNotify',
19
+ title: '是否开启新订单通知音频',
20
+ path: '/takeorder/v1/user-config/is-open-new-order-notify-audio',
21
+ isRule: false,
22
+ data: {
23
+ is_open: ['是否开启', 'String', '必填'],
24
+ },
25
+ isConsole: true,
26
+ disabled: true,
27
+ },
28
+ {
29
+ mapFnName: 'openWinNotify',
30
+ title: '是否开启中标通知音频',
31
+ path: '/takeorder/v1/user-config/is-open-win-order-audio',
32
+ isRule: false,
33
+ data: {
34
+ is_open: ['是否开启', 'String', '必填'],
35
+ },
36
+ isConsole: true,
37
+ disabled: true,
38
+ },
39
+ ];
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ style: [],
8
+ content: (data) => {
9
+ return [].filter(i=>i)
10
+ },
11
+ advanced: [],
12
+ };
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <view
3
+ class="jfb-takeorder-voice-switch"
4
+ @click="handleEditxSelect"
5
+ :class="{ editx: isEditx && active }"
6
+ >
7
+ <!--#ifdef H5-->
8
+ <view
9
+ class="jfb-takeorder-voice-switch__edit"
10
+ :class="{ editx: isEditx && active }"
11
+ v-if="isEditx && active"
12
+ >
13
+ <view class="jfb-takeorder-voice-switch__edit-icon" @click.stop="delEdit">
14
+ <xd-font-icon
15
+ icon="iconshanchu-01"
16
+ color="#fff"
17
+ size="30"
18
+ ></xd-font-icon>
19
+ </view>
20
+ </view>
21
+ <!-- #endif -->
22
+ <view class="jfb-takeorder-voice-switch__body">
23
+ <view class="jfb-takeorder-voice-switch__body-item">
24
+ <view>新订单提示音</view>
25
+ <switch
26
+ @change="switchNewChange"
27
+ :checked="newOrder"
28
+ :color="mainColor"
29
+ style="transform: scale(0.5)"
30
+ />
31
+ </view>
32
+ <view class="jfb-takeorder-voice-switch__body-item">
33
+ <view>中标提示音</view>
34
+ <switch
35
+ @change="switchBingoChange"
36
+ :checked="bingo"
37
+ :color="mainColor"
38
+ style="transform: scale(0.5)"
39
+ />
40
+ </view>
41
+ <view class="jfb-takeorder-voice-switch__body-notice"
42
+ >没有声音?尝试<text :style="{ color: mainColor }">点击触发</text></view
43
+ >
44
+ </view>
45
+ </view>
46
+ </template>
47
+
48
+ <script>
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);
71
+ },
72
+ },
73
+ created() {
74
+ this.init(this.container);
75
+
76
+ //todo
77
+ },
78
+ methods: {
79
+ onJfbLoad(options) {
80
+ // 获取用户配置
81
+ this.getUserConfig();
82
+ },
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
+ });
99
+ },
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
+ });
123
+ },
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
+ };
166
+ </script>
167
+
168
+ <style scoped lang="less">
169
+ @import "./JfbTakeorderVoiceSwitchLess.less";
170
+
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;
188
+ }
189
+ }
190
+ }
191
+ </style>
@@ -12,7 +12,7 @@
12
12
  }
13
13
 
14
14
  //start
15
- .jfb-takeorder-quoted-detail {
15
+ .jfb-takeorder-voice-switch {
16
16
  box-sizing: border-box;
17
17
 
18
18
  &__body{
@@ -71,7 +71,7 @@
71
71
 
72
72
 
73
73
  /**notPreview**/
74
- .jfb-takeorder-quoted-detail {
74
+ .jfb-takeorder-voice-switch {
75
75
  //&:before {
76
76
  //content: " ";
77
77
  //display: table;
@@ -16,7 +16,7 @@ export default {
16
16
  //@EndAttrData
17
17
 
18
18
  // #endif
19
- cssRoot: 'jfb-takeorder-unquoted-list'
19
+ cssRoot: 'jfb-takeorder-voice-switch'
20
20
  }
21
21
  },
22
22
  created() {