jufubao-takeorder 1.0.2-beta3 → 1.0.2-beta5

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 (31) hide show
  1. package/package.json +1 -1
  2. package/src/components/JfbTakeorderFilterOrderList/Api.js +16 -31
  3. package/src/components/JfbTakeorderFilterOrderList/Attr.js +9 -41
  4. package/src/components/JfbTakeorderFilterOrderList/JfbTakeorderFilterOrderList.vue +319 -79
  5. package/src/components/JfbTakeorderFilterOrderList/Mock.js +1 -1
  6. package/src/components/JfbTakeorderFilterOrderList/cusAttr/advanced.js +26 -0
  7. package/src/components/JfbTakeorderFilterOrderList/cusAttr/content.js +9 -0
  8. package/src/components/JfbTakeorderFilterOrderList/cusAttr/style.js +11 -0
  9. package/src/components/JfbTakeorderIndex/Api.js +47 -1
  10. package/src/components/JfbTakeorderIndex/JfbTakeorderIndex.vue +218 -129
  11. package/src/components/JfbTakeorderIndex/Mock.js +4 -4
  12. package/src/components/JfbTakeorderIndex/components/cityPicker.vue +29 -21
  13. package/src/components/JfbTakeorderOrderDetail/Api.js +91 -24
  14. package/src/components/JfbTakeorderOrderDetail/Attr.js +9 -41
  15. package/src/components/JfbTakeorderOrderDetail/JfbTakeorderOrderDetail.vue +1174 -77
  16. package/src/components/JfbTakeorderOrderDetail/Mock.js +9 -9
  17. package/src/components/JfbTakeorderOrderDetail/components/CusEditQuote.vue +150 -0
  18. package/src/components/JfbTakeorderOrderDetail/components/products.vue +141 -0
  19. package/src/components/JfbTakeorderOrderDetail/cusAttr/advanced.js +12 -0
  20. package/src/components/JfbTakeorderOrderDetail/cusAttr/content.js +233 -0
  21. package/src/components/JfbTakeorderOrderDetail/cusAttr/style.js +11 -0
  22. package/src/components/JfbTakeorderOrderList/Api.js +16 -31
  23. package/src/components/JfbTakeorderOrderList/JfbTakeorderOrderList.vue +259 -122
  24. package/src/components/JfbTakeorderOrderList/Mock.js +1 -1
  25. package/src/components/JfbTakeorderOrderList/cusAttr/content.js +14 -0
  26. package/src/components/JfbTakeorderVoiceSwitch/Api.js +14 -33
  27. package/src/components/JfbTakeorderVoiceSwitch/Attr.js +1 -37
  28. package/src/components/JfbTakeorderVoiceSwitch/JfbTakeorderVoiceSwitch.vue +159 -81
  29. package/src/components/JfbTakeorderVoiceSwitch/Mock.js +2 -10
  30. package/src/components/JfbTakeorderIndex/components/order.vue +0 -273
  31. package/src/components/JfbTakeorderOrderList/components/order.vue +0 -273
@@ -2,167 +2,304 @@
2
2
  <view
3
3
  class="jfb-takeorder-order-list"
4
4
  @click="handleEditxSelect"
5
- :class="{ editx : isEditx && active }"
5
+ :class="{ editx: isEditx && active }"
6
6
  >
7
7
  <!--#ifdef H5-->
8
8
  <view
9
9
  class="jfb-takeorder-order-list__edit"
10
- :class="{ editx : isEditx && active }"
10
+ :class="{ editx: isEditx && active }"
11
11
  v-if="isEditx && active"
12
12
  >
13
13
  <view class="jfb-takeorder-order-list__edit-icon" @click.stop="delEdit">
14
- <xd-font-icon icon="iconshanchu-01" color="#fff" size="30"></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-order-list__body">
19
- <view
23
+ <!-- <view
20
24
  v-if="showNew"
21
25
  @click="handleRefresh"
22
26
  :style="{ color: warningColor, background: newBackgroundColor }"
23
27
  class="jfb-takeorder-quoted-list__body-new"
