linwenxin 8 месяцев назад
Родитель
Сommit
2b8c1b1986

+ 42 - 123
src/packageMaterial/pages/sale/index.vue

@@ -2,6 +2,14 @@
   <!-- #ifdef H5 -->
   <zj-page-layout :hasFooter="true">
     <view class="form-container">
+      <!-- <view class="item" @tap="isShowBrandDialog = true">
+        <view class="label"><text>*</text>品牌</view>
+        <view class="picker">
+          <text class="value" v-if="brand">{{brand.brandName}}</text>
+          <text class="placeholder" v-else>请选择</text>
+          <text class="iconfont icon-jinru"></text>
+        </view>
+      </view> -->
       <view class="item" v-if="type == 'P'" @tap="isShowCategoryDialog = true">
         <view class="label"><text>*</text>产品大类</view>
         <view class="picker">
@@ -10,10 +18,24 @@
           <text class="iconfont icon-jinru"></text>
         </view>
       </view>
+      <!-- <view class="item">
+        <view class="label"><text>*</text>销售方式</view>
+        <u-radio-group v-model="salesType">
+          <u-radio shape="circle" label="外购" :name="'OUT'"></u-radio>
+          <u-radio shape="circle" label="自有仓库" :name="'OWN'"></u-radio>
+        </u-radio-group>
+      </view> -->
       <u-gap height="10" bgColor="#F7F8FF"></u-gap>
       <view class="item">
         <view class="label"><text>*</text>客户电话</view>
-        <u--input :maxlength="11" placeholder="请输入" border="none" inputAlign="right" v-model="userMobile"></u--input>
+        <!-- :readonly="hasOid" -->
+        <u--input
+          :maxlength="11"
+          placeholder="请输入"
+          border="none"
+          inputAlign="right"
+          v-model="userMobile"
+        ></u--input>
       </view>
       <view class="item">
         <view class="label">工单单号</view>
@@ -27,65 +49,6 @@
           <text class="iconfont icon-jinru"></text>
         </view>
       </view>
-      <!-- ------------------------------------ -->
-      <view v-for="(item, index) in peijianList" :key="index">
-        <u-gap height="10" bgColor="#F7F8FF"></u-gap>
-        <view class="item">
-          <view class="label" style="font-weight: bold">配件信息{{ index + 1 }}</view>
-          <view class="label" style="color: red; margin-right: 10rpx" @click="delpeijian(index)">删除</view>
-        </view>
-        <view class="item">
-          <view class="label"><text>*</text>是否质量问题</view>
-          <u--input
-            :maxlength="11"
-            placeholder="请输入"
-            border="none"
-            inputAlign="right"
-            v-model="userMobile"
-          ></u--input>
-        </view>
-        <view class="item">
-          <view class="label"><text>*</text>旧配件编号</view>
-          <u--input
-            :readonly="hasOid"
-            placeholder="请输入"
-            border="none"
-            inputAlign="right"
-            v-model="orderNo"
-          ></u--input>
-        </view>
-        <view class="item">
-          <view class="label"><text>*</text>旧配件名称</view>
-          <u--input
-            :readonly="hasOid"
-            placeholder="请输入"
-            border="none"
-            inputAlign="right"
-            v-model="orderNo"
-          ></u--input>
-        </view>
-        <view class="item" @tap="toChooseProduct(index)">
-          <view class="label"><text>*</text>新配件名称</view>
-          <view class="picker">
-            <text class="value" v-if="item">{{ item.name }}</text>
-            <text class="placeholder" v-else>选择产品</text>
-            <text class="iconfont icon-jinru"></text>
-          </view>
-        </view>
-        <view class="item">
-          <view class="label"><text>*</text>新配件编号</view>
-          <u--input
-            :readonly="hasOid"
-            placeholder="请输入"
-            border="none"
-            inputAlign="right"
-            v-model="orderNo"
-          ></u--input>
-        </view>
-      </view>
-      <u-gap height="10" bgColor="#F7F8FF"></u-gap>
-      <u-button class="btnloukong" text="添加配件" @click="addpeijian"></u-button>
-      <u-gap height="10" bgColor="#F7F8FF"></u-gap>
     </view>
 
     <template slot="footer">
