美文网首页
多选地址

多选地址

作者: 糖醋里脊120625 | 来源:发表于2023-04-17 13:24 被阅读0次
    // pages/order/order.js
    import { requestAddressList, } from '../../http/api/addressApi'
    import { requestOrderSettle } from '../../http/api/cartApi'
    import { requestLevelList } from '../../http/api/skuIdLevelApi'
    
    Page({
    
        /**
         * 页面的初始数据
         */
        data: {
          popMoveup:false,
          DefaultAddress:{
            addressDetail: "",
            city: "",
            consigneeMobileNum: "",
            consigneeName: "",
            deliveryMethodConst: "",
            district: "",
            id: "",
            province: "",
          },
          HasAddress:false,
          popOrdersshow:false,
          popAddressshow:false,
          checked:true,
          AddressAllList:[],
          PopAddressList:[],
    
          PopOrderList:[],
          KeepNoChangePopOrderData:[],
    
          PopAddressObj:{},
          PopOrderGoods:{},
          
          PopOrderNum:0,
    
          detInfoText:"",
          tableOrdersDataList:[],
          FromCart:true,
          FromDetail:true,
          TotalPrice:0,
    
          orderIndex:0,
          findMethodConst:"",
    
          selectStoreAddress:{},
    
          originalOrderList:[]
    
        },
    
        /**
         * 
         * https://blog.csdn.net/qq_42002651/article/details/89917291
         * 生命周期函数--监听页面加载
         */
        onLoad(options) {
          
          this.setData({
            detInfoText:options.detail,
          })
    
          let that =this;
          setTimeout(function(){
            that.LoadData(that.data.detInfoText)
          },100)
        },
       
    
       
    
        LoadData(val){
          console.log("顺序")
          let that =this;
          let transData = JSON.parse(val)
          console.log(transData)
    
          //计算总价
          that.CalculateAllPrices(transData)
          // 购物车过来首次加载
          let createList=[
            {
              deliveryInfo:this.data.DefaultAddress,
              orderItems:transData
            }
          ]
          
          let LastTransOrders =[];
          createList.map((item) => {
           that.PublicTransOrders(item.orderItems,item).map((each)=>{
             LastTransOrders.push({
               deliveryInfo:{
                   deliveryMethodConst: each.deliveryMethodConst,
                   id:each.id,
                   addressDetail:each.addressDetail,
                   city:each.city,
                   consigneeMobileNum:each.consigneeMobileNum,
                   consigneeName:each.consigneeName,
                   district:each.district,
                   province:each.province,
               },
               orderItems:each.data
       
             })
           })
         });
    
         console.log("这个应该是最后执行的")
         console.log(LastTransOrders)
    
    
    
         let transOrders = LastTransOrders.map((item) => {
          if(item.deliveryInfo.deliveryMethodConst=="STORE_PICKUP"){
            return{
              deliveryInfo:{
                addressDetail: "",
                city: "",
                consigneeMobileNum: "",
                consigneeName: "",
                deliveryMethodConst: "STORE_PICKUP",
                district: "",
                id: "",
                province: "",
              },
              orderItems:item.orderItems
            }
          }else if(item.deliveryInfo.deliveryMethodConst=="ONLINE"){
            return{
              deliveryInfo:{
                addressDetail: "",
                city: "",
                consigneeMobileNum: "",
                consigneeName: "",
                deliveryMethodConst: "ONLINE",
                district: "",
                id: "",
                province: "",
              },
              orderItems:item.orderItems
            }
          }else{
            return{
              deliveryInfo:item.deliveryInfo,
              orderItems:item.orderItems
            }
          }
          
        });
        console.log(transOrders)
    
    
          this.setData({
            tableOrdersDataList:transOrders,
            originalOrderList:transData
          });     
        },
    
    
        // 选择门店页面传过来的方法
        ChangeStoreDeliveryAddress(storeAddress){
          console.log(storeAddress)
          console.log(this.data.orderIndex)
          console.log(this.data.tableOrdersDataList)
          this.data.tableOrdersDataList[this.data.orderIndex].deliveryInfo={
            ...storeAddress,
            deliveryMethodConst:this.data.tableOrdersDataList[this.data.orderIndex].deliveryInfo.deliveryMethodConst
          }
          this.setData({
            tableOrdersDataList:this.data.tableOrdersDataList,
          })
    
          console.log(this.data.tableOrdersDataList)
        },
    
        findSameDeliveryMethod(itemVal){
          let that=this;
          let _acData = that.data.tableOrdersDataList.findIndex((item) => item.deliveryInfo.id == itemVal.id && item.deliveryInfo.deliveryMethodConst == that.data.findMethodConst);
          return _acData
        },
    
    
    
        findSameOrder(itemOrder,OrderList){
          let that=this;
          let resData = OrderList.find(x => x.id == itemOrder.id);
          return resData
        },
    
    
    
        /******
        这一步要注意应为
        多选地址后和原来的地址有
        重合的地方,所有要删除并且合并相同地址的商品
        **/
        // 选择地址后页面传过来的方法
        changeDefaultAddress(val,){
          let that =this;
          if(this.findSameDeliveryMethod(val)>=0){
            //这是需要原始数据删除的部分
            let OriginalRepeatData = this.data.tableOrdersDataList[this.findSameDeliveryMethod(val)].orderItems;
            let samedata= this.data.tableOrdersDataList[this.data.orderIndex].orderItems;
    
            let mergeDta=OriginalRepeatData.concat(samedata)
            let idArr = []  //相同id放在同一数组中
            let resultArr = []  //最终结果数组
            for(let i = 0;i < mergeDta.length; i++){
              let index = idArr.indexOf(mergeDta[i].id)
              if(index > -1){  //有相同id存在的话,获取index索引位置
                resultArr[index].desireQuantity += mergeDta[i].desireQuantity  //取相同id的value累加
              }else{
                idArr.push(mergeDta[i].id)
                resultArr.push(mergeDta[i])
              }
            }
            console.log(resultArr)
            //原数组删掉一项
            this.data.tableOrdersDataList.splice(this.findSameDeliveryMethod(val), 1);
            //新的数组组合
            this.data.tableOrdersDataList[this.data.orderIndex].deliveryInfo={
              ...val,
              deliveryMethodConst:this.data.findMethodConst
            }
            this.data.tableOrdersDataList[this.data.orderIndex].orderItems=resultArr
          }else{
            // 没有重复的
            this.data.tableOrdersDataList[this.data.orderIndex].deliveryInfo={
              ...val,
              deliveryMethodConst:this.data.tableOrdersDataList[this.data.orderIndex].deliveryInfo.deliveryMethodConst
            }
          }
    
    
          
          
          this.setData({
            tableOrdersDataList:this.data.tableOrdersDataList,
          })
    
          return
          
        },
        // 每一项选择地址
        chooseAddress(event){
          let that =this;
          let itemData=event.currentTarget.dataset.bean;
          let indexNum = event.currentTarget.dataset.parentindex;
    
          this.setData({
            orderIndex:indexNum,
            findMethodConst:itemData.deliveryInfo.deliveryMethodConst
          })
          console.log(this.data.orderIndex)
          //如果是门店自提  
          if(itemData.deliveryInfo.deliveryMethodConst=='STORE_PICKUP'){
            wx.navigateTo({
              url: "/pages/ChooseStore/ChooseStore" ,
            });
          }else{
            //如果不是门店自提就自己选择地址
            wx.navigateTo({
              url: "/pages/Addresslist/Addresslist?detail=" +this.data.detInfoText ,
            });
            //
          }
          console.log("原始数据")
          console.log(this.data.tableOrdersDataList)
          console.log(itemData)
          console.log(event)
        },
        // 弹出门店地址
        openStoreAddress(){
        },
        CalculateAllPrices(listData){
          var sum1 = 0;
          for (var i in listData) {
              sum1 += listData[i].desireQuantity * listData[i].skuPrice * Number(listData[i].OrderPercent/100) ;
          }
          this.setData({
            TotalPrice:sum1*100,
          });
        },
        
        onGotoAddress() {
          
        },
        popUpOrdersNeeds(){
         
          this.setData({
            popMoveup:true,
            popOrdersshow:true,
            PopOrderList:this.data.tableOrdersDataList,
          });
        },
        clickChangeAddress(event){
          let that =this;
          let childIndex = event.currentTarget.dataset.childindex;
          let fatIndex = event.currentTarget.dataset.parentindex;
          this.setData({
            PopAddressObj:JSON.parse(JSON.stringify(this.data.PopOrderList[fatIndex].deliveryInfo)),
            PopOrderGoods:JSON.parse(JSON.stringify(this.data.PopOrderList[fatIndex].orderItems[childIndex])),
            PopOrderNum:Number(this.data.PopOrderList[fatIndex].orderItems[childIndex].desireQuantity),
            popAddressshow:true,
            popMoveup:true
          })
          
          let transAddress = this.data.AddressAllList.filter(function (item) {
            return item.id != that.data.PopAddressObj.id;
          });
          let newdata= transAddress.map((item) => {
            return {
              ...item,
              addressChecked:false,
              toAddressGoodsNum:0,
              plusdisable:false
            };
          });
          this.setData({
            PopAddressList:newdata,
            PopOrderList:this.data.PopOrderList
          })
        },
        closePopOrsers(){
          this.setData({
            popOrdersshow:false,
            popMoveup:false,
          });
        },
        ContinueOrders(){
          this.setData({
            tableOrdersDataList:this.data.PopOrderList,
            popOrdersshow:false,
            popMoveup:false,
          });
          
        },
      
      ChangeItemAddrress(event){
        let IndexNum = event.currentTarget.dataset.parentindex;
        this.data.PopAddressList[IndexNum].addressChecked = event.detail;
        this.setData({
          PopAddressList:this.data.PopAddressList,
        });
      },
      ChangeItemToAdressNum(event){
        
        let IndexNum = event.currentTarget.dataset.parentindex;    
        this.data.PopAddressList[IndexNum].toAddressGoodsNum = event.detail;
        var sum1 = 0;
        for (var i in this.data.PopAddressList) {
          if (this.data.PopAddressList[i].toAddressGoodsNum) {
            sum1 += Number(this.data.PopAddressList[i].toAddressGoodsNum) ;
          }
        } 
        this.data.PopOrderGoods.desireQuantity = this.data.PopOrderNum-sum1
    
        if(this.data.PopOrderGoods.desireQuantity==0){
          wx.showToast({
            icon: 'none',
            title: "数量不可以再增加",
          })
          this.data.PopAddressList.map((item, index) => {
            item.plusdisable = true;
          });
        }else{
          this.data.PopAddressList.map((item, index) => {
            item.plusdisable = false;
          });
        }
    
        this.setData({
          PopAddressList:this.data.PopAddressList,
          PopOrderGoods:this.data.PopOrderGoods
        });
      },
     
     
      findUseful(itemVal){
        let that=this;
        let _acData = that.data.PopOrderList.find(x => x.deliveryInfo.id == itemVal.deliveryInfo.id);
        return _acData
      },
      findSameAddress(itemVal,RawData){
        let that=this;
        let _acData = RawData.find(x => x.deliveryInfo.id == itemVal.id);
        return _acData
      },
      ChangeGoodsAdress(){
        let that =this;
        let moreAddress = this.data.PopAddressList.filter(function (item) {
          return item.toAddressGoodsNum >0;
        });
        
        const Restoreoriginaldata = JSON.parse(JSON.stringify(this.data.PopOrderList)) 
        
    
     
        let tempArr = [];
        let RawData = [];
        for (let i = 0; i < Restoreoriginaldata.length; i++) {
           if (tempArr.indexOf(Restoreoriginaldata[i].deliveryInfo.id) === -1) {
            RawData.push({
                deliveryInfo:Restoreoriginaldata[i].deliveryInfo,
                tagName: Restoreoriginaldata[i].deliveryInfo.id,
                orderItems: Restoreoriginaldata[i].orderItems
             });
             tempArr.push(Restoreoriginaldata[i].deliveryInfo.id);
           } else {
             for (let j = 0; j < RawData.length; j++) {
               if (RawData[j].tagName == Restoreoriginaldata[i].deliveryInfo.id) {
                RawData[j].orderItems.push(...Restoreoriginaldata[i].orderItems);
                 break;
               }
             }
           }
        }
        console.log(RawData)
    
        let needAddProduct=[];
        let hasSamedata=[]
        // /地址循环
        moreAddress.map((item,index)=>{
          let resdata = that.findSameAddress(item,RawData)
          //相同地址裏有商品的操作
          if(resdata){
      
            let ddd=[];
           
          let JUDUJU = resdata.orderItems.find(item => item.id == that.data.PopOrderGoods.id);
          if(JUDUJU){
          }else{
            ddd.push({
              ...that.data.PopOrderGoods,
              desireQuantity:item.toAddressGoodsNum
            })
          }
    
          resdata.orderItems.map((every,indexOrder)=>{
            if(every.id==that.data.PopOrderGoods.id){
              ddd.push({
                ...every,
                desireQuantity:Number(every.desireQuantity)+Number(item.toAddressGoodsNum)
              })
            }else{
              ddd.push(every)
            }
          })
            hasSamedata.push({
              deliveryInfo:item,
              orderItems:ddd
            })
    
          }else{
            needAddProduct.push({
              deliveryInfo:item,
              orderItems:[{
                ...that.data.PopOrderGoods,
                desireQuantity:item.toAddressGoodsNum
              }]
            })
          }
        })
        console.log("这是新增加的地址")
        console.log(needAddProduct)
    
        console.log("这是有相同的地址")
        console.log(hasSamedata)
    
        function filterArr(allArr,selecArr){
          var midArr = RawData;
          for(var item of hasSamedata){
            midArr = midArr.filter( (val1)=>{
              return val1.deliveryInfo.id!=item.deliveryInfo.id;
            } )
            
          }
          return midArr;
        }
        let RestOrders = filterArr(RawData,hasSamedata);
    
        let Recalculate=[];
        
        RestOrders.map((item,sindex)=>{
          
          if(item.deliveryInfo.id==this.data.PopAddressObj.id){
            let buildlist =[];
            item.orderItems.map((each,sindex)=>{
              if(each.id==that.data.PopOrderGoods.id){
                if(that.data.PopOrderGoods.desireQuantity ==0){
                  buildlist.splice(sindex, 1);
                }else{
                  buildlist.push({
                    ...each,
                    desireQuantity: that.data.PopOrderGoods.desireQuantity
                  })
                }
              }else{
                buildlist.push({
                  ...each,
                })
              }
              
            })
            Recalculate.push({
              deliveryInfo:item.deliveryInfo,
              orderItems:buildlist
            })
    
           }else{
            Recalculate.push(item)
           }
          
        })
    
        let changedata = needAddProduct.concat(hasSamedata, Recalculate);;
        
    
        let LastTransOrders =[];
        changedata.map((item) => {
          that.PublicTransOrders(item.orderItems,item).map((each)=>{
            LastTransOrders.push({
              deliveryInfo:{
                  deliveryMethodConst: each.deliveryMethodConst,
                  id:each.id,
                  addressDetail:each.addressDetail,
                  city:each.city,
                  consigneeMobileNum:each.consigneeMobileNum,
                  consigneeName:each.consigneeName,
                  district:each.district,
                  province:each.province,
              },
              orderItems:each.data
    
            })
          })
        });
    
        this.setData({
          PopOrderList:LastTransOrders,
          popAddressshow:false,
          popMoveup:false
        });
      },
    
    PublicTransOrders(itemVal,item){
      var map = {},
      dest = [];
      for(var i = 0; i < itemVal.length; i++){
          var ai = itemVal[i];
          if(!map[ai.deliveryMethodConst]){
              dest.push({
                deliveryMethodConst: ai.deliveryMethodConst,
                id:item.deliveryInfo.id,
                addressDetail:item.deliveryInfo.addressDetail,
                city:item.deliveryInfo.city,
                consigneeMobileNum:item.deliveryInfo.consigneeMobileNum,
                consigneeName:item.deliveryInfo.consigneeName,
                district:item.deliveryInfo.district,
                province:item.deliveryInfo.province,
                data: [ai]
              });
              map[ai.deliveryMethodConst] = ai;
          }else{
              for(var j = 0; j < dest.length; j++){
                  var dj = dest[j];
                  if(dj.deliveryMethodConst == ai.deliveryMethodConst){
                      dj.data.push(ai);
                      break;
                  }
              }
          }
      }
      return dest
    },
    
    changeItems(arr){
      let newArr = []
      arr.forEach(el=>{
          const result = newArr.findIndex(ol=>{return el.id === ol.id})
          if(result!== -1){
              newArr[result].desireQuantity = newArr[result].desireQuantity + el.desireQuantity
          }else{
              newArr.push(el)
          } 
      })
      return newArr
    },
    
     ////xxxxxx
      onSubmit(){
        let that =this;
        console.log(this.data.tableOrdersDataList)
        //计算折扣
        let percentageData=[];
          this.data.originalOrderList.map((every)=>{
              if(every.HasPercentage==true){
                percentageData.push({
                  productSkuId:every.skuId,
                  discountPercent:every.OrderPercent,
                })
              }
          })
    
    
        if(this.data.tableOrdersDataList.length==1){
          //这是一个订单提交
          let postdelivery= this.data.tableOrdersDataList[0].deliveryInfo
          let postOrders=[]
          this.data.tableOrdersDataList[0].orderItems.map((each) => {
            postOrders.push({
              skuId:each.skuId,
              itemQuantity:each.desireQuantity,
              itemPrice:each.skuPrice,
              productNatureConst:each.productNatureConst,
            })
          });
          let postdata={
            shopId: 1008600001,
            deliveryInfo:postdelivery,
            orderItems:postOrders,
            discountLevels:percentageData
          }
          requestOrderSettle(postdata).then((res) => {
            if(res.status=="success"){
              that.successFun(res)
            }
          })
        }else{
          //这里是订单里有多个订单提交      
          
          let newdata= this.data.tableOrdersDataList.map((item) => {
            let childFloor = item.orderItems.map((each)=>{
              return {
                skuId:each.skuId,
                itemQuantity:each.desireQuantity,
                itemPrice:each.skuPrice,
                productNatureConst:each.productNatureConst,
              }
            })
            return {
              deliveryInfo:{
                deliveryMethodConst:item.orderItems[0].deliveryMethodConst,
                province:item.deliveryInfo.province,
                city:item.deliveryInfo.city,
                district:item.deliveryInfo.district,
                addressDetail:item.deliveryInfo.addressDetail,
                consigneeMobileNum:item.deliveryInfo.consigneeMobileNum,
                consigneeName:item.deliveryInfo.consigneeName,
              },
              orderItems: childFloor,
            };
          });
          let postdata={
            shopId: 1008600001,
            subOrders:newdata,
            discountLevels:percentageData
          }
          
          console.log(newdata)
          requestOrderSettle(postdata).then((res) => {
            if(res.status=="success"){
              that.successFun(res)
            }
          })
        }
      },
      successFun(resData){
        wx.showToast({    
          title: '成功下单',    
          icon: 'success',    
          duration: 1000
        })
        setTimeout(function(){
          wx.navigateTo({
            url:"/pages/OrderSuccess/OrderSuccess?orderInfo=" + JSON.stringify("res.data")
          });
        },1000)
      },
      closePopAddress(){
        this.setData({
          popAddressshow:false,
          popMoveup:false,
        });
      },
     
        /**
         * 生命周期函数--监听页面初次渲染完成
         */
        onReady() {
    
        },
    
        /**
         * 生命周期函数--监听页面显示
         */
        onShow() {
          this.loadAddress()
        },
        loadAddress(){
          requestAddressList().then((res) => {
            
            // 这一步来确定默认地址
            if(res.data.length>0){
              let PrimaryAddress = res.data.find(item => item.isPrimary== true);
              if(PrimaryAddress){
                this.setData({
                  DefaultAddress:PrimaryAddress,
                })
              }else{
                this.setData({
                  DefaultAddress:res.data[0],
                })
              }
            }
            if(res.data.length>=1){
              this.setData({
                HasAddress:true
              })
            }else{
              this.setData({
                HasAddress:false
              })
            }
                   
          // 这一步待会做不是在这时候做的
          
    
            this.setData({
              AddressAllList:res.data,
            })
          })
      },
        /**
         * 生命周期函数--监听页面隐藏
         */
        onHide() {
    
        },
    
        /**
         * 生命周期函数--监听页面卸载
         */
        onUnload() {
    
        },
    
        /**
         * 页面相关事件处理函数--监听用户下拉动作
         */
        onPullDownRefresh() {
    
        },
    
        /**
         * 页面上拉触底事件的处理函数
         */
        onReachBottom() {
    
        },
    
        /**
         * 用户点击右上角分享
         */
        onShareAppMessage() {
    
        }
    })
    
    <!--pages/order/order.wxml-->
    
    <view class="order-page" class="{{popMoveup ? 'page-overflow-hidden' : ''}}">
        <view class="order-top">
            <view class="order-address" wx:if="{{HasAddress}}">
                
    
                <view class="moreaddress-part" bindtap="popUpOrdersNeeds">
                    <view class="moreaddress-content" >
                        <van-icon name="add-o" color="#5a66ff" />
                        <view class="moreaddress-text">支持多个收货地址</view>
                    </view>
                    <van-icon name="arrow" />
                </view>
            </view>
        </view>
    
    
        <!-- 这是主的列表 -->
        <view class="list-main">
            <view class="poporders-list">
                <view class="poporders-each" 
                    wx:for="{{tableOrdersDataList}}" 
                    wx:for-item="item" 
                    wx:key="index" 
                    data-bean="{{item}}"
                    data-parentIndex='{{index}}'
                    >
                    <view class="">
                        <!-- 单个商品选择地址 -->
                        <!-- wx:if="{{item.deliveryInfo.deliveryMethodConst=='EXPRESS_POST'}}" -->
                        <view class="chose-address-part"
                            wx:for-item="item" 
                            wx:key="index" 
                            data-bean="{{item}}"
                            data-parentIndex='{{index}}'
                            bindtap="chooseAddress"
                            wx:if="{{item.deliveryInfo.deliveryMethodConst!='ONLINE'}}"
                        >
                            <view class="chose-left">
                                <van-icon name="location" />
                                <view class="original-part"  wx:if="{{item.deliveryInfo.consigneeName}}" >
                                    <view class="original-local">{{item.deliveryInfo.consigneeName}}   {{item.deliveryInfo.consigneeMobileNum}}</view>
                                    <view class="original-per">
                                        {{item.deliveryInfo.province}}
                                        {{item.deliveryInfo.city}}
                                        {{item.deliveryInfo.district}}
                                        {{item.deliveryInfo.addressDetail}}
                                    </view>
                                </view>
                                <view class="original-part"  wx:else >
                                    <view class="chose-name">请添加地址</view>
                                </view>
                            </view>
                            <van-icon name="arrow" />
                        </view>
                        
                    </view>
                    <view 
                        wx:key="childindex" 
                        wx:for="{{item.orderItems}}" 
                        wx:for-index="childindex" 
                        wx:for-item="items"  
                        data-bean="{{items}}"
                        data-parentIndex='{{index}}'
                        data-childIndex="{{childindex}}"
                    >
                        <view  class="ContentItem">
                            <image src="{{items.skuImg}}" />
                            <view class="poporders-left">
                                <view class="poporders-title">{{items.spuName}}</view>
                                <view class="poporders-tips">{{items.skuName}}</view>
                            </view>
                            <view class="poporders-right">
                                <view class="poporders-price" >
                                    <view class="symbol">¥</view>
                                    <view class="price-num">{{items.skuPrice}}
                                        <view class="price-per" wx:if="{{items.OrderPercent<100}}">×{{items.OrderPercent/100}}</view>
                                    </view>
                                </view>
                                <view class="poporders-num">x{{items.desireQuantity}}</view>
                            </view>
                        </view>
                        <view class="Contentend">
                        <view class="itemend-each">
                            <view class="itemend-name">售卖类型</view>
                            <view class="itemend-name">{{items.productNatureDesc}}</view>
                        </view>
                        <view class="itemend-each">
                            <view class="itemend-name">配送方式</view>
                            <view class="itemend-name">{{items.deliveryMethodDesc}}</view>
                        </view>
    
                        <!-- <view class="itemend-each" bindtap="openStoreAddress" wx:if="{{items.deliveryMethodConst=='STORE_PICKUP'}}">
                            <view class="itemend-name">选择门店</view>
                            <view class="itemend-name" ><van-icon name="arrow" /></view>
                        </view> -->
                    </view>
                    </view>
                </view>
    
            </view>
        </view>
    
    </view>
    
    
    <!-- 第一次弹出商品列表的内容 -->
    <van-popup  z-index="{{1000}}" show="{{ popOrdersshow }}" round closeable close-icon="close" bind:close="closePopOrsers" position="bottom" custom-style="height: 80%;">
        <view class="popup-orders">
            <view class="poporder-header">
                <view class="poporder-text">修改收货地址</view>
                
            </view>
    
            <view class="poporders-list">
                <view class="poporders-each" wx:for="{{PopOrderList}}" wx:for-item="item" wx:key="index" data-bean="{{item}}"  wx:if="{{item.deliveryInfo.deliveryMethodConst=='EXPRESS_POST'}}">
                    <view class="original-address" wx:if="{{item.deliveryInfo.deliveryMethodConst=='EXPRESS_POST'}}">
                        <van-icon name="location" />
                        <view class="original-part">
                            <view class="original-local">{{item.deliveryInfo.addressDetail}}</view>
                            <view class="original-per">{{item.deliveryInfo.consigneeName}}{{item.deliveryInfo.consigneeMobileNum}}</view>
                        </view>
                    </view>
                    <view class="poporders-item" 
                        wx:key="childindex" 
                        wx:for="{{item.orderItems}}" 
                        wx:for-index="childindex" 
                        wx:for-item="items"  
                        data-bean="{{items}}"
                        data-parentIndex='{{index}}'
                        data-childIndex="{{childindex}}"
                    >
                        <image src="{{items.skuImg}}" />
                        <view class="poporders-left">
                            <view class="poporders-title">{{items.spuName}}</view>
                            <view class="poporders-tips">{{items.skuName}}</view>
                        </view>
                        <view class="poporders-right">
                            <view class="poporders-price" >
                                <view class="symbol">¥</view>
                                <view class="price-num">{{items.skuPrice}}</view>
                            </view>
                            <view class="poporders-num">x{{items.desireQuantity}}</view>
                            <van-button 
                                class="poporders-action" 
                                round 
                                data-parentIndex='{{index}}'
                                data-childIndex="{{childindex}}"  
                                size="small" 
                                plain
                                disabled="{{items.deliveryMethodConst!='EXPRESS_POST'}}"
                                bind:click="clickChangeAddress"  
                                type="primary">修改地址</van-button>
                        </view>
                    </view>
    
                </view>
    
            </view>
       
        </view>
        <view class="action-next" bindtap="ContinueOrders" ><view class="jixu">继续下单</view></view>
    </van-popup>
    
    
    <!-- 第二次弹出地址列表的内容 -->
    <van-popup  z-index="{{9999}}" show="{{ popAddressshow }}" round closeable close-icon="close" bind:close="closePopAddress" position="bottom" custom-style="height: 80%;">
        <view class="popup-address">
            <view class="address-top">
                <view class="top-name">原地址:</view>
                <view class="original-address">
                    <van-icon name="location" />
                    <view class="original-part">
                        <view class="original-local">{{PopAddressObj.addressDetail}}</view>
                        <view class="original-per">{{PopAddressObj.consigneeName}}{{PopAddressObj.consigneeMobileNum}}</view>
                    </view>
                </view>
                <view class="address-top-tips">
                    <view >寄往该地址的商品数量</view>
                    <view >x{{PopOrderGoods.desireQuantity}}</view>
                </view>
            </view>
    
            <view class="pop-address-list">
                <view class="pop-address-item"  wx:for="{{PopAddressList}}" wx:for-item="item" wx:key="index" data-bean="{{item}}">
                    <view class="address-item-content">
                        <view class="address-item-left">
                            <view class="item-left-name">{{item.consigneeName}}{{item.consigneeMobileNum}}</view>
                            <view class="item-left-address">{{item.province}}{{item.city}}{{item.district}}{{item.addressDetail}}</view>
                        </view>
                        <view class="address-item-right">
                            <van-checkbox icon-size="25px"  checked-color="#fa4126" data-parentIndex='{{index}}'  value="{{ item.addressChecked }}" bind:change="ChangeItemAddrress"></van-checkbox>
                        </view>
                    </view>
                    <view class="address-item-hidden"  wx:if="{{ item.addressChecked }}">
                        <view class="hidden-name">选择寄往该地址的商品数量</view>
                        <van-stepper disable-input="{{true}}" disable-plus="{{item.plusdisable}}" integer value="{{ item.toAddressGoodsNum }}" min="" data-parentIndex='{{index}}' bind:change="ChangeItemToAdressNum" />
                    </view>
                </view>
            </view>
        </view>
        <view class="action-next"><view class="jixu" bindtap="ChangeGoodsAdress">确认修改</view></view>
    </van-popup>
    
    <van-submit-bar
        price="{{ TotalPrice }}"
        button-text="提交订单"
        bind:submit="onSubmit"
    />
    
    
    
    /* pages/order/order.wxss */
    page{
        background: #f5f5f5;
        box-sizing: border-box;
        padding:  0rpx 20rpx;
    }
    .page-overflow-hidden {
        height: 100vh;
        overflow: hidden;
      }
    .order-address{
        margin-top: 20rpx;
        background: white;
        box-sizing: border-box;
        padding: 15rpx;
        border-radius:8rpx ;
    }
    .moreaddress-part,.address-part{
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10rpx 0rpx;
    }
    .address-content{
        margin-left: 10rpx;
    }
    .moreaddress-content,.address-order{
        display: flex;
    }
    .moreaddress-text{
        margin-left: 10rpx;
        font-size: 32rpx;
        color: #333333;
        line-height: 48rpx;
    }
    .address-text{
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 32rpx;
        color: #333333;
        line-height: 48rpx;
        margin: 8rpx 0;
    
    }
    .address-person{
        height: 40rpx;
        font-size: 28rpx;
        font-weight: normal;
        color: #333333;
        line-height: 40rpx;
    }
    
    
    /* 弹出商品列表的样式 */
    .popup-orders{
        background: #f5f5f5;
        box-sizing: border-box;
        padding: 20rpx;
    }
    
    .poporder-header{
        text-align: center;
        font-size: 32rpx;
        padding: 30rpx;
        font-weight: bold;
        color: #333333 !important;
    }
    .chose-address-part{
        background: #fdeced;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        padding: 20rpx 10rpx;
        border-radius: 8rpx;
    }
    .chose-left{
        display: flex;
        align-items: center;
    }
    
    .original-address{
        display: flex;
        align-items: center;
        box-sizing: border-box;
        padding: 20rpx 0rpx;
    }
    .original-salesroom{
        display: flex;
        align-items: center;
        box-sizing: border-box;
        padding: 20rpx 10rpx;
        font-size: 30rpx;
        color: #ee0a24;
    }
    
    .original-part{
        margin-left: 15rpx;
    }
    .original-local{
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        font-size: 28rpx;
        color: #333333;
    }
    .original-per{
        font-size: 28rpx;
        font-weight: normal;
        color: #333333;
    }
    .poporders-list{
        padding-bottom: 80rpx;
    }
    .list-main{
        margin-top: 30rpx;
    }
    .poporders-each{
        background: white;
        border-radius: 10rpx;
        box-sizing: border-box;
        padding: 10rpx 15rpx;
        margin-bottom: 20rpx;
        width: 100%;
    }
    .poporders-item{
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 16rpx 20rpx;
        margin-bottom: 20rpx;
        border-radius: 10rpx;
    }
    
    .poporders-item image{
        width: 176rpx;
        height: 176rpx;
        border-radius: 8rpx;
        overflow: hidden;
        margin-right: 16rpx;
    }
    .poporders-item .poporders-left {
        flex: 1;
    }
    .ContentItem{
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 16rpx 20rpx ;
    }
    .Contentend{
        
        margin-bottom: 20rpx;
        padding: 0rpx 20rpx 10rpx 20rpx;
        font-size: 30rpx;
        border-bottom: 1px solid #f0f2f7;
    }
    .itemend-each{
        padding: 6rpx 0rpx;
        color: #666666;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .ContentItem image{
        width: 176rpx;
        height: 176rpx;
        border-radius: 8rpx;
        overflow: hidden;
        margin-right: 16rpx;
    }
    .ContentItem .poporders-left {
        flex: 1;
    }
    .poporders-title{
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 30rpx;
        line-height: 40rpx;
        margin-bottom: 12rpx;
        color: #333333;
        margin-right: 16rpx;
    }
    .poporders-tips{
        font-size: 28rpx;
        color: #999999;
       
    }
    .poporders-right{
        min-width: 128rpx;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }
    .poporders-price{
        color: #333333;
        font-size: 32rpx;
        line-height: 48rpx;
        font-weight: bold;
        display: flex;
        color: #ee0a24;
    }
    .price-num{
        display: flex;
    }
    .symbol{
        display: inline;
        color: inherit;
        font-size: inherit;
        font-size: 0.8em;
    }
    .poporders-num{
        color: #333333;
        font-size: 28rpx;
    }
    .poporders-action{
        
        font-size: 28rpx;
        margin-top: 20rpx;
       
    }
    .action-next{
        position: fixed;
        bottom: 10rpx;
        width: 100%;
        margin: auto;
       
    }
    .jixu{
        padding: 25rpx 0rpx;
        font-size: 32rpx;
        position: relative;
        width: 90%;
        margin: auto;
        color: white;
        background: #fa4126;
        text-align: center;
        border-radius: 46rpx;
    }
    
    
    /* 弹出地址的样式 */
    
    .address-top{
        font-size: 32rpx;
        color: #333;
    }
    .address-top-tips{
        width: 100%;
        display: flex;
        align-items: center;
        font-size: 30rpx;
        color: #999;
        justify-content: space-between;
    }
    .popup-address{
        background: #f5f5f5;
        box-sizing: border-box;
        padding: 20rpx;
    }
    .pop-address-list{
        padding-bottom: 100rpx;
        margin-top: 40rpx;
    }
    
    
    .pop-address-item{
        background: white;
        box-sizing: border-box;
        padding: 10rpx;
        border-radius: 8rpx;
        margin-top: 10rpx;
    }
    .address-item-content{
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .item-left-name{
        font-size: 32rpx;
        line-height: 48rpx;
        margin-bottom: 16rpx;
        color: #333333;
        font-weight: bold;
        display: flex;
    }
    .item-left-address{
        font-size: 28rpx;
        line-height: 40rpx;
        color: #333;
    }
    
    .hidden-name{
        font-size: 30rpx;
        color: #999;
    }
    .address-item-hidden{
        margin-top: 10rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .chose-name{
        font-size: 28rpx;
    }
    
    
    

    相关文章

      网友评论

          本文标题:多选地址

          本文链接:https://www.haomeiwen.com/subject/dekcjdtx.html