24
28
  ><XdFontIcon size="24" icon="iconIM"></XdFontIcon>
25
29
  <view>新的订单来了,点我立即刷新</view></view
26
- >
30
+ > -->
27
31
  <view v-for="(item, index) in orderList" :key="index">
28
- <Order
32
+ <CusTakeorder
29
33
  :item="item"
30
34
  :mainColor="mainColor"
31
35
  @expire="handleOrderExpire"
32
36
  @btnEvent="handleBtnEvent"
33
- ></Order>
37
+ ></CusTakeorder>
34
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
+ >
35
45
  </view>
36
46
  </view>
37
47
  </template>
38
48
 
39
49
  <script>
40
- import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
41
- import { jfbRootExec } from "@/utils/xd.event";
42
- import JfbTakeorderOrderListMixin from "./JfbTakeorderOrderListMixin";
43
- import { getContainerPropsValue } from "@/utils/xd.base";
44
- import componentsMixins from "@/mixins/componentsMixins";
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";
45
55
  import extsMixins from "@/mixins/extsMixins";
46
- import Order from "./components/order.vue";
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";
47
60
  const Color = require("color");
48
- export default {
49
- name: "JfbTakeorderOrderList",
50
- components: {
51
- XdFontIcon,
52
- Order,
53
- },
54
- mixins: [
55
- componentsMixins, extsMixins, JfbTakeorderOrderListMixin
56
- ],
57
- data() {
58
- return {
59
- newBackgroundColor: "",
60
- showNew: false,
61
- orderList: [
62
- {
63
- id: 1,
64
- num: 15,
65
- people: 30,
66
- remainingTime: 10,
67
- shop_name: "味多美(北京西单大悦城店)",
68
- brand_name: "味多美",
69
- city: "北京市",
70
- products: [
71
- {
72
- product_thumb:
73
- "https://img.js.design/assets/img/68b554c9c3a1ea02642d7d2f.png#afa2b9b9d50bcd2f1394619ecc488a99",
74
- product_name:
75
- "贝欧宝 BIOBOR贝欧宝维生素C+叶黄素酯软糖118g多重营养3D小熊造型糖果Q弹维生素C+叶黄素酯软糖",
76
- product_sku: "118g",
77
- minPrice: 132,
78
- maxPrice: 1232,
79
- num: 15,
80
- },
81
- {
82
- product_thumb:
83
- "https://img.js.design/assets/img/68b554c9c3a1ea02642d7d2f.png#afa2b9b9d50bcd2f1394619ecc488a99",
84
- product_name:
85
- "贝欧宝 BIOBOR贝欧宝维生素C+叶黄素酯软糖118g多重营养3D小熊造型糖果Q弹维生素C+叶黄素酯软糖",
86
- product_sku: "450g",
87
- minPrice: 456,
88
- maxPrice: 1546,
89
- num: 16,
90
- },
91
- ],
92
- market_price: 4000,
93
- minPrice: 456,
94
- maxPrice: 1546,
95
- order_status: 1,
96
- },
97
- ],
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: null,
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
+ });
98
117
  }
99
118
  },
100
- watch: {
101
- container(value, oldValue) {
102
- if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
103
- if (this.$configProject['isPreview']) this.init(value)
104
- },
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
+ }
105
138
  },
106
- created() {
107
- this.init(this.container);
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
+ };
108
150
 
109
- //todo
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
+ });
110
177
  },