@@ -94,7 +57,7 @@
           text="历史记录"
           @click="$navToPage({ url: `/packageMaterial/pages/sale/orderList?type=${type}` })"
         ></u-button>
-        <u-button type="primary" text="提交" @click="submitData"></u-button>
+        <u-button type="primary" text="选择产品" @click="toChooseProduct"></u-button>
       </view>
     </template>
 
@@ -162,6 +125,7 @@ import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
        wbId: null, // 维保工单
        wbIsAllFee: null, // 维保工单是否包含全部费用
        wbPayType: null, // 维保工单费用支付方式
+
        type: 'M',
        userMobile: '',
        orderNo: '',
@@ -175,7 +139,6 @@ import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
        websit: null,
        websitList: [],
        isShowWebsitDialog: false,
-       peijianList:[]
      }
    },
 
@@ -212,25 +175,9 @@ import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
          this.wbPayType = data.feePayMethod || '';
        })
      }
-  },
-
-  onShow() {
-    var data = this.$getStorage('materialSaleData')
-    if (data.dijiIndex !== undefined && this.peijianList[data.dijiIndex]) {
-      console.log(data)
-    }
-    this.$removeStorage('materialSaleData')
-  },
-
-  methods: {
-    addpeijian() {
-      this.peijianList.push({})
-    },
-
-    delpeijian(index) {
-      this.peijianList.splice(index, 1)
-    },
+   },
 
