xiaomei 9 сар өмнө
parent
commit
e2bb66a439

+ 11 - 1
src/language/en.json

@@ -226,5 +226,15 @@
   "lang225": "Set",
   "lang226": "Overview",
   "lang227": "Operation record",
-  "lang228": "Please enter the area code"
+  "lang228": "Please enter the area code",
+  "lang229": "Delivery address",
+  "lang230": "Please fill in the delivery address",
+  "lang231": "Modify the delivery address",
+  "lang232": "Enter the detailed address",
+  "lang233": "Logistics fee: Need to pay",
+  "lang234": "Express delivery fee",
+  "lang235": "Province, city and district:",
+  "lang236": "Select province/city/district",
+  "lang237": "Detailed address:",
+  "lang238": "Please fill in the information completely"
 }

+ 12 - 1
src/language/zh.json

@@ -226,5 +226,16 @@
   "lang225": "套",
   "lang226": "总览",
   "lang227": "操作记录",
-  "lang228": "请输入地区编号"
+  "lang228": "请输入地区编号",
+  "lang229": "收货地址",
+  "lang230": "请填写收货地址",
+  "lang231": "修改收货地址",
+  "lang232": "输入详细地址",
+  "lang233": "物流费:需要支付",
+  "lang234": "快递费用",
+  "lang235": "省市区:",
+  "lang236": "选择省/市/区",
+  "lang237": "详细地址:",
+  "lang238": "请完整填写信息",
+  "lang239": ""
 }

+ 80 - 1
src/views/mine/setting.vue

@@ -28,6 +28,13 @@
           <span style="color: #aaaaaa" v-if="userinfo.phone">{{ userinfo.phone }}</span>
           <span style="color: #aaaaaa" v-else>{{ $t('lang98') }}</span>
         </div>
+        <div @click="showPopup(3)" class="li">
+          <div class="li_left">
+            <span>{{ $t('lang229') }}</span>
+          </div>
+          <span style="color: #aaaaaa;text-align: right; max-width: 70%;" v-if="userinfo.take_address?.address">{{ userinfo.take_address?.address }}</span>
+          <span style="color: #aaaaaa" v-else>{{ $t('lang98') }}</span>
+        </div>
         <div @click="switchovers('language')" class="li">
           <div class="li_left">
             <span>{{ $t('lang101') }}</span>
@@ -64,16 +71,31 @@
         <div class="title" v-if="editType == 0">{{ $t('lang105') }}</div>
         <div class="title" v-if="editType == 1">{{ $t('lang106') }}</div>
         <div class="title" v-if="editType == 2">{{ $t('lang107') }}</div>
-        <div class="address_field">
+        <div class="title" v-if="editType == 3">{{ $t('lang231') }}</div>
+        <div class="address_field" v-if="editType != 3">
           <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang108')" v-if="editType == 0" />
           <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang109')" v-if="editType == 1" />
           <van-field v-model="inputValue" type="text" rows="1" autosize :placeholder="$t('lang110')" v-if="editType == 2" />
         </div>
+        <div class="address_field" v-if="editType == 3">
+          <div class="flex-row bt">
+            <span style="white-space: nowrap;   padding-right: 1em;">{{ $t('lang235') }}</span>
+            <span class="grew" v-if="!areaText" @click="areaShow = true">{{ $t('lang236') }}</span>
+            <span class="ngrew" v-if="areaText" @click="areaShow = true">{{ areaText }}</span>
+          </div>
+          <div class="flex-row bt">
+            <span style="white-space: nowrap">{{ $t('lang237') }}</span>
+            <van-field :style="{width: $i18n.locale=='zh-cn'?'70%':'100%'}" v-model="addressDetail" type="text" rows="1" autosize :placeholder="$t('lang232')" />
+          </div>
+        </div>
         <div class="bind_button" @click="editUserInfo">
           <span>{{ $t('lang111') }}</span>
         </div>
       </div>
     </van-popup>
+    <van-popup v-model="areaShow" round :close-on-click-overlay="true" position="bottom" @close="areaShow = false">
+      <van-area :title="$t('lang236')" :area-list="areaList" @cancel="areaShow = false" @confirm="OnConfirm" />
+    </van-popup>
   </div>
 </template>
 
@@ -85,6 +107,7 @@ import { mapState } from 'vuex';
 import union from '../../api/union';
 import Clipboard from 'clipboard';
 import Web3 from 'web3';
