zhaoxiaohai пре 2 година
родитељ
комит
90f2991785
3 измењених фајлова са 60 додато и 11 уклоњено
  1. 1 1
      packageA/market/detail.js
  2. 5 5
      packageA/orderForm/detail.wxml
  3. 54 5
      packageA/shopping/index.js

+ 1 - 1
packageA/market/detail.js

@@ -11,7 +11,7 @@ Page({
   onLoad(options) {
     if (options.id) this.setData({
       sa_itemgroupid: options.id,
-      itemno: 'BM8270 0150000'
+      itemno: options.itemno
     })
     this.getDetail();
   },

+ 5 - 5
packageA/orderForm/detail.wxml

@@ -8,7 +8,7 @@
     </view>
     <view class="exp">订单类型:{{detail.type}}</view>
     <view class="exp">订单状态:{{detail.status}}</view>
-    <view class="exp">单据日期:{{detail.submitdate}}</view>
+    <view class="exp">单据日期:{{detail.submitdate || '暂无'}}</view>
     <view class="exp">创建日期:{{detail.createdate}}</view>
     <view class="exp">核销状态:{{detail.writeoffstatus}}</view>
     <view class="exp">开票状态:{{detail.invoicestatus}}</view>
@@ -19,7 +19,7 @@
     <van-icon custom-class='icon' name="location" />
     <view class="content">
         <view class="name">
-            {{detail.contacts.name}}<text>{{detail.contacts.phonenumber}}</text>
+            {{detail.contacts.name || '暂无'}}<text>{{detail.contacts.phonenumber}}</text>
         </view>
         <view class="address">
             {{detail.contacts.address}}
@@ -34,7 +34,7 @@
             开票单位
         </view>
         <view class="address">
-            {{detail.finance.enterprisename}}
+            {{detail.finance.enterprisename || '暂无'}}
         </view>
     </view>
     <view class="iconfont icon-dibu-bianji" />
@@ -47,14 +47,14 @@
     <navigator url="#" class="row">
         <view class="label">结算人</view>
         <view style="font-size: 28rpx;">
-            {{detail.finance.pay_enterprisename}}
+            {{detail.finance.pay_enterprisename || '暂无'}}
             <van-icon name="arrow" />
         </view>
     </navigator>
     <navigator url="#" class="row">
         <view class="label">支付账户</view>
         <view style="font-size: 28rpx;">
-            {{detail.accountclass.accountname}}
+            {{detail.accountclass.accountname || '暂无'}}
             <van-icon name="arrow" />
         </view>
     </navigator>

+ 54 - 5
packageA/shopping/index.js

@@ -14,7 +14,54 @@ Page({
     },
     /* 提交 */
     submit() {
-        console.log("提交订单")
+        console.log("提交订单", this.data.results)
+        let obj = {};
+        let list = this.data.results.map(v => {
+            let data = this.data.list.find(value => value.sa_shoppingcartid == v);
+            //根据领域分类
+            if (obj[data.brandname]) {
+                obj[data.brandname].list.push(data)
+            } else {
+                obj[data.brandname] = {
+                    type: data.brandname,
+                    list: [data]
+                }
+            };
+            return data;
+        });
+
+        _Http.basic({
+            "id": 20221128183202,
+            "content": {
+                "tradefield": "消防", //必选
+                "items": list.map(v => {
+                    return {
+                        "sa_orderitemsid": 0,
+                        "itemid": v.itemid,
+                        "sa_brandid": v.sa_brandid,
+                        "qty": v.qty
+                    }
+                })
+            }
+        }).then(res => {
+            console.log("转化订单", res)
+            if (res.msg != '成功') return wx.showToast({
+                title: 'res.msg',
+                icon: "none"
+            });
+            wx.showModal({
+                title: '提示',
+                content: '生成成功!是否立即前往',
+                complete: (s) => {
+                    if (s.confirm) {
+                        wx.navigateTo({
+                            url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+                        })
+                    }
+                }
+            });
+            this.getList();
+        })
     },
     /* 获取列表 */
     getList() {
@@ -41,7 +88,7 @@ Page({
             if (wx.getStorageSync('shopping')) {
                 this.setData({
                     ...wx.getStorageSync('shopping')
-                })
+                });
                 this.computeSum();
             }
         })
@@ -91,15 +138,17 @@ Page({
                 results.splice(v, 1);
             });
             getApp().globalData.num = getApp().globalData.num - deteleList.length;
-        }
+        };
+        let sa_brandid = results.length ? this.data.sa_brandid : null;
         wx.setStorageSync('shopping', {
             results,
-            sa_brandid: this.data.sa_brandid
+            sa_brandid
         })
         this.setData({
             sum,
             yfsum,
-            results
+            results,
+            sa_brandid
         })
     },
     /* 删除产品 */