111
- methods: {
112
- onJfbLoad(options) {
113
-
114
- // jfbRootExec('baiduUserLogin', {
115
-
116
- // vm: this,// data: {
117
-
118
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
119
-
120
- // }
121
-
122
- // }).then().catch()
123
- },
124
- /**
125
- * @description 监听事件变化
126
- * @param container {object} 业务组件对象自己
127
- */
128
- init(container) {
129
- this.newBackgroundColor = Color(this.warningColor).alpha(0.15).toString();
130
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
131
-
132
- //this.height = getContainerPropsValue(container, 'content.height', 10);
133
- },
134
- onJfbScroll(options) {
135
- console.log('event.onJfbScroll', options)
136
- },
137
- onJfbReachBottom(options) {
138
- console.log('event.onJfbReachBottom', options)
139
- },
140
- onJfbShow(options) {
141
- console.log('event.onJfbShow', options)
142
- },
143
- onJfbHide(options) {
144
- console.log('event.onJfbHide', options)
145
- },
146
- onJfbBack(options) {
147
- console.log('event.onJfbBack', options)
148
- },
149
- onJfbUpdate(...data) {
150
- console.log('event.onJfbUpdate', data)
151
- },
152
- onJfbCustomEvent(options) {
153
- console.log('event.onJfbReachBottom', options)
154
- },
155
- }
156
- }
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(orderId) {
189
+ if (this.isPreview) return;
190
+ const orderIndex = this.orderList.findIndex(
191
+ (item) => item.order_id === orderId || item.id === orderId
192
+ );
193
+ if (orderIndex === -1) return;
157
194
 
195
+ // 从列表中删除该订单
196
+ this.orderList.splice(orderIndex, 1);
197
+ },
198
+ /**
199
+ * 刷新列表
200
+ */
201
+ handleRefresh() {
202
+ // 重置分页
203
+ this.page_token = 1;
204
+ this.hasNext = true;
205
+ this.next_page_token = "";
206
+ // 重新获取列表
207
+ this.getList();
208
+ this.showNew = false;
209
+ },
210
+ /**
211
+ * 获取新订单通知
212
+ */
213
+ handleGetNew() {
214
+ jfbRootExec("getNewOrderNotify", {
215
+ vm: this,
216
+ data: {
217
+ order_type: this.order_type,
218
+ max_id: this.max_id || 0,
219
+ },
220
+ }).then((res) => {
221
+ if (res.is_exist_new_order && res.is_exist_win_order) {
222
+ if (this.isOpenNew === "Y") {
223
+ this.voiceAlert({ type: "new",filePath: 'https://img.jufubao.cn/takeorder/new_order.mp3' });
224
+ }
225
+ if (this.isOpenWin === "Y") {
226
+ setTimeout(() => {
227
+ this.voiceAlert({ type: "win",filePath: 'https://img.jufubao.cn/takeorder/wait_order.mp3' });
228
+ }, 1000);
229
+ }
230
+ } else if (res.is_exist_new_order) {
231
+ if (this.isOpenNew === "Y") {
232
+ this.voiceAlert({ type: "new",filePath: 'https://img.jufubao.cn/takeorder/new_order.mp3' });
233
+ }
234
+ } else if (res.is_exist_win_order) {
235
+ if (this.isOpenWin === "Y") {
236
+ this.voiceAlert({ type: "win",filePath: 'https://img.jufubao.cn/takeorder/wait_order.mp3' });
237
+ }
238
+ }
239
+ this.max_id = res.new_order_max_id;
240
+ this.showNew = res.is_exist_new_order;
241
+ });
242
+ },
243
+ /**
244
+ * 启动轮询定时器
245
+ */
246
+ startPolling() {
247
+ // 如果已经存在定时器,先清除
248
+ if (this.pollTimer) {
249
+ clearInterval(this.pollTimer);
250
+ }
251
+ // 每5秒调用一次接口
252
+ this.pollTimer = setInterval(() => {
253
+ this.handleGetNew();
254
+ }, 5000);
255
+ },
256
+ /**
257
+ * 停止轮询定时器
258
+ */
259
+ stopPolling() {
260
+ if (this.pollTimer) {
261
+ clearInterval(this.pollTimer);
262
+ this.pollTimer = null;
263
+ }
264
+ },
265
+ onJfbScroll(options) {},
266
+ onJfbReachBottom(options) {
267
+ if (this.hasNext) {
268
+ this.page_token = this.next_page_token;
269
+ this.getList();
270
+ }
271
+ },
272
+ onJfbShow(options) {
273
+ // 页面显示时恢复轮询
274
+ if (!this.pollTimer) {
275
+ this.startPolling();
276
+ }
277
+ },
278
+ onJfbHide(options) {
279
+ // 页面隐藏时暂停轮询
280
+ this.stopPolling();
281
+ console.log("event.onJfbHide", options);
282
+ },
283
+ onJfbBack(options) {
284
+ console.log("event.onJfbBack", options);
285
+ },
286
+ onJfbUpdate(...data) {
287
+ console.log("event.onJfbUpdate", data);
288
+ },
289
+ onJfbCustomEvent(options) {
290
+ console.log("event.onJfbReachBottom", options);
291
+ },
292
+ },
293
+ };
158
294
  </script>
