#
whycq
2022-08-15 19a3945f16e9fa10ca6f51f6cd1ddc631dde50c1
pages/basics/putOnSale.vue
@@ -9,7 +9,7 @@
         <view class="square-content">
            <view class="content-input">
               <input type="text" v-model="locno" placeholder="扫码 / 输入" :focus="locnoFocus">
               <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons>
               <uni-icons v-show="locno" type="closeempty" size="20" color="#dadada" @click="remove('locno')"></uni-icons>
            </view>
         </view>
      </view>
@@ -22,7 +22,7 @@
         <view class="square-content">
            <view class="content-input">
               <input type="text" v-model="matnr" placeholder="扫码 / 输入" @input="findMat" :focus="matnrFocus">
               <uni-icons type="closeempty" size="20" color="#dadada"></uni-icons>
               <uni-icons v-show="matnr" type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons>
            </view>
         </view>
      </view>
@@ -48,7 +48,7 @@
               <view class="lists-item">上架数量:{{item.anfme}}</view>
            </view>
            <view class="list-right">
               <uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons>
               <uni-icons type="trash" size="20" color="#a5a5a5" @click="removeItem(item,index)"></uni-icons>
            </view>
         </view>
      </checkbox-group>
@@ -69,7 +69,12 @@
            <button class="cu-btn bg-blue " @click="comb()">上架</button>
         </label>
      </view>
      <view>
         <!-- 提示信息弹窗 -->
         <uni-popup ref="message" type="message">
            <uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
         </uni-popup>
      </view>
   
   </view>
</template>
@@ -78,13 +83,15 @@
    export default {
      data() {
          return {
            locno:null, // 库位号
            locno:'', // 库位号
            matnr:'', // 商品码
            locnoFocus:true,
            matnrFocus:true,
            matList:[], // 商品列表
            listLen:0,
            listNum:1
            listNum:1,
            msgType: 'success',
            messageText: '这是一条成功提示',
            
         }
      },
@@ -93,15 +100,35 @@
         this.baseIP = UIP;
         const UPORT = uni.getStorageSync('UPORT');
         this.basePORT = UPORT
         const PROJ = uni.getStorageSync('UPROJ');
         this.baseUrl = PROJ
         this.getUrl()
      },
      methods:{
         // 获取url
         getUrl() {
            this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
         },
         // 消息提示弹窗
         messageToggle(type) {
            this.msgType = type
            this.messageText = ''
            this.$refs.message.open()
         },
         // 清空input
         remove(e) {
            this[e] = ''
         },
         // 重置
         resst() {
            this.locno = ''
            this.matnr = ''
            this.matList = []
         },
         findMat() {
            let that = this
            uni.request({
                url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
                url: that.commonUrl + '/mat/auth',
                data: {
                  matnr:that.matnr
                },
@@ -134,26 +161,40 @@
            });
            
         },
         // .
         // 移除物料
         removeItem(item,index) {
            this.matList.splice(index,1)
            // this.listLen = this.matList.length
            this.messageToggle('success')
            this.messageText = '移除成功'
         },
         // 上架
         comb() {
            let that = this
            if(that.locno === '') {
               uni.showToast({title: '请添加库位码', icon: "none", position: 'top'});
               return;
            }
            if(that.matList.length === 0) {
               uni.showToast({title: '请添加商品', icon: "none", position: 'top'});
               return;
            }
            var combList = {}
            var matList = []
            combList['locno'] = that.locno
            combList['combMats'] = that.matList
            matList['matnr'] = that.matList.
            console.log(combList)
            // console.log(JSON.stringify(combList))
            // return;
            matList['matnr'] = that.matList
            console.log(JSON.stringify(combList))
            uni.request({
               url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth',
               url: that.commonUrl + '/mobile/mat/onSale/auth',
               data: {
                  combParam:JSON.stringify(combList)
               },
               header: { 'token':uni.getStorageSync('token') },
               method:'GET',
               success(result) {
                  console.log(result)
               }
            })
         }