+   methods: {
      getBrandList() {
        this.$api.post('/pay/getBrand')
        .then(res => {
@@ -267,40 +214,21 @@ import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
        this.isShowWebsitDialog = false;
      },
 
-    toChooseProduct(index) {
-      if(this.type == 'P' && !this.category) return this.$toast('请选择产品大类');
-      if(!this.websit) return this.$toast('请选择所属网点');
-      if(!this.userMobile) return this.$toast('请输入客户电话');
-      if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
-      this.$navToPage({
-        url: `/packageMaterial/pages/sale/product?dijiIndex=${index}&type=${this.type}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
-      })
-    },
-
-    submitData() {
-      if(this.peijianList.length < 1) return this.$toast('请选择');
-      this.$setStorage('materialSaleDataZhiFu', {
-        type: this.type,
-        categoryId: this.type == 'P' ? this.category.categoryId : '',
-        categoryName: this.type == 'P' ? this.category.name : '',
-        salesType: 'OUT',
-        brandId: null,
-        brandName: null,
-        websitId: this.websit.websitId,
-        websitName: this.websit.websitName,
-        userMobile: this.userMobile,
-        orderNo: this.orderNo,
-        wbId: this.wbId,
-        wbIsAllFee: this.wbIsAllFee,
-        wbPayType: this.wbPayType,
-        goodsList: this.peijianList
-      });
-      this.$navToPage({
-        url: `/packageMaterial/pages/sale/order`
-      })
-    },
-  },
-}
+     toChooseProduct() {
+      //  if(!this.brand) return this.$toast('请选择品牌');
+       if(this.type == 'P' && !this.category) return this.$toast('请选择产品大类');
+       if(!this.websit) return this.$toast('请选择所属网点');
+       if(!this.userMobile) return this.$toast('请输入客户电话');
+       if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
+      //  this.$navToPage({
+      //    url: `/packageMaterial/pages/sale/product?type=${this.type}&brandId=${this.brand.id}&brandName=${this.brand.brandName}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&salesType=${this.salesType}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
+      //  })
+       this.$navToPage({
+         url: `/packageMaterial/pages/sale/product?type=${this.type}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
+       })
+     },
+   },
+ }
 
  // #endif
  // #ifndef H5
@@ -322,15 +250,6 @@ import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
   background: #ffffff;
   margin-top: 20rpx;
   border-top: 1px solid #f5f5f5;
-  .btnloukong {
-    height: 72rpx;
-    border: 2rpx solid #005ef4;
-    margin: 0;
-    background: transparent;
-    font-size: 28rpx;
-    line-height: 72rpx;
-    color: #0268fa;
-  }
   .item {
     height: 108rpx;
     border-bottom: 1px solid #f5f5f5;

+ 2 - 0
src/packageMaterial/pages/sale/order.vue

@@ -150,6 +150,8 @@ export default {
   },
 
   methods: {
+
+
     confirmPartsDialog(e) {
       this.parts = this.partsList[e[0]];
       this.isShowPartsDialog = false;

+ 119 - 24
src/packageMaterial/pages/sale/product.vue

@@ -28,19 +28,37 @@
       </view>
       <view class="right-list">
         <scroll-view scroll-y style="height: 100%">
-          <view class="item" v-for="(item, index) in rightList" :key="index" @click="selectId = item.goodsCode">
+          <view class="item" v-for="(item, index) in rightList" :key="index">
             <view class="name">{{ item.goodsName }}</view>
             <view class="text">代码:{{ item.goodsCode }}</view>
             <view class="bottom">
               <view class="price"
                 >¥{{ item.goodsAmount | priceFilter }}<text>/{{ item.goodsUnit }}</text></view
               >
-              <view
-                :style="`width: 50rpx; height: 50rpx; border-radius: 50%;background: ${
-                  selectId == item.goodsCode ? '#0379FF' : '#ebebeb'
-                };display: flex;justify-content: center;align-items: center;color:#fff`"
-                ><text>✔</text></view
+              <u-number-box
+                min="0"
+                :step="item.goodsUnit == '米' ? 1 : 1"
+                :name="item.goodsId"
+                v-model="item.num"
+                @change="changeNum"
               >
+                <view slot="minus" class="ctrl">
+                  <u-icon name="minus" color="#FFFFFF" size="12"></u-icon>
+                </view>
+                <text slot="input" class="input">
+                  <u--input
+                    :type="item.goodsUnit == '米' ? 'digit' : 'number'"
+                    placeholder="0"
+                    inputAlign="center"
+                    border="none"
+                    v-model="item.num"
+                    @blur="changeNum({ name: item.goodsId, value: item.num, unit: item.goodsUnit })"
+                  ></u--input>
+                </text>
+                <view slot="plus" class="ctrl">
+                  <u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
+                </view>
+              </u-number-box>
             </view>
           </view>
           <Loading :type="2" :loadStatus="loadStatus" :dataList="rightList" v-if="type == 'M'" />
@@ -53,9 +71,59 @@
       </view>
     </view>
 
+    <u-transition class="dialog-mark" mode="fade" :show="isShowDialog" @tap="isShowDialog = false"></u-transition>
+    <u-transition class="dialog-container" mode="slide-up" :show="isShowDialog">
+      <view class="top">
+        <view class="left">购物车</view>
+        <view class="right" @tap="clearCart"><text class="iconfont icon-shanchu"></text>清空购物车</view>
+      </view>
+      <view class="list">
+        <view class="item" v-for="(item, index) in cartList" :key="index">
+          <view class="name">{{ item.goodsName }}</view>
+          <view class="bottom">
+            <view class="price"
+              >¥{{ item.goodsAmount | priceFilter }}<text>/{{ item.goodsUnit }}</text></view
+            >
+            <u-number-box
+              :step="item.goodsUnit == '米' ? 1 : 1"
+              :min="item.goodsUnit == '米' ? 0.1 : 1"
+              :name="item.goodsId"
+              v-model="item.num"
+              @change="changeCartNum"
+              @overlimit="overlimitFun(index)"
+            >
+              <view slot="minus" class="ctrl">
+                <u-icon name="minus" color="#FFFFFF" size="12"></u-icon>
+              </view>
+              <text slot="input" class="input">
+                <u--input
+                  :type="item.goodsUnit == '米' ? 'digit' : 'number'"
+                  placeholder="0"
+                  inputAlign="center"
+                  border="none"
+                  v-model="item.num"
+                  @blur="changeCartNum({ name: item.goodsId, value: item.num, unit: item.goodsUnit })"
+                ></u--input>
+              </text>
+              <view slot="plus" class="ctrl">
+                <u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
+              </view>
+            </u-number-box>
+          </view>
+        </view>
+      </view>
+    </u-transition>
+
     <template slot="footer">
       <view class="bottom-container">
-        <u-button type="primary" text="保存" @click="submitData"></u-button>
+        <view class="cart" @tap="isShowDialog = !isShowDialog">
+          <text class="iconfont icon-gouwuche1"></text>
+          <u-badge max="99" :value="totalNum" :offset="[1, 1]" absolute></u-badge>
+        </view>
+        <view class="price"><text>合计:</text>¥{{ totalPrice | priceFilter }}</view>
+        <view class="btn">
+          <u-button type="primary" text="提交" @click="submitData"></u-button>
+        </view>
       </view>
     </template>
   </zj-page-layout>
@@ -85,19 +153,36 @@ export default {
       wbId: null, // 维保工单
       wbIsAllFee: null, // 维保工单是否包含全部费用
       wbPayType: null, // 维保工单费用支付方式
+
       keyword: '',
-      leftList: [],
-      leftCurrent: 0,
-      rightList: [],
+		leftList: [],
+		leftCurrent: 0,
+		rightList: [],
       loadStatus: 0,
+      isShowDialog: false,
+
       cartList: [],
-      selectId: "",
-      dijiIndex: 0
     }
   },
 
-  onLoad({dijiIndex, type, userMobile, orderNo, salesType, brandId, brandName, categoryId, categoryName, websitId, websitName, wbId, wbIsAllFee, wbPayType}) {
-    this.dijiIndex = dijiIndex;
+  computed: {
+    totalNum() {
+      // let val = 0;
+      // this.cartList.forEach(item => {
+      //   val = val + item.num;
+      // })
+      return this.cartList.length;
+    },
+    totalPrice() {
+      let val = 0;
+      this.cartList.forEach(item => {
+        val = val + (item.num * (item.goodsAmount * 100) / 100);
+      })
+      return val;
+    },
+  },
+
+  onLoad({type, userMobile, orderNo, salesType, brandId, brandName, categoryId, categoryName, websitId, websitName, wbId, wbIsAllFee, wbPayType}) {
     this.type = type;
     this.userMobile = userMobile;
     this.orderNo = orderNo;
@@ -261,16 +346,26 @@ export default {
     },
 
     submitData() {
-
-      var data = this.rightList.find(item => item.goodsCode == this.selectId)
-      if (data) {
-        this.$setStorage('materialSaleData', {...data, dijiIndex: this.dijiIndex});
-        this.$navToPage({
-          delta: 1
-        },"navigateBack")
-      } else {
-        this.$toast('请选择');
-      }
+      if(this.cartList.length < 1) return this.$toast('请选择');
+      this.$setStorage('materialSaleData', {
+        type: this.type,
+        salesType: this.salesType,
+        brandId: this.brandId,
+        brandName: this.brandName,
+        categoryId: this.type == 'P' ? this.categoryId : '',
+        categoryName: this.type == 'P' ? this.categoryName : '',
+        websitId: this.websitId,
+        websitName: this.websitName,
+        userMobile: this.userMobile,
+        orderNo: this.orderNo,
+        wbId: this.wbId,
+        wbIsAllFee: this.wbIsAllFee,
+        wbPayType: this.wbPayType,
+        goodsList: this.cartList
+      });
+      this.$navToPage({
+        url: `/packageMaterial/pages/sale/order`
+      })
     },
 
   },