159
295
 
160
296
  <style scoped lang="less">
161
- @import "./JfbTakeorderOrderListLess.less";
162
-
163
- .jfb-takeorder-order-list {
164
- &__body{
297
+ @import "./JfbTakeorderOrderListLess.less";
165
298
 
166
- }
299
+ .jfb-takeorder-order-list {
300
+ &__body {
301
+ // 订单列表容器样式
302
+ padding: 0;
167
303
  }
304
+ }
168
305
  </style>
@@ -2,7 +2,7 @@
2
2
 
3
3
  module.exports = {
4
4
 
5
- getOrderByIdFilmSquate:{},
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
6
 
7
7
  updateOrderFilmPaiqiDate:{},
8
8
 
@@ -4,6 +4,20 @@ import { customVal, dataVal } from "@/utils/AttrTools";
4
4
 
5
5
  export default (data, gValue, gColor, oldData = {}) => {
6
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
+ },
7
21
  ].filter(i => i)
8
22
  }
9
23
 
@@ -6,51 +6,32 @@
6
6
  */
7
7
  module.exports = [
8
8
  {
9
- //设置方法名字当别忘记加上【模块名字】:Voice
10
- mapFnName: 'getVoiceByIdFilmSquate',
11
- title: '获取电影广场列表',
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
- //设置方法名字当别忘记加上【模块名字】:Voice
36
- mapFnName: 'removeVoiceFilmAddress',
37
- title: '删除我的配送地址',
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
- params: {
41
- film_id: ['电影id', 'Number', '必选'],
22
+ data: {
23
+ is_open: ['是否开启', 'String', '必填'],
42
24
  },
43
25
  isConsole: true,
44
26
  disabled: true,
45
27
  },
46
28
  {
47
- //设置方法名字当别忘记加上【模块名字】:Voice
48
- mapFnName: 'addVoiceFilmcart',
49
- title: '添加购物车',
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
- params: {
53
- film_id: ['电影id', 'Number', '必选'],
33
+ data: {
34
+ is_open: ['是否开启', 'String', '必填'],
54
35
  },
55
36
  isConsole: true,
56
37
  disabled: true,
@@ -6,43 +6,7 @@
6
6
  export default {
7
7
  style: [],
8
8
  content: (data) => {
9
- return [
10
- {
11
- label: '背景颜色:',
12
- ele: 'xd-color',
13
- valueKey: 'bgColor',
14
- value: data.bgColor || '',
15
- placeholder: '请输入占位框背景颜色',
16
- groupKey:'content',
17
- },
18
- {
19
- label: '选中路径:',
20
- groupKey:'advanced',
21
- className: 'input100',
22
- ele: 'xd-select-pages-path',
23
- valueKey: 'select-pages-path',
24
- value: data['select-pages-path'] || null,
25
- setting: {
26
- router: XdBus.getParentApi('getPagesTree')
27
- },
28
- },
29
- data.bgColor && {
30
- label: '高度:',
31
- ele: 'el-input',
32
- groupKey:'style',
33
- type: 'number',
34
- valueKey: 'height',
35
- value: data.height || 100,
36
- placeholder: '请输入占位框高度,单位像素,默认:10px',
37
- className: 'input60',
38
- },
39
- {
40
- label: '', //label
41
- groupKey:'advanced',
42
- ele: 'slot', //package 名称
43
- slot: 'is_reference',
44
- },
45
- ].filter(i=>i)
9
+ return [].filter(i=>i)
46
10
  },
47
11
  advanced: [],
48
12
  };