Kaynağa Gözat

1、修改组件

zhoux 2 yıl önce
ebeveyn
işleme
9b973a780a

+ 10 - 10
components/dkbase/dk-cell/dk-cell.js

@@ -54,15 +54,15 @@ Component({
     title:{
       type:String,
       value:'',
-      observer: function (newVal) {
-        if(newVal){
-          // 计算标题宽度
-          let titleWidth = newVal.length * this.data.fontSize;
-          this.setData({
-            titleWidth:titleWidth
-          })
-        }
-      }
+      // observer: function (newVal) {
+      //   if(newVal){
+      //     // 计算标题宽度
+      //     let titleWidth = newVal.length * this.data.fontSize;
+      //     this.setData({
+      //       titleWidth:titleWidth
+      //     })
+      //   }
+      // }
     },
     /**
      * 内容
@@ -124,7 +124,7 @@ Component({
      */
     height:{
       type:String,
-      value:'88rpx',
+      value:'78rpx',
     },
     /**
      * 左侧距离

+ 1 - 1
components/dkbase/dk-cell/dk-cell.wxml

@@ -1,5 +1,5 @@
 <view id="totalView" class="total_class" style="--height--:{{errorMessage?('calc(' + height +' + 30rpx)' ):height}};--left--:{{left}};--center--:{{center?center:(title?'left':'center')}}">
-  <view class="title_class" wx:if="{{title}}" style="--titleColor--:{{titleColor==''?contentColor:titleColor}};--fontSize--:{{fontSize + 'px'}};--fontWeight--:{{fontWeight}}">{{title}}</view>
+  <view class="title_class" wx:if="{{title}}" style="--titleColor--:{{titleColor==''?contentColor:titleColor}};--fontSize--:{{fontSize + 'px'}};--fontWeight--:{{fontWeight}};--titleWidth--:{{titleWid?titleWid:''}}">{{title}}</view>
   <!--placeholder-->
   <view wx:if="{{placeholder && !displayValue}}" class="{{contentRight?'content_class':'content_left_class'}}" style="--contentColor--:{{placeholderColor}};--fontSize--:{{(contentFontSize==0?fontSize:contentFontSize) + 'px'}};--titleWidth--:{{titleWid?titleWid :titleWidth + 'px'}};--fontWeight--:{{contentFontWeight==''?fontWeight:contentFontWeight}};--spaceWidth--:{{title?spaceWidth:''}}">{{placeholder}}</view>
   <!--错误提示信息-->

+ 4 - 2
components/dkbase/dk-cell/dk-cell.wxss

@@ -11,6 +11,7 @@
   font-size: var(--fontSize--);
   color: var(--titleColor--);
   font-weight: var(--fontWeight--);
+  width: var(--titleWidth--);
 }
 .content_class{
   position:absolute;
@@ -24,9 +25,10 @@
   display: flex;
 }
 .content_left_class{
-  position:absolute;
+  /* position:absolute; */
   /* margin-left: 20rpx; */
-  left:calc(var(--titleWidth--) + var(--spaceWidth--));
+  /* left:calc(var(--titleWidth--) + var(--spaceWidth--)); */
+  margin-left: var(--spaceWidth--);
   overflow-x: auto;
   color: var(--contentColor--);
   font-size: var(--fontSize--);

+ 99 - 32
components/dkbase/dk-form-bill/dk-form-bill.js

@@ -30,8 +30,8 @@ Component({
       type: String,
     },
     // 路由名称
-    routeObjName:{
-      type:String
+    routeObjName: {
+      type: String
     },
     // 结果集
     value: {
@@ -61,16 +61,16 @@ Component({
     dropType: null,
     dropCode: null,
     dropName: null,
-    itemName:'goodsList',
-    selectGoodsUrl:null,
+    itemName: 'goodsList',
+    selectGoodsUrl: null,
     form: {}
   },
   lifetimes: {
     attached: function () {
       // 销售订单
-      if(this.data.type == Constants.billType.sale){
+      if (this.data.type == Constants.billType.sale) {
         this.setData({
-          selectGoodsUrl:'/package-base-select/pages/select-goods/select-goods'
+          selectGoodsUrl: '/package-base-select/pages/select-goods/select-goods'
         })
       }
     },
@@ -85,26 +85,8 @@ Component({
      * @date : 2024/2/19 12:16
      */
     show: function () {
-      const location = chooseLocation.getLocation();
-      // console.log('loc', location);
-      let form = this.data.form
-      if (location) {
-        form['address'] = location;
-        // 如果有校验信息就清除掉
-        let card = this.data.card;
-        let index = this.data.index;
-        let contentObj = this.data.contentObj;
-        if (card && contentObj[card][index]?.errMsg) {
-          contentObj[card][index].errMsg = undefined;
-          this.setData({
-            contentObj: contentObj
-          })
-        }
-      }
-      this.setData({
-        value: JSON.stringify(form),
-        form: form
-      })
+      // 设置地址
+      this.setAddress();
     }
   },
   /**
@@ -118,7 +100,7 @@ Component({
      */
     open(e) {
       let item = e.currentTarget.dataset;
-      console.log('item',item);
+      console.log('item', item);
       if (item.item.type == 'drop') {
         this.setData({
           show: true,
@@ -132,13 +114,13 @@ Component({
         // 跳转链接
         if (item.item.urlKey) {
           let url = this.data.routeUrl[this.data.routeObjName][item.item.urlKey].url
-          if(url){
+          if (url) {
             wx.navigateTo({
               url: url,
               events: {
                 // 回调后
                 bindData: function (data) {
-                  
+
                 }
               },
               success: function (res) {
@@ -169,7 +151,7 @@ Component({
             let title = this.$t(item.title ? item.title : item.code)
             // 如果必须输入,就要进行判断
             if (item.required && !form[item.code]) {
-              item.errMsg = title + '为空'
+              item.errMsg = title + '为空'
               flag = false;
             }
           })
@@ -219,8 +201,24 @@ Component({
      * @author : 周兴
      * @date   : 2024/1/26 11:46
      */
-    openChooseItems(e){
-
+    openChooseItems(e) {
+      if (this.data.selectGoodsUrl) {
+        wx.navigateTo({
+          url: this.data.selectGoodsUrl,
+          events: {
+            // 回调后
+            bindData: function (data) {
+              console.log('data', data);
+              // 设置商品明细
+              this.setGoods(data);
+            }
+          },
+          success: function (res) {
+            // 通过eventChannel向被打开页面传送数据
+            res.eventChannel.emit('params', { choose: true })
+          }
+        })
+      }
     },
     /**
      * @desc   : 选择数据
@@ -359,6 +357,75 @@ Component({
       })
     },
     /**
+     * @desc : 设置地址
+     * @author : 周兴
+     * @date : 2024/1/19
+     */
+    setAddress() {
+      const location = chooseLocation.getLocation();
+      // console.log('loc', location);
+      let form = this.data.form
+      if (location) {
+        form['address'] = location;
+        // 如果有校验信息就清除掉
+        let card = this.data.card;
+        let index = this.data.index;
+        let contentObj = this.data.contentObj;
+        if (card && contentObj[card][index]?.errMsg) {
+          contentObj[card][index].errMsg = undefined;
+          this.setData({
+            contentObj: contentObj
+          })
+        }
+      }
+      this.setData({
+        value: JSON.stringify(form),
+        form: form
+      })
+    },
+    /**
+     * @desc : 设置商品
+     * @author : 周兴
+     * @date : 2024/1/19
+     */
+    setGoods(e) {
+      console.log('ttt3',e.data);
+      if (e.data && e.data.length > 0) {
+        let form = this.data.form
+        let goodsList = form[this.data.itemName] || []
+        e.data.forEach(it=>{
+          goodsList.push(it)
+        })
+        form[this.data.itemName] = goodsList
+        // 设置商品总单的金额信息 
+        if(this.data.type == Constants.billType.sale){
+          this.setGoodsAmount();
+        }
+        this.setData({
+          form: form,
+          value: JSON.stringify(form)
+        })
+        console.log('ff',this.data.form);
+      }
+    },
+    /**
+     * @desc : 设置商品明细金额相关信息 TODO 
+     * @author : 周兴
+     * @date : 2024/1/19
+     */
+    setGoodsAmount(){
+      let cardList = this.data.cardList
+      let index = cardList.findIndex(it => it.name == 'items');
+      cardList[index].sumStandard = 5000
+      cardList[index].discountStandard = 7.8
+      cardList[index].sumAmount = 10000
+      cardList[index].canUseCollect = 5000
+      cardList[index].useCollect = 5000
+      this.setData({
+        cardList:cardList
+      })
+    },
+    /**
      * @desc : 获取语言的方法
      * @author : 周兴
      * @date : 2024/1/19

+ 17 - 81
components/dkbase/dk-form-bill/dk-form-bill.wxml

@@ -26,7 +26,7 @@
     </view>
     <view wx:if="{{card.expandFlag && card.expand || !card.expandFlag}}">
       <!--明细card-->
-      <view wx:if="{{card.name == 'items'}}" wx:for="{{itemsCount}}" wx:key="indext">
+      <view wx:if="{{card.name == 'items'}}">
         <view wx:for="{{form[itemName]}}" data-item="{{item}}" wx:for-item="item" wx:key="index" border="{{ false }}">
           <van-swipe-cell right-width="{{ 65 }}" data-index="{{index}}" async-close bind:close="onCloseDel">
             <van-card>
@@ -37,9 +37,6 @@
                 <view style="display: flex;">
                   <dk-title titleTag="{{item.titleTag}}" title="{{item.title}}"></dk-title>
                 </view>
-                <view wx:if="{{item.skuSpecsFlag }}" style="text-align: right;width: 30%;">
-                  <dk-van-tag radius="10rpx" roundFlag="{{true}}" value="需设计" color="red"></dk-van-tag>
-                </view>
               </view>
               <view slot="desc" data-item="{{item}}" data-index="{{index}}" catchtap="openChoosedItemInfo">
                 <view style="display:flex;width: 100%;">
@@ -62,89 +59,28 @@
                   </view>
                 </view>
               </view>
-              <view slot="footer">
-                <view style="margin-top:19rpx;margin-bottom:19rpx;" wx:if="{{item.goodsSkuList.length > 0  || item.combinedList.length > 0}}">
-                  <view style="width: 100%;display: flex;font-size:12px;color: #95A8CB;">
-                    <view style="width: 50%;text-align: left;">
-                      明细
-                    </view>
-                    <view style="width: 50%;text-align: right;" data-item="{{item}}" data-index="{{index}}" catchtap="onChangeOpenGoodsList">
-                      {{item.packageDetailsFlag ? '收起' :'展开'}}
-                      <van-icon name="{{item.packageDetailsFlag ? 'arrow-up' :'arrow-down' }}" />
-                    </view>
-                  </view>
-                  <!--子件-->
-                  <view class="goods-class" wx:if="{{item.packageDetailsFlag}}">
-                    <view wx:for="{{item.goodsSkuList}}" data-item="{{item2}}" wx:for-index="index2" wx:for-item="item2" wx:key="index2">
-                      <view class="goods-item-class" wx:if="{{item2.hasChild == 0}}">
-                        <view>
-                          <van-image radius="15rpx" custom-class="goods-item-image" fit="fill" src="{{item2.iconThumPath}}" />
-                        </view>
-                        <view class="goods-item-tag">
-                          <view style="display: flex;justify-content: space-between;">
-                            <view class="{{((item2.replaceableSku && item2.replaceableSku.length > 0) || item2.cpFlgGift) ?'goods-item-title-replace':''}}">
-                              <dk-title titleTag="{{item2.titleTag}}" title="{{item2.skuModel ? item2.skuModel : item2.skuCode}}"></dk-title>
-                            </view>
-                            <view wx:if="{{item2.replaceableSku && item2.replaceableSku.length > 0}}">
-                              <dk-van-tag radius="10rpx" roundFlag="{{true}}" dataItem="{{item2}}" bind:tap="flag_bindtap" value="替换" color="red"></dk-van-tag>
-                            </view>
-
-                            <view style="padding-left: 3rpx;" wx:if="{{item2.promotionType != 2}}">
-                              <dk-van-tag radius="10rpx" roundFlag="{{true}}" dataItem="{{item2}}" dataItemIndex="{{index}}" dataItemIndex2="{{index2}}" bind:tap="deleteItem" value="删除" color="red"></dk-van-tag>
-                            </view>
-                          </view>
-                          <view style="width: 100%;display: flex;">
-                            <dk-text fontWeight="normal" value="{{item2.skuName}}"></dk-text>
-                          </view>
-
-                          <view style="padding-top: 8rpx; display: flex;">
-                            <view wx:if="{{item2.cpFlgGift}}">
-                              <dk-van-tag radius="10rpx" roundFlag="{{true}}" dataItem="{{item2}}" dataItemIndex="{{index}}" dataItemIndex2="{{index2}}" bind:tap="cpFlgGift_bindtap" value="赠品" color="#1B365D"></dk-van-tag>
-                            </view>
-                            <view wx:if="{{item2.flgAllowSpecsUndefine}}" style="padding-left: 8rpx;">
-                              <dk-van-tag radius="10rpx" roundFlag="{{true}}" dataItem="{{item2}}" dataItemIndex="{{index}}" dataItemIndex2="{{index2}}" bind:tap="flgAllowSpecsUndefine_bindtap" value="坑距" color="#1B365D"></dk-van-tag>
-                            </view>
-                          </view>
-
-                          <!--子级明细价格-->
-                          <view style="display: flex;width: 100%;flex-direction: row;">
-                            <view style="width: 90%;">
-                              <dk-cell contentFontSize="12" height="45rpx" fontWeight="bold" left="0rpx" contentColor="#CAA977" title="" content="{{ item2.priceSale}}"></dk-cell>
-                            </view>
-                            <view style="width: 10%">
-                              <dk-text fontWeight="nomal" color="#95A8CB" value="x {{item2.itemQuantity }}"></dk-text>
-                            </view>
-                          </view>
-                        </view>
-                      </view>
-                    </view>
-                  </view>
-                </view>
-
-                <view style="display: flex;width: 100%;margin-top:5px;align-items: center;" data-index="{{index}}" catchtap="openRemark">
-                  <view style="width: 100%;text-align: left;font-size:24rpx;color: #95A8CB;">
-                    <van-image width="19rpx" height="20rpx" src="/static/img/remerk-edit.png" />
-                    备注:<span style="line-height:56rpx;">{{item.remarks ? item.remarks : '请输入内容'}}</span>
-                  </view>
-                </view>
-                <view class="divide-class"></view>
-              </view>
             </van-card>
             <view slot="right">删除</view>
           </van-swipe-cell>
         </view>
+        <view class="amount-item-class" wx:if="{{type === 'sale'}}">
+          <!--标价总额-->
+          <dk-cell contentColor="#CAA977" titleColor="#95A8CB;" title="标价总额" content="{{card.sumStandard}}"></dk-cell>
+          <!--标价折扣-->
+          <dk-cell amount="{{false}}" contentColor="#CAA977" titleColor="#95A8CB;" title="标价折扣" content="{{card.discountStandard  +'折'}}"></dk-cell>
+        </view>
 
-        <!--合计金额-->
-        <view style="display:flex;padding-bottom:20rpx;">
-          <view style="width: 45%;">
-            <view style="padding-left: 30rpx;padding-top: 25rpx;">
-              <text class="dk-cell-title">{{form.categoryQuantity ? form.categoryQuantity : 0}}品类 共计{{form.sumQuantity ? form.sumQuantity : 0}}件</text>
-            </view>
-          </view>
+        <view class="amount-item-class">
+          <!--条数-->
+          <dk-cell titleColor="#95A8CB;" title="{{$t['together'] + form[itemName].length + $t['bill']}}" amount="{{false}}"></dk-cell>
+          <!--标价折扣-->
+          <dk-cell fontSize="16" fontWeight="bold" contentColor="#CAA977" titleColor="#1B365D;" title="合计金额" content="{{card.sumAmount}}"></dk-cell>
+        </view>
 
-          <view style="width: 55%;">
-            <dk-cell fontSize="16" fontWeight="bold" contentColor="#CAA977" titleColor="#1B365D;" title="合计金额" content="{{form.sumAmount}}"></dk-cell>
-          </view>
+        <view class="amount-item-class" wx:if="{{type === 'sale'}}">
+          <!--使用收款-->
+          <dk-cell contentColor="#95A8CB" titleColor="#95A8CB" title="使用收款(可用" tail=")" signSize="19" content="{{card.canUseCollect}}"></dk-cell>
+          <dk-cell contentColor="#CAA977" content="{{card.useCollect }}"></dk-cell>
         </view>
       </view>
       <!--非明细card-->

+ 14 - 8
components/dkbase/dk-form-bill/dk-form-bill.wxss

@@ -169,11 +169,17 @@
 
 
 .cell-value-staff-org {
-	overflow: hidden;
-	text-overflow: ellipsis;
-	white-space: nowrap;
-	text-align: center;
-	color: #1B365D !important;
-	font-size: 13px !important;
-	font-weight: bold !important;
-  }
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  text-align: center;
+  color: #1B365D !important;
+  font-size: 13px !important;
+  font-weight: bold !important;
+}
+
+.amount-item-class {
+  display: flex;
+  justify-content: space-between;
+  padding-right: 20rpx;
+}

+ 1 - 1
components/dkbase/dk-form/dk-form.wxml

@@ -22,7 +22,7 @@
       <!--联系电话-->
       <dk-number-phone-input wx:if="{{item.type=='phone'}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" labelClass="{{item.required?'red-label':'nomal-label' }}" rightIcon="phone" model:value="{{ form[item.code]}}" bind:changeField="changePhone" bind:changeFieldblur="changePhoneblur" errorMessage="{{item.errMsg}}" id="{{item.code}}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.code)}}"></dk-number-phone-input>
       <!--数字类-->
-      <dk-number-input wx:if="{{item.type=='number'}}" fontSize="14" left="30rpx" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" center="left" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" errorMessage="{{item.errMsg}}" titleValue="{{item.title?item.title:$t[item.code]}}" inputColor="#CAA977" titleFontWeight="bold" titleColor="{{item.required?'#E4002B':'#95A8CB'}}" inputValue="{{form[item.code]}}" bind:triggerBindValue="changeNumberField"></dk-number-input>
+      <dk-number-input wx:if="{{item.type=='number'}}" fontSize="14" left="30rpx" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" center="left" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" errorMessage="{{item.errMsg}}" titleValue="{{item.title?item.title:$t[item.code]}}" inputColor="#CAA977" titleFontWeight="{{item.required?'bold':'normal'}}" titleColor="{{item.required?'#E4002B':'#95A8CB'}}" inputValue="{{form[item.code]}}" bind:triggerBindValue="changeNumberField"></dk-number-input>
       <!--备注-->
       <van-field wx:if="{{item.type=='textarea'}}" type="textarea" label-class="{{item.required?'red-label':'nomal-label' }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.code]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" autosize border="{{ false }}" readonly="{{!!item.readonly}}" input-class="dk-cell-value-class" maxlength="{{item.maxlength?item.maxlength:500}}" right-icon="{{item.rightIcon}}" bind:change="changeField" errorMessage="{{item.errMsg}}">
       </van-field>

+ 1 - 1
components/dkbase/dk-title/dk-title.wxml

@@ -1,4 +1,4 @@
-<dk-tag class="vanTag" wx:if="{{titleTag && titleTag.length > 0}}" fontSize="{{fontSize + 'px'}}" style="position: absolute;" value="{{titleTag}}"></dk-tag>
+<dk-tag padding="0 8rpx" class="vanTag" wx:if="{{titleTag && titleTag.length > 0}}" fontSize="{{fontSize + 'px'}}" style="position: absolute;" value="{{titleTag}}"></dk-tag>
 <view class="title_class" style="--indent--:{{(indent && indent!= 0)?(indent + 'rpx'):((titleTag.length * fontSize + 2 + 12 ) * 2 + 'rpx') }};--height--:{{title.length == 0?'50rpx':'auto'}};color:#1B365D;  font-weight:bold; --titleFontSize--:{{titleFontSize}} ">
   {{title}}
 </view> 

+ 854 - 831
package-base-select/pages/select-goods/select-goods.js

@@ -15,852 +15,875 @@ const chooseGoodsCommon = require('../../../utils/chooseGoodsCommon.js');
 const app = getApp()
 Page({
 
-    /**
-     * 页面的初始数据
-     */
-    data: {
-        nonStandardListFlag: true,
-        skuloading: false,
-        specsId: undefined,
-        orderType: '',
-        followFlag: false, // 退换补标识
-        loading: false,
-        list: [],
-        pageInfo: {
-            pageSize: 10,
-            currentPage: 1
-        },
-        noMore: false,
-        choosedGoodsList: [], //已选商品列表
-        choosedGoodsListLength: 0,
-        goodsList: [], //商品列表
-        goodsSkuList: [], //SPU对应的SKU
-        //------------------------
-        sumGoodsAmount: '0', //合计金额
-        sumQuantity: '0', // 合计数量
-        categoryQuantity: 0, // 品类数
-
-        mainActiveIndex: 0,
-        numNum: 0,
-        sideKey: 0,
-        search: '',
-        noMore: false,
-        loading: false,
-        pageInfo: {
-            pageSize: 10,
-            currentPage: 1
-        },
-        active: 0,
-        specsActive: -1, // 个别分类
-        showAdd: false,
-        showChoosed: false,
-        showAllSpecs: false, // 是否显示商品分类
-        updateIndex: null,
-        skuData: [], // 根据spuId查询出的sku信息
-        defSkuId: 0, // 默认的skuId
-
-        // 商品分类
-        typeList: [{
-                name: "全部分类",
-                id: ''
-            },
-            {
-                name: "促销套餐",
-                id: 0
-            },
-        ],
-
-        // sku规格
-        skuSpecsList: [],
-        // 可用的sku规格
-        skuSpecsData: [],
-
-        // 坑距
-        formKG: [{
-            title: '',
-            tags: [],
-        }],
-
-
-        //单品促销
-        PricePromotionData: [],
-
-        tagList: [{
-                id: 1,
-                name: '原木柜'
-            },
-            {
-                id: 2,
-                name: '古典柜'
-            }, {
-                id: 3,
-                name: '金属柜'
-            }, {
-                id: 4,
-                name: '生态柜'
-            },
-            {
-                id: 0,
-                name: '更多'
-            },
-
-        ],
-        infoTypeFlag: false,
-        infoTypeFlag1: false,
-
-        show_spec: false,
-        show_glassParameters: false,
-    },
-
-
-
-    changeTag(e) {
-        this.setData({
-            active: e.detail.index
-        })
-    },
-
-
-
-    /**
-     * 允许从相机和相册扫码
-     * @param {*} e 
-     */
-    scanQRCode(e) {
-        // 允许从相机和相册扫码
-        wx.scanCode({
-            success(res) {
-                let scancode = res.result
-                // 调转商品选品
-                wx.navigateTo({
-                    url: '../choose-goods/choose-goods?searchText=' + scancode.length > 14 ? scancode.substring(0, 14) : scancode,
-                })
-            }
-        })
-    },
-    /**
-     * @desc : 改变标识
-     * @author : 周兴
-     * @date : 2022/8/6 17:16
-     */
-    changeAllReadyCheckBox(e) {
-        chooseGoodsCommon.changeAllReadyCheckBoxCommon(e, this)
-    },
-
-    /**
-     * @desc : 分类切换
-     * @author : 于继渤
-     * @date : 2022/5/26 20:16
-     */
-    changeSidebar(e) {
-        let id = this.data.typeList[e.detail].id
-        if (id == "" && typeof (id) != 'number') {
-            this.setData({
-                sideKey: null,
-                specsId: null
-            })
-        } else {
-            this.setData({
-                sideKey: e.detail,
-                specsId: id
-            })
-        }
-        this.setData({
-            searchText: ''
-        })
-        // 查询
-        this.doSearch()
-    },
-
-    /**
-     * @desc : 打开商品
-     * @author : 周兴
-     * @date : 2022/7/2 20:16
-     */
-    openAddItemInfo(e) {
-        //  chooseGoodsCommon.openAddItemInfoCommon(e, this, 'choose-goods')
-        let item = e.currentTarget.dataset.item
-        this.setData({
-            currentChoosedItem: item,
-            showAdd: true,
-            show1: true,
-            show2: false,
-            show3: false,
-            show4: false,
-            show5: false
-        })
-
-    },
-    /**
-     * 关闭产品
-     * @param {*} e 
-     */
-    closeAddItemInfo() {
-        chooseGoodsCommon.closeAddItemInfoCommon(this)
-    },
-    /**
-     * @desc : 打开选择明细
-     * @author : 周兴
-     * @date : 2022/7/4 20:16
-     */
-    openChoosedItemInfo(e) {
-        chooseGoodsCommon.openChoosedItemInfoCommon(e, this)
-    },
-    /**
-     * @desc : 删除选中的数据
-     * @author : 周兴
-     * @date : 2022/7/4 20:16
-     */
-    delChoosedGoodsItem(e) {
-        chooseGoodsCommon.delChoosedGoodsItemCommon(e, this, false)
-
-        let choosedGoodsListLength = this.data.choosedGoodsListLength
-        if (choosedGoodsListLength == 0) {
-            wx.disableAlertBeforeUnload({
-                success: (e) => {
-
-                },
-                fail: (e) => {
-
-                }
-            })
-        }
-
-
-    },
-    /**
-     * @desc : 确定
-     * @date : 2022/7/5 16:49
-     * @author : 周兴
-     */
-    submit() {
-        let choosedGoodsList = this.data.choosedGoodsList
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    nonStandardListFlag: true,
+    skuloading: false,
+    specsId: undefined,
+    orderType: '',
+    followFlag: false, // 退换补标识
+    loading: false,
+    list: [],
+    pageInfo: {
+      pageSize: 10,
+      currentPage: 1
+    },
+    noMore: false,
+    choosedGoodsList: [], //已选商品列表
+    choosedGoodsListLength: 0,
+    goodsList: [], //商品列表
+    goodsSkuList: [], //SPU对应的SKU
+    //------------------------
+    sumGoodsAmount: '0', //合计金额
+    sumQuantity: '0', // 合计数量
+    categoryQuantity: 0, // 品类数
+
+    mainActiveIndex: 0,
+    numNum: 0,
+    sideKey: 0,
+    search: '',
+    noMore: false,
+    loading: false,
+    pageInfo: {
+      pageSize: 10,
+      currentPage: 1
+    },
+    active: 0,
+    specsActive: -1, // 个别分类
+    showAdd: false,
+    showChoosed: false,
+    showAllSpecs: false, // 是否显示商品分类
+    updateIndex: null,
+    skuData: [], // 根据spuId查询出的sku信息
+    defSkuId: 0, // 默认的skuId
+
+    // 商品分类
+    typeList: [{
+      name: "全部分类",
+      id: ''
+    },
+    {
+      name: "促销套餐",
+      id: 0
+    },
+    ],
+
+    // sku规格
+    skuSpecsList: [],
+    // 可用的sku规格
+    skuSpecsData: [],
+
+    // 坑距
+    formKG: [{
+      title: '',
+      tags: [],
+    }],
+
+
+    //单品促销
+    PricePromotionData: [],
+
+    tagList: [{
+      id: 1,
+      name: '原木柜'
+    },
+    {
+      id: 2,
+      name: '古典柜'
+    }, {
+      id: 3,
+      name: '金属柜'
+    }, {
+      id: 4,
+      name: '生态柜'
+    },
+    {
+      id: 0,
+      name: '更多'
+    },
+
+    ],
+    infoTypeFlag: false,
+    infoTypeFlag1: false,
+
+    show_spec: false,
+    show_glassParameters: false,
+  },
+
+
+
+  changeTag(e) {
+    this.setData({
+      active: e.detail.index
+    })
+  },
+
+
+
+  /**
+   * 允许从相机和相册扫码
+   * @param {*} e 
+   */
+  scanQRCode(e) {
+    // 允许从相机和相册扫码
+    wx.scanCode({
+      success(res) {
+        let scancode = res.result
+        // 调转商品选品
         wx.navigateTo({
-            url: '../order-billing/add/add?choosedGoodsList='   + encodeURIComponent(JSON.stringify(choosedGoodsList))  ,
-        })
-    },
-    /**
-     * @desc : 查询
-     * @date : 2022/5/12 16:49
-     * @author : 于继渤
-     */
-    doSearch() {
-        let pageInfo = this.data.pageInfo;
-        pageInfo.pageSize = 10;
-        pageInfo.currentPage = 1;
-        this.setData({
-            show: false,
-            noMore: false,
-            pageInfo: pageInfo,
-            list: [],
-            goodsList: []
-        })
-        this.getData()
-    },
-
-    onSearchText(e) {
-        this.setData({
-            searchText: e.detail,
-            sideKey: 0,
-            specsId: null
-        })
-    },
-
-    /**
-     * @desc : 获取商品数据
-     * @date : 2022/5/13 16:49
-     * @author : 于继渤
-     */
-    getData(e) {
-
-
-        let tList = [{
-            activityId: 84,
-            activityName: "零售活动方案",
-            desc: "零售活动方案",
-            id: "d2f69c53-a5ba-4414-86ee-3b05849cb882",
-            orderItemQuantity: 1,
-            pathType: 1,
-            pricePromotion: 70000,
-            priceSale: 70000,
-            promotionId: 283,
-            promotionName: "套餐相同商品",
-            promotionPriceType: -2,
-            promotionPriceTypeName: "正价产品",
-            promotionType: 2,
-            promotionTypeName: "组合促销",
-            seq: 1,
-            spuModel: "套餐相同商品",
-            standardId: 308,
-            title: "套餐相同商品",
-            titleTag: "组合促销"
-        }, {
-            activityId: 84,
-            activityName: "零售活动方案",
-            desc: "零售活动方案",
-            id: "f911da02-2b9a-400c-813b-8007bf994856",
-            orderItemQuantity: 1,
-            pathType: 1,
-            pricePromotion: 8600,
-            priceSale: 8600,
-            promotionId: 273,
-            promotionName: "1115新活动",
-            promotionPriceType: -2,
-            promotionPriceTypeName: "正价产品",
-            promotionType: 2,
-            promotionTypeName: "组合促销",
-            seq: 2,
-            spuModel: "1115新活动",
-            standardId: 308,
-            title: "1115新活动",
-            titleTag: "组合促销"
-        }, {
-            activityId: 84,
-            activityName: "零售活动方案",
-            desc: "零售活动方案",
-            id: "a2708ff8-4032-40a2-8823-5176a0e92b84",
-            orderItemQuantity: 1,
-            pathType: 1,
-            pricePromotion: 13000,
-            priceSale: 13000,
-            promotionId: 271,
-            promotionName: "零售套餐001",
-            promotionPriceType: -2,
-            promotionPriceTypeName: "正价产品",
-            promotionType: 2,
-            promotionTypeName: "组合促销",
-            seq: 3,
-            spuModel: "零售套餐001",
-            standardId: 308,
-            title: "零售套餐001",
-            titleTag: "组合促销"
-        }];
-
-        this.setData({
-            list: tList,
-            goodsList: tList
+          url: '../choose-goods/choose-goods?searchText=' + scancode.length > 14 ? scancode.substring(0, 14) : scancode,
         })
+      }
+    })
+  },
+  /**
+   * @desc : 改变标识
+   * @author : 周兴
+   * @date : 2022/8/6 17:16
+   */
+  changeAllReadyCheckBox(e) {
+    chooseGoodsCommon.changeAllReadyCheckBoxCommon(e, this)
+  },
+
+  /**
+   * @desc : 分类切换
+   * @author : 于继渤
+   * @date : 2022/5/26 20:16
+   */
+  changeSidebar(e) {
+    let id = this.data.typeList[e.detail].id
+    if (id == "" && typeof (id) != 'number') {
+      this.setData({
+        sideKey: null,
+        specsId: null
+      })
+    } else {
+      this.setData({
+        sideKey: e.detail,
+        specsId: id
+      })
+    }
+    this.setData({
+      searchText: ''
+    })
+    // 查询
+    this.doSearch()
+  },
+
+  /**
+   * @desc : 打开商品
+   * @author : 周兴
+   * @date : 2022/7/2 20:16
+   */
+  openAddItemInfo(e) {
+    //  chooseGoodsCommon.openAddItemInfoCommon(e, this, 'choose-goods')
+    let item = e.currentTarget.dataset.item
+    this.setData({
+      currentChoosedItem: item,
+      showAdd: true,
+      show1: true,
+      show2: false,
+      show3: false,
+      show4: false,
+      show5: false
+    })
+
+  },
+  /**
+   * 关闭产品
+   * @param {*} e 
+   */
+  closeAddItemInfo() {
+    chooseGoodsCommon.closeAddItemInfoCommon(this)
+  },
+  /**
+   * @desc : 打开选择明细
+   * @author : 周兴
+   * @date : 2022/7/4 20:16
+   */
+  openChoosedItemInfo(e) {
+    chooseGoodsCommon.openChoosedItemInfoCommon(e, this)
+  },
+  /**
+   * @desc : 删除选中的数据
+   * @author : 周兴
+   * @date : 2022/7/4 20:16
+   */
+  delChoosedGoodsItem(e) {
+    chooseGoodsCommon.delChoosedGoodsItemCommon(e, this, false)
+
+    let choosedGoodsListLength = this.data.choosedGoodsListLength
+    if (choosedGoodsListLength == 0) {
+      wx.disableAlertBeforeUnload({
+        success: (e) => {
 
-    },
-    /**
-     * 数量的变化事件
-     * @param {*} e 
-     */
-    changeAllreadyChooseQuantityPop(e) {
-        let currentChoosedItem = this.data.currentChoosedItem
-        currentChoosedItem.itemQuantity = e.detail
-        if (currentChoosedItem.nonStandardArea) {
-            currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity * currentChoosedItem.nonStandardArea).toFixed(2)
-            currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
-        } else {
-            currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity).toFixed(2)
-            currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
-        }
-
-        this.setData({
-            currentChoosedItem: currentChoosedItem
-        })
-    },
-    /**
-     * @desc : 生命周期函数--监听页面加载
-     * @date : 2022/5/13 16:49
-     * @author : 于继渤
-     */
-    onLoad: function (options) {
-
-        let that = this
-        // 调用监听器,监听数据变化
-        this.watch(this.data, {
-            choosedGoodsListLength: function (newVal) {
-
-                if (newVal != 0) {
-                    that.BeaforeUnLoad()
-                    console.log('调用监听器,监听数据变化')
-                }
-            }
-        })
-        if (options.customerId) {
-            this.setData({
-                customerId: parseInt(options.customerId)
-            })
-        }
-        if (options.orgId) {
-            this.setData({
-                orgId: parseInt(options.orgId)
-            })
-        }
-
-        let _this = this;
-        wx.getSystemInfo({
-            success: function (res) {
-                _this.setData({
-                    windowHeight: res.windowHeight,
-                    windowWidth: res.windowWidth
-                })
-            }
-        })
-        //设置来源
-        if (options.orderType) {
-            this.setData({
-                orderType: options.orderType
-            })
-        }
-        // 是否是退换补单(退换补单按照实际量进行处理)
-        if (options.followFlag) {
-            this.setData({
-                followFlag: options.followFlag,
-                orgId: Number(options.orgId)
-            })
-        }
-        //预算报价客户信息
-        if (options.customerItem) {
-            this.setData({
-                customerItem: JSON.parse(decodeURIComponent(options.customerItem))
-            })
-        }
-        //扫码搜索
-        if (options.searchText) {
-            this.setData({
-                searchText: options.searchText
-            })
-        }
-        //哪个界面 进来的
-        if (options.page) {
-            this.setData({
-                page: options.page
-            })
-        }
-        //执行查询
-        this.doSearch()
-        this.getGoodsClassification()
-    },
-    /**
-     * @desc : 清空default
-     * @date : 2022/7/4 16:49
-     * @author : 周兴
-     */
-    clearDefault() {
-        chooseGoodsCommon.clearDefaultCommon(this);
-    },
-
-    /**
-     * @desc : 加载商品分类
-     * @date : 2022/5/15 16:49
-     * @author : 于继渤
-     */
-    getGoodsClassification() {
-       
-
-                let typeList = [{
-                        id: null,
-                        name: "全部分类"
-                    },
-                    {
-                        id: 0,
-                        name: "促销套餐"
-                    },
-                    {
-                        id: 64,
-                        name: "智能马桶"
-                    },
-                    {
-                        id: 96,
-                        name: "坐便器"
-                    },
-                    {
-                        id: 138,
-                        name: "电控坐便器"
-                    },
-                    {
-                        id: 79,
-                        name: "蹲便器"
-                    },
-                    {
-                        id: 104,
-                        name: "小便器"
-                    },
-                    {
-                        id: 105,
-                        name: "洗面器"
-                    },
-                    {
-                        id: 93,
-                        name: "其它陶瓷"
-                    },
-                    {
-                        id: 66,
-                        name: "浴室柜"
-                    },
-                ]
-
-                this.setData({
-                    typeList: typeList
-                })
-        
-    },
-    /**
-     * @desc : 选择数据
-     * @date : 2022/7/4 16:49
-     * @author : 周兴
-     */
-    chooseSkuInfo() {
-
-        let currentChoosedItemTemp = {
-            ...this.data.currentChoosedItem
-        }
-        let choosedGoodsList = this.data.choosedGoodsList
-        choosedGoodsList.push(currentChoosedItemTemp)
-        this.setData({
-            choosedGoodsList,
-            showAdd:false
-        })
-
-    },
-    /**
-     * @desc : 已选商品更改数量计算合计
-     * @date : 2022/7/4 16:49
-     * @author : 周兴
-     */
-    changeAllreadyChooseQuantity(e) {
-        let choosedGoodsList = this.data.choosedGoodsList
-        let index = e.currentTarget.dataset.index
-
-        choosedGoodsList[index].itemQuantity = e.detail ? Number(e.detail) : 0
-        choosedGoodsList[index].itemAmount = Number(choosedGoodsList[index].priceSale * choosedGoodsList[index].itemQuantity)
-        this.setData({
-            choosedGoodsList: choosedGoodsList,
-        })
-        // 计算合计金额
-        chooseGoodsCommon.getSumAmount(this);
-    },
-
-    /**
-     * @desc : 标价折扣输入事件
-     * @author : 于继渤
-     * @date : 2022/5/31 17:16
-     */
-    changeDiscountStandardField(e) {
-        let currentChoosedItem = this.data.currentChoosedItem
-        currentChoosedItem.discountStandard = e.detail
-        this.setData({
-            currentChoosedItem: currentChoosedItem
-        })
-    },
-    /**
-     * @desc : 销售价格编辑
-     * @author : 常皓宁
-     * @date : 2022/5/31 14:45
-     */
-    changeSalesPriceField(e) {
-        let priceSale = e.detail.value;
-        //优惠卷(标价负数)
-        if (this.data.currentChoosedItem.priceStandard < 0 || this.data.currentChoosedItem.pricePromotion < 0) {
-            priceSale = Number(0 - e.detail.value)
-        }
-
-
-        chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, false)
-    },
-    /**
-     * @desc : 修改销售价格
-     * @author : 周兴
-     * @date : 2022/7/6 14:45
-     */
-    changeSalesPrice(priceSale) {
-        chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, true)
-    },
-    /**
-     * @desc : 修改销售金额
-     * @author : 周兴
-     * @date : 2022/7/4 14:45
-     */
-    changeItemAmountField(e) {
-        chooseGoodsCommon.changeItemAmountFieldCommon(e, this)
-    },
-
-    /**
-     * @desc : 切换sku商品规格
-     * @author : 周兴
-     * @date : 2022/6/1 10:16
-     */
-    changeSkuSpecs(e) {
-        chooseGoodsCommon.changeSkuSpecsCommon(e, this);
-    },
-
-
-    /**
-     * @desc : 主柜规格单选
-     * @author : 于继渤
-     * @date : 2022/6/02 16:16
-     */
-    clickZGGG(e) {
-        let itemt = e.target.dataset.itemt;
-        let pindex = e.target.dataset.pindex;
-        let indext = e.target.dataset.indext;
-        let formZGGG = this.data.formZGGG
-        let infotype = formZGGG[pindex].tags[indext].infotype
-
-        infotype = 'default'
-        formZGGG[pindex].tags.forEach(res => {
-            res.infotype = 'default'
-        })
+        },
+        fail: (e) => {
 
-        if (infotype == 'default') {
-            infotype = 'info'
-        } else {
-            infotype = 'default'
         }
+      })
+    }
 
-        formZGGG[pindex].tags[indext].infotype = infotype
-        this.setData({
-            formZGGG
-        })
-    },
-
-
-    /**
-     * @desc : 定制品单选
-     * @author : 于继渤
-     * @date : 2022/6/02 16:16
-     */
-    clickDZP(e) {
-        let itemt = e.target.dataset.itemt;
-        let pindex = e.target.dataset.pindex;
-        let indext = e.target.dataset.indext;
-        let formDZP = this.data.formDZP
-        let infotype = formDZP[pindex].tags[indext].infotype
-
-        infotype = 'default'
-        formDZP[pindex].tags.forEach(res => {
-            res.infotype = 'default'
-        })
 
-        if (infotype == 'default') {
-            infotype = 'info'
-        } else {
-            infotype = 'default'
+  },
+  /**
+   * @desc : 确定
+   * @date : 2022/7/5 16:49
+   * @author : 周兴
+   */
+  submit() {
+    let choosedGoodsList = this.data.choosedGoodsList
+    // wx.navigateTo({
+    //     url: '../order-billing/add/add?choosedGoodsList='   + encodeURIComponent(JSON.stringify(choosedGoodsList))  ,
+    // })
+    const eventChannel = this.getOpenerEventChannel();
+    let url = null;
+    // 接收父页面传递的参数
+    eventChannel.on('params', function (data) {
+      console.log('d',data);
+      url = data.url
+    })
+    // 从开单界面打开
+    if(!url){
+      eventChannel.emit('bindData',choosedGoodsList)
+      wx.navigateBack({
+        delta: 1
+      })
+    }else{
+      // 开单直接打开
+      wx.navigateTo({
+        url: url,
+        success: function (res) {
+          // 通过eventChannel向被打开页面传送数据
+          console.log('bbbb3',choosedGoodsList);
+          res.eventChannel.emit('params', { data: choosedGoodsList })
         }
+      })
+    }
+  },
+  /**
+   * @desc : 查询
+   * @date : 2022/5/12 16:49
+   * @author : 于继渤
+   */
+  doSearch() {
+    let pageInfo = this.data.pageInfo;
+    pageInfo.pageSize = 10;
+    pageInfo.currentPage = 1;
+    this.setData({
+      show: false,
+      noMore: false,
+      pageInfo: pageInfo,
+      list: [],
+      goodsList: []
+    })
+    this.getData()
+  },
+
+  onSearchText(e) {
+    this.setData({
+      searchText: e.detail,
+      sideKey: 0,
+      specsId: null
+    })
+  },
+
+  /**
+   * @desc : 获取商品数据
+   * @date : 2022/5/13 16:49
+   * @author : 于继渤
+   */
+  getData(e) {
+
+
+    let tList = [{
+      activityId: 84,
+      activityName: "零售活动方案",
+      desc: "零售活动方案",
+      id: "d2f69c53-a5ba-4414-86ee-3b05849cb882",
+      orderItemQuantity: 1,
+      pathType: 1,
+      pricePromotion: 70000,
+      priceSale: 70000,
+      promotionId: 283,
+      promotionName: "套餐相同商品",
+      promotionPriceType: -2,
+      promotionPriceTypeName: "正价产品",
+      promotionType: 2,
+      promotionTypeName: "组合促销",
+      seq: 1,
+      spuModel: "套餐相同商品",
+      standardId: 308,
+      title: "套餐相同商品",
+      titleTag: "组合促销"
+    }, {
+      activityId: 84,
+      activityName: "零售活动方案",
+      desc: "零售活动方案",
+      id: "f911da02-2b9a-400c-813b-8007bf994856",
+      orderItemQuantity: 1,
+      pathType: 1,
+      pricePromotion: 8600,
+      priceSale: 8600,
+      promotionId: 273,
+      promotionName: "1115新活动",
+      promotionPriceType: -2,
+      promotionPriceTypeName: "正价产品",
+      promotionType: 2,
+      promotionTypeName: "组合促销",
+      seq: 2,
+      spuModel: "1115新活动",
+      standardId: 308,
+      title: "1115新活动",
+      titleTag: "组合促销"
+    }, {
+      activityId: 84,
+      activityName: "零售活动方案",
+      desc: "零售活动方案",
+      id: "a2708ff8-4032-40a2-8823-5176a0e92b84",
+      orderItemQuantity: 1,
+      pathType: 1,
+      pricePromotion: 13000,
+      priceSale: 13000,
+      promotionId: 271,
+      promotionName: "零售套餐001",
+      promotionPriceType: -2,
+      promotionPriceTypeName: "正价产品",
+      promotionType: 2,
+      promotionTypeName: "组合促销",
+      seq: 3,
+      spuModel: "零售套餐001",
+      standardId: 308,
+      title: "零售套餐001",
+      titleTag: "组合促销"
+    }];
+
+    this.setData({
+      list: tList,
+      goodsList: tList
+    })
+
+  },
+  /**
+   * 数量的变化事件
+   * @param {*} e 
+   */
+  changeAllreadyChooseQuantityPop(e) {
+    let currentChoosedItem = this.data.currentChoosedItem
+    currentChoosedItem.itemQuantity = e.detail
+    if (currentChoosedItem.nonStandardArea) {
+      currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity * currentChoosedItem.nonStandardArea).toFixed(2)
+      currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
+    } else {
+      currentChoosedItem.itemAmount = Number(currentChoosedItem.priceSale * currentChoosedItem.itemQuantity).toFixed(2)
+      currentChoosedItem.itemAmount = isNaN(currentChoosedItem.itemAmount) ? 0 : currentChoosedItem.itemAmount
+    }
 
-        formDZP[pindex].tags[indext].infotype = infotype
-        this.setData({
-            formDZP
-        })
-    },
-    /**
-     * @desc : 切换组合促销明细
-     * @date : 2022/7/5 16:49
-     * @author : 周兴
-     */
-    changeCombinedItem(e) {
-        chooseGoodsCommon.changeCombinedItemCommon(e, this)
-    },
-
-    /**
-     * @desc : 单品促销单选
-     * @author : 于继渤
-     * @date : 2022/6/02 16:16
-     */
-    clickDP(e) {
-        chooseGoodsCommon.clickDPCommon(e, this)
-    },
-
-
-    /**
-     * @desc : 使用位置相关事件
-     * @author : 于继渤
-     * @date : 2022/5/26 12:16
-     */
-    changeUseLocation(e) {
-        let currentChoosedItem = this.data.currentChoosedItem
-        currentChoosedItem.usedLocation = e.detail
-        this.setData({
-            currentChoosedItem: currentChoosedItem
-        })
-    },
-    /**
-     * @desc : 点击全部分类
-     * @date : 2022/7/8 16:49
-     * @author : 周兴
-     */
-    clickAllSpecs() {
-        // 让其他分类的标识置为-1
-        this.setData({
-            specsActive: -1,
-            specsId: null
-        })
-        // 查询数据
-        this.doSearch()
-    },
-    /**
-     * @desc : 点击全部单个分类
-     * @date : 2022/7/8 16:49
-     * @author : 周兴
-     */
-    changeSpecsTabs(e) {
-        let index = e.detail.index;
-        this.setData({
-            specsActive: index,
-        })
-        let id = this.data.typeList[index].id
-        this.setData({
-            specsId: id
-        })
-        // 查询数据
-        this.doSearch()
-    },
-    /**
-     * @desc : 是否显示商品分类页面
-     * @date : 2022/7/9 16:49
-     * @author : 周兴
-     */
-    displayAllSpecs() {
-        this.setData({
-            showAllSpecs: true
-        })
-    },
-    /**
-     * @desc : 页面上拉触底事件的处理函数
-     * @author : 周兴
-     * @date : 2022/8/1 12:16
-     */
-    scrollToLower() {
-        if (this.data.loading || this.data.noMore) {
-            return;
-        }
-        this.setData({
-            pageInfo: {
-                pageSize: this.data.pageInfo.pageSize,
-                currentPage: this.data.pageInfo.currentPage + 1
-            }
-        })
-        this.getData('more')
-    },
-    /**
-     * @desc : 页面上拉触底事件的处理函数
-     * @author : 于继渤
-     * @date : 2022/5/24 12:16
-     */
-    onReachBottom: function () {
-
-        if (this.data.loading || this.data.noMore || this.data.active == 1) {
-            return;
+    this.setData({
+      currentChoosedItem: currentChoosedItem
+    })
+  },
+  /**
+   * @desc : 生命周期函数--监听页面加载
+   * @date : 2022/5/13 16:49
+   * @author : 于继渤
+   */
+  onLoad: function (options) {
+    let that = this
+    // 调用监听器,监听数据变化
+    this.watch(this.data, {
+      choosedGoodsListLength: function (newVal) {
+
+        if (newVal != 0) {
+          that.BeaforeUnLoad()
+          console.log('调用监听器,监听数据变化')
         }
-        this.setData({
-            pageInfo: {
-                pageSize: this.data.pageInfo.pageSize,
-                currentPage: this.data.pageInfo.currentPage + 1
-            }
-        })
-        this.getData('more')
-    },
-
-    BeaforeUnLoad() {
-        wx.enableAlertBeforeUnload({
-            message: '离开此页后已选商品将会被清空哦',
-            success: (e) => {
-                wx.setStorageSync('choosedGoodsList', [])
-
-            },
-            fail: (e) => {
-
-            }
-        })
-    },
-
-    // 设置监听器
-    watch: function (ctx, obj) {
-        Object.keys(obj).forEach(key => {
-
-            this.observer(ctx, key, ctx[key], function (value) {
-                obj[key].call(ctx, value)
-            })
-        })
-    },
-    // 监听属性,并执行监听函数
-    observer: function (data, key, val, fn) {
-        Object.defineProperty(data, key, {
-            configurable: true,
-            enumerable: true,
-            get: function () {
-                return val
-            },
-            set: function (newVal) {
-                if (newVal === val) return
-                fn && fn(newVal)
-                val = newVal
-            },
-        })
-    },
-    /**
-     * @desc : 选择非标参数事件
-     * @author : 于继渤
-     * @date : 2022/8/24 13:16
-     */
-    nonStandardTap(e) {
-        chooseGoodsCommon.nonStandardTap(e, this)
-    },
-    /**
-     * @desc : 设置非标匹配参数
-     * @author : 于继渤
-     * @date : 2022/8/24 13:16
-     */
-    setNonStandardMatchingParameters() {
-        chooseGoodsCommon.setNonStandardMatchingParameters(e, this)
-    },
-    /**
-     * @desc : 非标商品选择事件
-     * @author : 于继渤
-     * @date : 2022/8/24 13:16
-     */
-    nonGlassSpuItemsTap(e) {
-        chooseGoodsCommon.nonGlassSpuItemsTap(e, this)
-    },
-
-    /**
-     * @desc : 非标商品非标参数输入事件
-     * @author : 于继渤
-     * @date : 2022/8/24 13:16
-     */
-    bindInputIsScopeOne(e) {
-        chooseGoodsCommon.bindInputIsScopeOne(e, this)
-    },
-    bindBlurIsScopeOne(e) {
-        chooseGoodsCommon.bindBlurIsScopeOne(e, this)
-    },
-    changeFlgAllowSpecsUndefine(e) {
+      }
+    })
+    if (options.customerId) {
+      this.setData({
+        customerId: parseInt(options.customerId)
+      })
+    }
+    if (options.orgId) {
+      this.setData({
+        orgId: parseInt(options.orgId)
+      })
+    }
 
-        let currentChoosedItem = this.data.currentChoosedItem
-        currentChoosedItem.flgSpecsUndefine = e.detail
-        this.setData({
-            currentChoosedItem: currentChoosedItem
+    let _this = this;
+    wx.getSystemInfo({
+      success: function (res) {
+        _this.setData({
+          windowHeight: res.windowHeight,
+          windowWidth: res.windowWidth
         })
-    },
-
-
-    bindInputNonStantardArea(e) {
-
-        chooseGoodsCommon.bindInputNonStantardArea(e, this)
-    },
-    //面积离焦
-    bindBlurNonStantardArea(e) {
+      }
+    })
+    //设置来源
+    if (options.orderType) {
+      this.setData({
+        orderType: options.orderType
+      })
+    }
+    // 是否是退换补单(退换补单按照实际量进行处理)
+    if (options.followFlag) {
+      this.setData({
+        followFlag: options.followFlag,
+        orgId: Number(options.orgId)
+      })
+    }
+    //预算报价客户信息
+    if (options.customerItem) {
+      this.setData({
+        customerItem: JSON.parse(decodeURIComponent(options.customerItem))
+      })
+    }
+    //扫码搜索
+    if (options.searchText) {
+      this.setData({
+        searchText: options.searchText
+      })
+    }
+    //哪个界面 进来的
+    if (options.page) {
+      this.setData({
+        page: options.page
+      })
+    }
+    //执行查询
+    this.doSearch()
+    this.getGoodsClassification()
+  },
+  /**
+   * @desc : 清空default
+   * @date : 2022/7/4 16:49
+   * @author : 周兴
+   */
+  clearDefault() {
+    chooseGoodsCommon.clearDefaultCommon(this);
+  },
+
+  /**
+   * @desc : 加载商品分类
+   * @date : 2022/5/15 16:49
+   * @author : 于继渤
+   */
+  getGoodsClassification() {
+
+
+    let typeList = [{
+      id: null,
+      name: "全部分类"
+    },
+    {
+      id: 0,
+      name: "促销套餐"
+    },
+    {
+      id: 64,
+      name: "智能马桶"
+    },
+    {
+      id: 96,
+      name: "坐便器"
+    },
+    {
+      id: 138,
+      name: "电控坐便器"
+    },
+    {
+      id: 79,
+      name: "蹲便器"
+    },
+    {
+      id: 104,
+      name: "小便器"
+    },
+    {
+      id: 105,
+      name: "洗面器"
+    },
+    {
+      id: 93,
+      name: "其它陶瓷"
+    },
+    {
+      id: 66,
+      name: "浴室柜"
+    },
+    ]
+
+    this.setData({
+      typeList: typeList
+    })
+
+  },
+  /**
+   * @desc : 选择数据
+   * @date : 2022/7/4 16:49
+   * @author : 周兴
+   */
+  chooseSkuInfo() {
+
+    let currentChoosedItemTemp = {
+      ...this.data.currentChoosedItem
+    }
+    let choosedGoodsList = this.data.choosedGoodsList
+    choosedGoodsList.push(currentChoosedItemTemp)
+    this.setData({
+      choosedGoodsList,
+      showAdd: false
+    })
+
+  },
+  /**
+   * @desc : 已选商品更改数量计算合计
+   * @date : 2022/7/4 16:49
+   * @author : 周兴
+   */
+  changeAllreadyChooseQuantity(e) {
+    let choosedGoodsList = this.data.choosedGoodsList
+    let index = e.currentTarget.dataset.index
+
+    choosedGoodsList[index].itemQuantity = e.detail ? Number(e.detail) : 0
+    choosedGoodsList[index].itemAmount = Number(choosedGoodsList[index].priceSale * choosedGoodsList[index].itemQuantity)
+    this.setData({
+      choosedGoodsList: choosedGoodsList,
+    })
+    // 计算合计金额
+    chooseGoodsCommon.getSumAmount(this);
+  },
+
+  /**
+   * @desc : 标价折扣输入事件
+   * @author : 于继渤
+   * @date : 2022/5/31 17:16
+   */
+  changeDiscountStandardField(e) {
+    let currentChoosedItem = this.data.currentChoosedItem
+    currentChoosedItem.discountStandard = e.detail
+    this.setData({
+      currentChoosedItem: currentChoosedItem
+    })
+  },
+  /**
+   * @desc : 销售价格编辑
+   * @author : 常皓宁
+   * @date : 2022/5/31 14:45
+   */
+  changeSalesPriceField(e) {
+    let priceSale = e.detail.value;
+    //优惠卷(标价负数)
+    if (this.data.currentChoosedItem.priceStandard < 0 || this.data.currentChoosedItem.pricePromotion < 0) {
+      priceSale = Number(0 - e.detail.value)
+    }
 
-        chooseGoodsCommon.bindBlurNonStantardArea(e, this)
-    },
-    onUnload() {
 
-        Dialog.confirm({
-            message: '哈哈哈哈哈哈',
-        }).then(() => {
+    chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, false)
+  },
+  /**
+   * @desc : 修改销售价格
+   * @author : 周兴
+   * @date : 2022/7/6 14:45
+   */
+  changeSalesPrice(priceSale) {
+    chooseGoodsCommon.changeSalesPriceCommon(priceSale, this, true)
+  },
+  /**
+   * @desc : 修改销售金额
+   * @author : 周兴
+   * @date : 2022/7/4 14:45
+   */
+  changeItemAmountField(e) {
+    chooseGoodsCommon.changeItemAmountFieldCommon(e, this)
+  },
+
+  /**
+   * @desc : 切换sku商品规格
+   * @author : 周兴
+   * @date : 2022/6/1 10:16
+   */
+  changeSkuSpecs(e) {
+    chooseGoodsCommon.changeSkuSpecsCommon(e, this);
+  },
+
+
+  /**
+   * @desc : 主柜规格单选
+   * @author : 于继渤
+   * @date : 2022/6/02 16:16
+   */
+  clickZGGG(e) {
+    let itemt = e.target.dataset.itemt;
+    let pindex = e.target.dataset.pindex;
+    let indext = e.target.dataset.indext;
+    let formZGGG = this.data.formZGGG
+    let infotype = formZGGG[pindex].tags[indext].infotype
+
+    infotype = 'default'
+    formZGGG[pindex].tags.forEach(res => {
+      res.infotype = 'default'
+    })
+
+    if (infotype == 'default') {
+      infotype = 'info'
+    } else {
+      infotype = 'default'
+    }
 
-        })
-    },
+    formZGGG[pindex].tags[indext].infotype = infotype
+    this.setData({
+      formZGGG
+    })
+  },
+
+
+  /**
+   * @desc : 定制品单选
+   * @author : 于继渤
+   * @date : 2022/6/02 16:16
+   */
+  clickDZP(e) {
+    let itemt = e.target.dataset.itemt;
+    let pindex = e.target.dataset.pindex;
+    let indext = e.target.dataset.indext;
+    let formDZP = this.data.formDZP
+    let infotype = formDZP[pindex].tags[indext].infotype
+
+    infotype = 'default'
+    formDZP[pindex].tags.forEach(res => {
+      res.infotype = 'default'
+    })
+
+    if (infotype == 'default') {
+      infotype = 'info'
+    } else {
+      infotype = 'default'
+    }
 
-    /**
-     * @desc : 计算折扣反算销售价格
-     * @author : 于继渤
-     * @date : 2022/7/4 14:45
-     */
-    changeDiscountField(e) {
-        chooseGoodsCommon.changeDiscountFieldCommon(e, this)
+    formDZP[pindex].tags[indext].infotype = infotype
+    this.setData({
+      formDZP
+    })
+  },
+  /**
+   * @desc : 切换组合促销明细
+   * @date : 2022/7/5 16:49
+   * @author : 周兴
+   */
+  changeCombinedItem(e) {
+    chooseGoodsCommon.changeCombinedItemCommon(e, this)
+  },
+
+  /**
+   * @desc : 单品促销单选
+   * @author : 于继渤
+   * @date : 2022/6/02 16:16
+   */
+  clickDP(e) {
+    chooseGoodsCommon.clickDPCommon(e, this)
+  },
+
+
+  /**
+   * @desc : 使用位置相关事件
+   * @author : 于继渤
+   * @date : 2022/5/26 12:16
+   */
+  changeUseLocation(e) {
+    let currentChoosedItem = this.data.currentChoosedItem
+    currentChoosedItem.usedLocation = e.detail
+    this.setData({
+      currentChoosedItem: currentChoosedItem
+    })
+  },
+  /**
+   * @desc : 点击全部分类
+   * @date : 2022/7/8 16:49
+   * @author : 周兴
+   */
+  clickAllSpecs() {
+    // 让其他分类的标识置为-1
+    this.setData({
+      specsActive: -1,
+      specsId: null
+    })
+    // 查询数据
+    this.doSearch()
+  },
+  /**
+   * @desc : 点击全部单个分类
+   * @date : 2022/7/8 16:49
+   * @author : 周兴
+   */
+  changeSpecsTabs(e) {
+    let index = e.detail.index;
+    this.setData({
+      specsActive: index,
+    })
+    let id = this.data.typeList[index].id
+    this.setData({
+      specsId: id
+    })
+    // 查询数据
+    this.doSearch()
+  },
+  /**
+   * @desc : 是否显示商品分类页面
+   * @date : 2022/7/9 16:49
+   * @author : 周兴
+   */
+  displayAllSpecs() {
+    this.setData({
+      showAllSpecs: true
+    })
+  },
+  /**
+   * @desc : 页面上拉触底事件的处理函数
+   * @author : 周兴
+   * @date : 2022/8/1 12:16
+   */
+  scrollToLower() {
+    if (this.data.loading || this.data.noMore) {
+      return;
+    }
+    this.setData({
+      pageInfo: {
+        pageSize: this.data.pageInfo.pageSize,
+        currentPage: this.data.pageInfo.currentPage + 1
+      }
+    })
+    this.getData('more')
+  },
+  /**
+   * @desc : 页面上拉触底事件的处理函数
+   * @author : 于继渤
+   * @date : 2022/5/24 12:16
+   */
+  onReachBottom: function () {
+
+    if (this.data.loading || this.data.noMore || this.data.active == 1) {
+      return;
     }
+    this.setData({
+      pageInfo: {
+        pageSize: this.data.pageInfo.pageSize,
+        currentPage: this.data.pageInfo.currentPage + 1
+      }
+    })
+    this.getData('more')
+  },
+
+  BeaforeUnLoad() {
+    wx.enableAlertBeforeUnload({
+      message: '离开此页后已选商品将会被清空哦',
+      success: (e) => {
+        wx.setStorageSync('choosedGoodsList', [])
+
+      },
+      fail: (e) => {
+
+      }
+    })
+  },
+
+  // 设置监听器
+  watch: function (ctx, obj) {
+    Object.keys(obj).forEach(key => {
+
+      this.observer(ctx, key, ctx[key], function (value) {
+        obj[key].call(ctx, value)
+      })
+    })
+  },
+  // 监听属性,并执行监听函数
+  observer: function (data, key, val, fn) {
+    Object.defineProperty(data, key, {
+      configurable: true,
+      enumerable: true,
+      get: function () {
+        return val
+      },
+      set: function (newVal) {
+        if (newVal === val) return
+        fn && fn(newVal)
+        val = newVal
+      },
+    })
+  },
+  /**
+   * @desc : 选择非标参数事件
+   * @author : 于继渤
+   * @date : 2022/8/24 13:16
+   */
+  nonStandardTap(e) {
+    chooseGoodsCommon.nonStandardTap(e, this)
+  },
+  /**
+   * @desc : 设置非标匹配参数
+   * @author : 于继渤
+   * @date : 2022/8/24 13:16
+   */
+  setNonStandardMatchingParameters() {
+    chooseGoodsCommon.setNonStandardMatchingParameters(e, this)
+  },
+  /**
+   * @desc : 非标商品选择事件
+   * @author : 于继渤
+   * @date : 2022/8/24 13:16
+   */
+  nonGlassSpuItemsTap(e) {
+    chooseGoodsCommon.nonGlassSpuItemsTap(e, this)
+  },
+
+  /**
+   * @desc : 非标商品非标参数输入事件
+   * @author : 于继渤
+   * @date : 2022/8/24 13:16
+   */
+  bindInputIsScopeOne(e) {
+    chooseGoodsCommon.bindInputIsScopeOne(e, this)
+  },
+  bindBlurIsScopeOne(e) {
+    chooseGoodsCommon.bindBlurIsScopeOne(e, this)
+  },
+  changeFlgAllowSpecsUndefine(e) {
+
+    let currentChoosedItem = this.data.currentChoosedItem
+    currentChoosedItem.flgSpecsUndefine = e.detail
+    this.setData({
+      currentChoosedItem: currentChoosedItem
+    })
+  },
+
+
+  bindInputNonStantardArea(e) {
+
+    chooseGoodsCommon.bindInputNonStantardArea(e, this)
+  },
+  //面积离焦
+  bindBlurNonStantardArea(e) {
+
+    chooseGoodsCommon.bindBlurNonStantardArea(e, this)
+  },
+  onUnload() {
+
+    Dialog.confirm({
+      message: '哈哈哈哈哈哈',
+    }).then(() => {
+
+    })
+  },
+
+  /**
+   * @desc : 计算折扣反算销售价格
+   * @author : 于继渤
+   * @date : 2022/7/4 14:45
+   */
+  changeDiscountField(e) {
+    chooseGoodsCommon.changeDiscountFieldCommon(e, this)
+  }
 })

+ 13 - 0
package-basic-data/pages/test/add/add.js

@@ -31,4 +31,17 @@ Page({
   chooseData(e) {
     console.log('eee1', e, this.data.formData);
   },
+    /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    // 接收父页面传递的参数
+    const eventChannel = this.getOpenerEventChannel()
+    console.log('ffff3',eventChannel,this.data.formName);
+    let _this = this;
+    eventChannel.on('params', function (data) {
+      // 设置商品明细
+      _this.selectComponent('#' + _this.data.formName).setGoods(data);
+    })
+  }
 })

+ 8 - 1
package-basic-data/pages/test/test.js

@@ -72,8 +72,15 @@ Page({
     })
   },
   toAdd(){
+    // wx.navigateTo({
+    //   url: './add/add',
+    // })
     wx.navigateTo({
-      url: './add/add',
+      url: '/package-base-select/pages/select-goods/select-goods',
+      success: function(res) {
+        // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
+        res.eventChannel.emit('params', { url:'/package-basic-data/pages/test/add/add' })
+      }
     })
   },
   /**