+import { areaList } from '@vant/area-data';
 export default {
   data() {
     return {
@@ -115,6 +138,11 @@ export default {
       editShow: false, //
       editType: 0, // 0修改昵称 1真实姓名  2手机号码
       inputValue: '',
+      areaList: areaList,
+      areaShow: false,
+      areaText: '', // 省市区显示
+      addressDetail: '', //传值(详细地址)
+      area_code: '', //传值
     };
   },
   created() {
@@ -124,6 +152,21 @@ export default {
     // this.init();
   },
   methods: {
+    onSave(e) {
+      // this.$toast('save');
+      homeApi.pickupOrder({ order_id: this.item.order_id, name: e.name, phone: e.tel, address: e.province + ' ' + e.city + ' ' + e.county + ' ' + e.areaText }).then(res => {
+        if (res.code == 200) {
+          this.addresPopop = false;
+          this.page = 1;
+          this.nft_list = [];
+          this.getNftList();
+          this.getUserInfo();
+          Notify({ type: 'success', message: this.$t('lang152') });
+        } else {
+          this.$toast(res.msg);
+        }
+      });
+    },
     //返回上一页
     back() {
       this.$router.back();
@@ -142,6 +185,8 @@ export default {
         return this.$toast(this.$t('lang170'));
       } else if ((this.editType == 2 && !this.inputValue) || (this.editType == 2 && this.inputValue.length < 11)) {
         return this.$toast(this.$t('lang171'));
+      } else if ((this.editType == 3 && !this.addressDetail) || (this.editType == 3 && !this.areaText)) {
+        return this.$toast(this.$t('lang238'));
       }
       let params = {};
       if (this.editType == 0) {
@@ -150,11 +195,18 @@ export default {
         params.name = this.inputValue;
       } else if (this.editType == 2) {
         params.phone = this.inputValue;
+      } else if (this.editType == 3) {
+        params.address = this.areaText.replace(/\//g, ' ') + ' ' + this.addressDetail;
+        params.area_code = this.area_code;
       }
+
       homeApi.setUserInfo(params).then(res => {
         if (res.code == 200) {
           this.editShow = false;
           this.inputValue = '';
+          this.addressDetail = '';
+          this.areaText = '';
+          this.area_code = '';
           this.getUserInfo();
           Notify({ type: 'success', message: this.$t('lang172') });
         }
@@ -182,10 +234,22 @@ export default {
         if (res.code == 200) {
           this.userinfo = res.data;
           this.order_count = res.data.order_count;
+          if (this.userinfo.take_address) {
+            this.addressDetail = this.userinfo.take_address?.address;
+            let sp = this.userinfo.take_address?.address.split(' ') || [];
+            this.areaText = sp[0] + '/' + sp[1] + '/' + sp[2];
+            this.addressDetail = sp[3];
+            this.area_code = this.userinfo.take_address?.area_code;
+          }
           this.userinfo.addressEncrypt = this.userinfo.address.substring(0, 5) + '****' + this.userinfo.address.substring(this.userinfo.address.length - 5, this.userinfo.address.length);
         }
       });
     },
+    OnConfirm(e) {
+      this.areaText = e[0].name + '/' + e[1].name + '/' + e[2].name;
+      this.area_code = e[0].code + ',' + e[1].code + ',' + e[2].code;
+      this.areaShow = false;
+    },
   },
   computed: {
     ...mapState(['account']),
@@ -343,4 +407,19 @@ export default {
     border-top: 1px solid #cccccc9d;
   }
 }
+.grew {
+  color: #c4c4c4;
+  // padding-left: 1em;
+}
+.ngrew {
+  // padding-left: 1em;
+}
+.bt {
+  font-size: 13px;
+  flex-wrap: wrap;
+  line-height: 190%;
+}
+.bt:first-child {
+  padding-bottom: 15px;
+}
 </style>

+ 29 - 1
src/views/mine/teaRights.vue

@@ -122,7 +122,8 @@
     <van-popup v-model="addresPopop" round position="bottom">
       <div class="area">
         <div class="title">{{ $t('lang157') }}</div>
-        <van-address-edit :area-list="areaList" show-search-result :save-button-text="$t('lang111')" :area-columns-placeholder="[]" @save="onSave" />
+        <van-address-edit :area-list="areaList" :address-info="AddressInfo" show-search-result :save-button-text="$t('lang111')" :area-columns-placeholder="[]" @save="onSave" />
+        <span>{{ $t('lang233') + ' ' + logistics_freight + ' ' + $t('lang174') + $t('lang234') }}</span>
       </div>
     </van-popup>
     <!-- 赠送 -->
@@ -212,6 +213,16 @@ export default {
       giveaway_txt: '', //赠送手续费说明
       chooseStatus: 0,
       rwa_num: 0,
+      logistics_freight: 0,
+      AddressInfo: {
+        name: '',
+        tel: '',
+        province: '',
+        city: '',
+        county: '',
+        addressDetail: '',
+        areaCode: '',
+      },
     };
   },
   mounted() {
@@ -290,6 +301,18 @@ export default {
       homeApi.getUserInfo().then(res => {
         if (res.code == 200) {
           this.rwa_num = res.data.rwa_num;
+          let userinfo = res.data;
+          let area = userinfo.take_address?.address.split(' ') || [];
+
+          this.AddressInfo = {
+            name: userinfo.name,
+            tel: userinfo.phone,
+            province: area[0] || '',
+            city: area[1] || '',
+            county: area[2] || '',
+            addressDetail: area[3] || '',
+            areaCode: userinfo.take_address?.area_code.split(',')[2] || '',
+          };
         } else {
         }
       });
@@ -373,6 +396,7 @@ export default {
           this.giveaway = res.data.giveaway;
           this.giveaway_txt = res.data.giveaway_txt;
           this.coinList = res.data.coin_list;
+          this.logistics_freight = res.data.logistics_freight;
         }
       });
     },
@@ -982,4 +1006,8 @@ export default {
 ::v-deep .van-picker__frame {
   border: 1px solid #fff !important;
 }
+::v-deep .van-address-edit__buttons {
+  padding-bottom: 10px !important;
+  padding-top: 10px !important;
+}
 </style>