18016688350 há 4 anos atrás
pai
commit
b557f75157
4 ficheiros alterados com 161 adições e 5 exclusões
  1. 46 1
      pages/store/add.js
  2. 26 2
      pages/store/add.wxml
  3. 64 2
      pages/store/edit.js
  4. 25 0
      pages/store/edit.wxml

+ 46 - 1
pages/store/add.js

@@ -33,6 +33,8 @@ Page({
     value: [0, 0, 0],
     text: "",
     dictList:[],
+    dataCityDictList:[],
+    dadaTypeDictList:[],
     isPickerRender: false,
     isPickerShow: false,
     pickerConfig: {
@@ -167,9 +169,18 @@ Page({
     return;
   }
   if(!that.data.storeInfo.twoType){
-    util.toast("请输入二级品类")
+    util.toast("请输入美团二级品类")
     return;
   }
+  if(!that.data.storeInfo.dadaType){
+    util.toast("请输入达达品类")
+    return;
+  }
+  if(!that.data.storeInfo.dadaCityCode){
+    util.toast("请输入达达配送城市")
+    return;
+  }
+
   if(!that.data.storeInfo.storeAddress){
     util.toast("请输入详细地址")
     return;
@@ -301,6 +312,22 @@ Page({
         })
       }
     }).catch((res) => {})
+
+    util.request(util.api.getDictByCode, {code:"dada_city"}, "GET", false, true,app.globalData.token).then((res) => {
+      if (res.code == 200) {
+        that.setData({
+          dataCityDictList: res.result
+        })
+      }
+    }).catch((res) => {})
+
+    util.request(util.api.getDictByCode, {code:"dada_category"}, "GET", false, true,app.globalData.token).then((res) => {
+      if (res.code == 200) {
+        that.setData({
+          dadaTypeDictList: res.result
+        })
+      }
+    }).catch((res) => {})
   },
   //选配送类型
   bindDictPickerChange: function (e) {
@@ -311,4 +338,22 @@ Page({
     })
   },
 
+  //选达达配送城市
+  bindDataCityDictPickerChange: function (e) {
+    var item = this.data.dataCityDictList[e.detail.value]
+    this.setData({
+      ['storeInfo.dadaCityCode']: item.value,
+      ['storeInfo.dadaCityName']: item.text
+    })
+  },
+
+  //选达达品类
+  bindDadaTypeDictPickerChange: function (e) {
+    var item = this.data.dadaTypeDictList[e.detail.value]
+    this.setData({
+      ['storeInfo.dadaType']: item.value,
+      ['storeInfo.dadaTypeName']: item.text
+    })
+  },
+
 })

+ 26 - 2
pages/store/add.wxml

@@ -47,14 +47,24 @@
 
     <tui-list-cell hover="{{false}}" >
       <view class="tui-line-cell">
-        <view class="tui-title">二级品类</view>
+        <view class="tui-title">美团二级品类</view>
         <picker name="mtType" value="{{value}}" mode="multiSelector" bindchange="picker" bindcolumnchange="columnPicker" range="{{multiArray}}" >
-          <text class="tui-input" wx:if="{{text==''}}">请选择二级品类</text>
+          <text class="tui-input" wx:if="{{text==''}}">请选择美团二级品类</text>
           <text class="tui-input" wx:if="{{text!=''}}">{{text}}</text>
         </picker>
       </view>
     </tui-list-cell>
 
+    <picker bindchange="bindDadaTypeDictPickerChange" value="{{index}}" range="{{dadaTypeDictList}}" range-key="text">
+      <tui-list-cell hover="{{false}}">
+        <view class="tui-line-cell">
+          <view class="tui-title">达达品类</view>
+          <input placeholder-class="phcolor" class="tui-input" name="dadaType" placeholder="请选择达达品类" type="text" disabled="true"
+            value="{{storeInfo.dadaTypeName}}" />
+        </view>
+      </tui-list-cell>
+    </picker>
+
 
     <tui-list-cell hover="{{false}}" bindtap="timePickerShow">
       <view class="tui-line-cell">
@@ -74,6 +84,15 @@
       </tui-list-cell>
     </picker>
 
+    <picker bindchange="bindDataCityDictPickerChange" value="{{index}}" range="{{dataCityDictList}}" range-key="text">
+      <tui-list-cell hover="{{false}}">
+        <view class="tui-line-cell">
+          <view class="tui-title">达达配送城市</view>
+          <input placeholder-class="phcolor" class="tui-input" name="dadaCityCode" placeholder="请选择达达配送城市" type="text" disabled="true"
+            value="{{storeInfo.dadaCityName}}" />
+        </view>
+      </tui-list-cell>
+    </picker>
 
     <tui-list-cell hover="{{false}}">
       <view class="tui-line-cell">
@@ -89,6 +108,11 @@
       <view class="tui-line-cell">
         <view class="tui-title">详细地址:</view>
         <input placeholder-class="phcolor" bindtap="selectMap" class="tui-input" name="storeAddress" placeholder="请输入所在地区" catchinput="inputedit" value="{{storeInfo.storeAddress}}" data-name="storeInfo.storeAddress"/>
+       
+
+        <view class="tui-title">门牌号:</view>
+        <input placeholder-class="phcolor"  class="tui-input" name="houseNum" placeholder="请输入门牌号" catchinput="inputedit" value="{{storeInfo.houseNum}}" data-name="storeInfo.houseNum"/>
+       
       </view>
     </tui-list-cell>
 

+ 64 - 2
pages/store/edit.js

