Преглед изворни кода

从工单添加配件暂无数据,后续在做

xiaohaizhao пре 6 месеци
родитељ
комит
a100d8f4f2
2 измењених фајлова са 40 додато и 41 уклоњено
  1. 36 39
      packageA/fittings/modules/product/index.js
  2. 4 2
      packageA/fittings/modules/product/index.wxml

+ 36 - 39
packageA/fittings/modules/product/index.js

@@ -41,6 +41,7 @@ Component({
             pageTotal: 1,
             total: null
         },
+        show: false,
         deliverys: [{
             value: "快递(到付)",
             remarks: "快递(到付)"
@@ -53,7 +54,14 @@ Component({
         }, {
             value: "自提",
             remarks: "自提"
-        }]
+        }],
+        actions: [{
+                name: '从产品库添加',
+            },
+            {
+                name: '从工单添加',
+            }
+        ],
     },
     lifetimes: {
         detached: function () {
@@ -201,53 +209,42 @@ Component({
                 }
             })
         },
-        /* 去添加产品 */
-        addProduct() {
-            if (this.data.packagetype) {
-                wx.navigateTo({
-                    url: '/packageA/activity/bindingProduct/index?params=' + JSON.stringify({
-                        "id": 20230107182302,
-                        "version": 1,
-                        "content": {
-                            nocache: true,
-                            sa_orderid, //订单ID
-                            packagetype: this.data.packagetype,
-                            sa_promotionid: this.data.sa_promotionid,
-                            "where": {
-                                "condition": "",
-                                packagetypemx: "",
-                            }
-                        }
-                    }) + `&butText=添加套餐&packagetypemxrows=${JSON.stringify(this.data.packagetypemxrows)}&getListPa=` + JSON.stringify({
-                        "id": "20221109093902",
-                        content: this.data.content
-                    }),
-                });
-
-                getApp().globalData.handleSelect = this.handleInsert.bind(this);
-
-            } else {
+        onSelected(e) {
+            if (e.detail.name == '从产品库添加') {
                 let detail = getCurrentPages().find(v => v.__route__ == 'packageA/orderForm/detail').data.detail,
                     id = '2025080510311403';
                 wx.navigateTo({
                     url: `/select/product/index?params=${JSON.stringify({
-					"id":id,
-					"content": {
-						nocache:true,
-						sa_orderid, //订单ID
-						"total": 0,
-						"where": {
-							"condition": ""
-						}
-					}
-				})}&butText=添加产品`
+                "id":id,
+                "content": {
+                    nocache:true,
+                    sa_orderid, //订单ID
+                    "total": 0,
+                    "where": {
+                        "condition": ""
+                    }
+                }
+            })}&butText=添加产品`
                 });
                 this.setData({
                     type: detail.type
                 })
                 getApp().globalData.handleSelect = this.handleSelect.bind(this);
-            }
+            } else {
 
+            }
+            this.onCancel()
+        },
+        onCancel() {
+            this.setData({
+                show: false
+            })
+        },
+        /* 去添加产品 */
+        addProduct() {
+            this.setData({
+                show: true
+            })
         },
         /* 去修改 */
         editProduct() {
@@ -327,7 +324,7 @@ Component({
                     content: {
                         ...this.data.base,
                         "items": list.map(v => {
-                            v.sa_orderitemsi = v.sa_orderitemsid || 0;
+                            v.sa_orderitemsid = v.sa_orderitemsid || 0;
                             v.sa_promotion_itemsid = v.sa_promotion_itemsid || 0;
                             v.custamount = v.custamount || 0;
                             v.price = this.data.type == '工具订单' ? v.marketprice : v.contractprice;

+ 4 - 2
packageA/fittings/modules/product/index.wxml

@@ -2,7 +2,7 @@
   <view class="count">配件明细</view>
   <view wx:if="{{!disabled}}" class="expand">
     <picker mode='selector' disabled='{{disabled}}' range='{{deliverys}}' range-key='value' bindchange='changeDelivery'>
-      <navigator url="#" class="but but1">
+      <navigator wx:if="{{list.length > 1}}" url="#" class="but but1">
         批量设置发货方式
       </navigator>
     </picker>
@@ -11,4 +11,6 @@
     </navigator>
   </view>
 </view>
-<List list='{{list}}' deliverys='{{deliverys}}' packagetype="{{packagetype}}" privacyFieldC="{{privacyFieldC}}" disabled='{{disabled}}' bindchangeProduct='changeProduct' binddeleteItem="deleteItem" />
+<List list='{{list}}' deliverys='{{deliverys}}' packagetype="{{packagetype}}" privacyFieldC="{{privacyFieldC}}" disabled='{{disabled}}' bindchangeProduct='changeProduct' binddeleteItem="deleteItem" />
+
+<van-action-sheet show="{{ show }}" actions="{{ actions }}" cancel-text="取消" z-index='9999999' bind:select='onSelected' bind:cancel='onCancel' bind:click-overlay='onCancel' />