@@ -34,6 +34,8 @@ Page({
     value: [0, 0, 0],
     text: "",
     dictList:[],
+    dataCityDictList:[],
+    dadaTypeDictList:[],
     isPickerRender: false,
     isPickerShow: false,
     pickerConfig: {
@@ -164,9 +166,19 @@ Page({
       return;
     }
     if(!that.data.storeInfo.twoType){
-      util.toast("请输入二级品类")
+      util.toast("请输入美团二级品类")
       return;
     }
+    if(!that.data.storeInfo.dadaType){
+      util.toast("请输入达达品类")
+      return;
+    }
+    
+    if(!that.data.storeInfo.dadaCityCode){
+      util.toast("请输入达达配送城市")
+      return;
+    }
+
     if(!that.data.storeInfo.storeAddress){
       util.toast("请输入详细地址")
       return;
@@ -250,8 +262,22 @@ Page({
           })
         }
 
+        var cityCodeData = that.data.dataCityDictList.filter((e)=>e.value == res.result.dadaCityCode );
+        if(cityCodeData !=null && cityCodeData.length>0){
+          that.setData({
+            ['storeInfo.dadaCityName']:cityCodeData[0].text,
+          })
+        }
+        
+        var dadaTypeData = that.data.dadaTypeDictList.filter((e)=>e.value == res.result.dadaType );
+        if(dadaTypeData !=null && dadaTypeData.length>0){
+          that.setData({
+            ['storeInfo.dadaTypeName']:dadaTypeData[0].text,
+          })
+        }
+
         console.log("========================")
-        console.log(storeInfo)
+        console.log(res.result)
       }
     }).catch((res) => {})
   },
@@ -346,6 +372,22 @@ Page({
         this.bindStore();
       }
     }).catch((res) => {})
+
+    util.request(util.api.getDictByCode, {code:"dada_city"}, "GET", false, true,app.globalData.token).then((res) => {
+      if (res.code == 200) {
+        that.setData({
+          dataCityDictList: res.result
+        })
+      }
+    }).catch((res) => {})
+
+    util.request(util.api.getDictByCode, {code:"dada_category"}, "GET", false, true,app.globalData.token).then((res) => {
+      if (res.code == 200) {
+        that.setData({
+          dadaTypeDictList: res.result
+        })
+      }
+    }).catch((res) => {})
     
   },
   //选配送类型
@@ -356,4 +398,24 @@ Page({
       ['storeInfo.peisongTypeName']: item.text
     })
   },
+
+
+  //选达达配送城市
+  bindDataCityDictPickerChange: function (e) {
+    var item = this.data.dataCityDictList[e.detail.value]
+    this.setData({
+      ['storeInfo.dadaCityCode']: item.value,
+      ['storeInfo.dadaCityName']: item.text
+    })
+  },
+
+
+  //选达达品类
+  bindDadaTypeDictPickerChange: function (e) {
+    var item = this.data.dadaTypeDictList[e.detail.value]
+    this.setData({
+      ['storeInfo.dadaType']: item.value,
+      ['storeInfo.dadaTypeName']: item.text
+    })
+  },
 })

+ 25 - 0
pages/store/edit.wxml

@@ -51,6 +51,16 @@
       </view>
     </tui-list-cell>
 
+    <picker bindchange="bindDadaTypeDictPickerChange" value="{{index}}" range="{{dadaTypeDictList}}" range-key="text">
+      <tui-list-cell hover="{{false}}">
+        <view class="tui-line-cell">
+          <view class="tui-title">达达品类</view>
+          <input placeholder-class="phcolor" class="tui-input" name="dadaType" placeholder="请选择达达品类" type="text" disabled="true"
+            value="{{storeInfo.dadaTypeName}}" />
+        </view>
+      </tui-list-cell>
+    </picker>
+
     <tui-list-cell hover="{{false}}" bindtap="timePickerShow">
       <view class="tui-line-cell">
         <view class="tui-title">营业时间</view>
@@ -69,6 +79,16 @@
       </tui-list-cell>
     </picker>
 
+    <picker bindchange="bindDataCityDictPickerChange" value="{{index}}" range="{{dataCityDictList}}" range-key="text">
+      <tui-list-cell hover="{{false}}">
+        <view class="tui-line-cell">
+          <view class="tui-title">达达配送城市</view>
+          <input placeholder-class="phcolor" class="tui-input" name="dadaCityCode" placeholder="请选择达达配送城市" type="text" disabled="true"
+            value="{{storeInfo.dadaCityName}}" />
+        </view>
+      </tui-list-cell>
+    </picker>
+
     <tui-list-cell hover="{{false}}">
       <view class="tui-line-cell">
         <view class="tui-title">所在地区:</view>
@@ -83,9 +103,14 @@
       <view class="tui-line-cell">
         <view class="tui-title">详细地址:</view>
         <input placeholder-class="phcolor" class="tui-input"  bindtap="selectMap" name="storeAddress" placeholder="请输入所在地区" catchinput="inputedit" value="{{storeInfo.storeAddress}}" data-name="storeInfo.storeAddress"/>
+
+        <view class="tui-title">门牌号:</view>
+        <input placeholder-class="phcolor"  class="tui-input" name="houseNum" placeholder="请输入门牌号" catchinput="inputedit" value="{{storeInfo.houseNum}}" data-name="storeInfo.houseNum"/>
       </view>
     </tui-list-cell>
 
+    
+
     <!-- <tui-list-cell hover="{{false}}" bindtap="timePickerShow">
       <view class="tui-line-cell">
         <view class="tui-title">合约时间:</view>