Explorar o código

添加收获地址管理

DaMowang %!s(int64=2) %!d(string=hai) anos
pai
achega
0e1b55854a

+ 3 - 3
src/app.scss

@@ -29,9 +29,9 @@ view, text, div {word-break: break-all;color:#333;font-family: "SourceHanSansSC-
 @font-face {
     font-family: 'iconfont';  /* Project id 3748689 */
     src: 
-         url('//at.alicdn.com/t/c/font_3748689_lacilu0uhw.woff2?t=1675073172975') format('woff2'),
-         url('//at.alicdn.com/t/c/font_3748689_lacilu0uhw.woff?t=1675073172975') format('woff'),
-         url('//at.alicdn.com/t/c/font_3748689_lacilu0uhw.ttf?t=1675073172975') format('truetype');
+         url('//at.alicdn.com/t/c/font_3748689_4wxbfi0sqpw.woff2?t=1681285344283') format('woff2'),
+         url('//at.alicdn.com/t/c/font_3748689_4wxbfi0sqpw.woff?t=1681285344283') format('woff'),
+         url('//at.alicdn.com/t/c/font_3748689_4wxbfi0sqpw.ttf?t=1681285344283') format('truetype');
   }
 .iconfont {
     font-family: "iconfont" !important;

+ 18 - 6
src/pages.json

@@ -18,12 +18,12 @@
 				"navigationBarTitleText": "福利"
 			}
 		},
-		{
-			"path": "pages/partner/index",
-			"style": {
-				"navigationBarTitleText": "联盟店"
-			}
-		},
+		// {
+		// 	"path": "pages/partner/index",
+		// 	"style": {
+		// 		"navigationBarTitleText": "联盟店"
+		// 	}
+		// },
 		{
 			"path": "pages/my/index",
 			"style": {
@@ -317,6 +317,18 @@
 				"style": {
 					"navigationBarTitleText": "TeaC明细"
 				}
+			},
+			{
+				"path": "address/list",
+				"style": {
+					"navigationBarTitleText": "我的收获地址"
+				}
+			},
+			{
+				"path": "address/addaddress",
+				"style": {
+					"navigationBarTitleText": "添加收获地址"
+				}
 			}
 		 ]
 	}],

+ 46 - 25
src/pages/my/index.vue

@@ -21,8 +21,8 @@
             </view>
             <view class="flex_r flex_ac">
               <view class="user_level clearfix">
-                <image class="level_img" src="/static/my/huangguan.png" mode=""></image>
-                <view class="level_text">{{ userinfo.level_name }}</view>
+                <img class="level_img" src="/static/my/huangguan.png">
+                <span class="level_text">{{ userinfo.level_name }}</span>
               </view>
             </view>
             <view class="user_account flex_r flex_ac mar_t10">
@@ -42,6 +42,13 @@
         </block>
       </view>
       <!-- 用户信息-end -->
+
+      <!-- 节点 -->
+      <view class="regional" v-if="userinfo.regionalNode">
+        <img src="@/static/my/regional.png" alt="" srcset="" class="ico">
+        <span class="txtinfo">区域节点:{{ userinfo.regionalNode.regional_name }}</span>
+      </view>
+
       <!-- 账户信息 -->
       <view class="acc_info">
         <view class="acc_head flex_r flex_jb">
@@ -170,6 +177,10 @@
             <image class="fun_img" src="/static/my/green.png" mode=""></image>
             <view class="fun_text">新手教程</view>
           </navigator>
+          <navigator class="fun_list flex_c flex_ac" url="/pagesB/address/list" hover-class="none">
+            <image class="fun_img" src="/static/my/dizhi.png" mode=""></image>
+            <view class="fun_text">地址管理</view>
+          </navigator>
           <view class="fun_list flex_c flex_ac">
             <button open-type="contact" style="background: #fff; border: 0; line-height: 1; padding: 0">
               <image class="fun_img" src="/static/my/service.png" mode=""></image>
@@ -466,12 +477,6 @@ page {
   margin-left: 20rpx;
 }
 
-.level_img {
-  width: 42rpx;
-  height: 35rpx;
-  z-index: 30;
-}
-
 .code_img {
   width: 42rpx;
   height: 44rpx;
@@ -519,15 +524,6 @@ page {
   border-radius: 6rpx;
 }
 
-.level_text {
-  color: #6b2909;
-  // padding: 0 16rpx;
-  // border-radius: 13rpx;
-  // font-size: 20rpx;
-  // margin-left: -14rpx;
-  // margin-top: 6rpx;
-}
-
 .user_name {
   width: 100%;
   overflow: hidden;
@@ -626,6 +622,23 @@ page {
   font-size: 26rpx;
 }
 
+.regional{
+  padding: 0 10rpx;
+  margin-top: 16rpx;
+  .ico{
+    width: 32rpx;
+    height: 32rpx;
+    margin-right: 12rpx;
+  }
+  .txtinfo{
+    color: #000;
+    font-size: 25rpx;
+  }
+  .ico,.txtinfo{
+    vertical-align: middle;
+  }
+}
+
 .acc_info {
   width: 100%;
   overflow: hidden;
@@ -634,7 +647,7 @@ page {
   border-radius: 16rpx;
   padding: 30rpx;
   box-sizing: border-box;
-  margin-top: 50rpx;
+  margin-top: 38rpx;
 }
 
 // 账户信息-end
@@ -697,20 +710,28 @@ page {
 .user_level {
   margin-top: 10rpx;
   background: linear-gradient(to right, #ffeabd, #ffc479);
-  padding: 5rpx 20rpx;
-  box-sizing: border-box;
+  padding: 6rpx 20rpx;
   border-radius: 6rpx;
   overflow: hidden;
-
-  .level_img,
-  .level_text {
-    // vertical-align: middle;
-    float: left;
+  
+  .level_img {
+    width: 38rpx;
+    height: 30rpx;
+    z-index: 30;
   }
 
   .level_text {
+    color: #6b2909;
     font-size: 28rpx;
     margin-left: 12rpx;
+    display: inline-block;
+    height: 30rpx;
+    line-height: 30rpx;
+  }
+
+  .level_img,
+  .level_text {
+    float: left;
   }
 }
 

+ 1 - 1
src/pages/my/login.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="login">
         <view class="HLogo">
-            <img src="@/static/img/ycjs.png" alt="" />
+            <!-- <img src="@/static/img/ycjs.png" alt="" /> -->
             <p>欢迎登录数智云商城</p>
         </view>
         <view class="phoneL" v-if="LoginType == 1">

+ 11 - 9
src/pages/to-pay-list/index.vue

@@ -2,7 +2,7 @@
   <view class="container">
     <!-- 收货地址 -->
     <view class="address" v-if="Data.is_sell != 1 && Data.prom_type == 0">
-      <block v-if="DefaultAddress.name != ''" >
+      <block v-if="DefaultAddress.name" >
         <view class="add_head flex_r flex_ac flex_jb">
           <view class="user_info flex_r flex_ac">
             <view class="user_name">{{ DefaultAddress.name }}</view>
@@ -130,8 +130,8 @@ export default {
       Data: {},
       goodsInfo: "", // 商品信息
       modularName: "", // 商品类型
-      DefaultAddress: "", // 用户默认地址
-      basicsInfo: "", // 订单信息
+      DefaultAddress: {}, // 用户默认地址
+      // basicsInfo: "", // 订单信息
 
       freight: 0, //运费
       userinfo: {},
@@ -145,7 +145,6 @@ export default {
     this.Data = e;
     this.loadData(e);
     this.loadAddress();
-    console.log(this.Data);
     this.userinfo = uni.getStorageSync("userinfo");
     // 1零售 2批发 3精品 4今日值买
     this.modularName = this.tidyTpye(e.type);
@@ -177,12 +176,15 @@ export default {
       post("user/addressList").then((res) => {
         if (res.code === 0) {
           let da = res.data.data;
-          for (const i of da) {
-            if (i.status == 1) {
-              this.DefaultAddress = i;
-              break;
-            } else this.DefaultAddress = da[0];
+          if(da.length){
+            for (const i of da) {
+              if (i.status == 1) {
+                this.DefaultAddress = i;
+                break;
+              } else this.DefaultAddress = da[0];
+            }
           }
+          console.log('this.DefaultAddress',this.DefaultAddress);
           // #ifdef  MP-WEIXIN
           // if (!da.length && this.Data.is_sell != 1) this.getwexinAddress();
           // #endif

+ 3 - 3
src/pages/xghc-addrress/userAddress.vue

@@ -91,7 +91,7 @@ export default {
     data() {
         return {
             userAddress: {}, //地址详情
-            addressValue: "",
+            // addressValue: "",
             is_default: 0, //是否设为默认地址
             range: [{ "value": 0, "text": "否" }, { "value": 1, "text": "是" }],
 
@@ -175,9 +175,9 @@ export default {
             this.userAddress = {};
         },
         onedit(da) {
-            let {id,name,mobile,address,province,city,area,street,status} = da
+            let {id,name,mobile,address,province,city,area,street,status, regional_code} = da
             this.userAddress = { id,name,mobile,address };
-            this.address = { province,city,area,street };
+            this.address = { province,city,area,street, regional_code };
             this.userAddress.region = province + ' ' + city + ' ' + area + ' ' + street;
             this.is_default = status
             this.isadd = true

+ 214 - 0
src/pagesB/address/addaddress.vue

@@ -0,0 +1,214 @@
+<template>
+  <div class="addaddress">
+    <view class="addAddress">
+      <view class="pad30 mt-22">
+        <view class="list borderRadius15">
+          <view class="item acea-row row-between-wrapper">
+            <view class="name">姓名</view>
+            <input
+              type="text"
+              placeholder="请输入姓名"
+              v-model="userAddress.name"
+              class="inputa"
+            />
+          </view>
+          <view class="item acea-row row-between-wrapper">
+            <view class="name">联系电话</view>
+            <input
+              type="number"
+              placeholder="请输入联系电话"
+              v-model="userAddress.mobile"
+              class="inputa"
+            />
+          </view>
+          <view class="item acea-row row-between-wrapper">
+            <view class="name">所在地区</view>
+            <input
+              type="text"
+              placeholder="请填写具体地址"
+              v-model="userAddress.region"
+              @click="btnClick"
+              disabled
+              class="inputa"
+            />
+          </view>
+          <view class="item acea-row row-between-wrapper">
+            <view class="name">详细地址</view>
+            <input
+              type="text"
+              placeholder="请填写具体地址"
+              v-model="userAddress.address"
+              class="inputa"
+            />
+          </view>
+          <view class="item acea-row">
+            <view class="name">默认地址</view>
+            <uni-data-checkbox
+              v-model="is_default"
+              :localdata="range"
+            ></uni-data-checkbox>
+          </view>
+        </view>
+      </view>
+      <button class="keepBnt bg-color" @click="formSubmit">立即保存</button>
+    </view>
+    <select-address
+      :address.sync="address"
+      ref="selectAddress"
+      @change="changeAddress"
+    />
+  </div>
+</template>
+
+<script>
+import { post } from "@/request/api.js";
+import selectAddress from "@/components/lcw-select-address/lcw-select-address.vue";
+let app = getApp();
+var appEv = app.$vm.$options;
+export default {
+  name: "addaddress",
+  props: {},
+  components: {
+    selectAddress,
+  },
+  data() {
+    return {
+      userAddress: {}, //地址详情
+      is_default: 0, //是否设为默认地址
+      range: [
+        { value: 0, text: "否" },
+        { value: 1, text: "是" },
+      ],
+      address: {
+        province: "",
+        city: "",
+        area: "",
+        street: "",
+      },
+    };
+  },
+  methods: {
+    btnClick() {
+      this.$refs.selectAddress.open();
+    },
+    changeAddress(address) {
+      //选择成功回调
+      this.address = address;
+      this.userAddress.region = "";
+      for (const i in address) {
+        if (i != "regional_code") this.userAddress.region += address[i] + " ";
+      }
+    },
+    formSubmit() {
+      let url;
+      let { address, mobile, name } = this.userAddress;
+      let data = {
+        ...this.address,
+        address, mobile, name,
+        is_default: this.is_default,
+      };
+      if (this.userAddress.id) {
+        url = "user/editAddress";
+        data.id = this.userAddress.id;
+      } else url = "user/addAddress";
+      post(url, data).then((res) => {
+        if (res.code === 0) {
+          appEv.errTips(res.msg);
+          this.isadd = false;
+          this.goto("/pagesB/address/list")
+        }
+      });
+    },
+  },
+  onLoad(va) {
+    if(va.isedit) {
+        let da = uni.getStorageSync('address_form');
+      let { id, name, mobile, address, province, city, area, street, status, regional_code } = da;
+      this.userAddress = { id, name, mobile, address };
+      this.address = { province, city, area, street, regional_code };
+      this.userAddress.region = province + " " + city + " " + area + " " + street;
+      this.is_default = status;
+    }
+  },
+  onShow() {},
+  mounted() {},
+};
+</script>
+
+<style scoped lang='scss'>
+.addAddress {
+  width: 100%;
+
+  .list {
+    background-color: #fff;
+
+    .item {
+      padding: 30rpx;
+      border-top: 1rpx solid #eee;
+
+      // position: relative;
+      .icon-dizhi {
+        font-size: 36rpx !important;
+      }
+
+      .name {
+        width: 180rpx;
+        font-size: 30rpx;
+        color: #333;
+      }
+
+      .address {
+        flex: 1;
+      }
+
+      input {
+        flex: 1;
+        font-size: 0 30rpx;
+      }
+    }
+  }
+
+  .pad30 {
+    padding: 0 30rpx;
+  }
+
+  .p_center {
+    text-align: center;
+  }
+
+  .acea-row {
+    display: flex;
+  }
+
+  .row-middle {
+    align-items: center;
+  }
+
+  .row-between-wrapper {
+    align-items: center;
+    justify-content: space-between;
+  }
+
+  .borderRadius15 {
+    border-radius: 15rpx !important;
+  }
+  // .default {
+  //     padding: 30rpx;
+  //     background-color: #fff;
+  // }
+
+  .keepBnt {
+    width: 690rpx;
+    height: 86rpx;
+    border-radius: 50rpx;
+    text-align: center;
+    line-height: 86rpx;
+    margin: 50rpx auto;
+    font-size: 32rpx;
+    color: #fff;
+  }
+    .bg-color {
+        background-color: #2DB389;
+    }
+}
+</style>

+ 214 - 0
src/pagesB/address/list.vue

@@ -0,0 +1,214 @@
+<template>
+  <div class="addresslist">
+    <uni-swipe-action class="swipeAction" v-if="addressList.length">
+      <uni-swipe-action-item
+        class="swipeAction_item"
+        v-for="(i, s) in addressList"
+        :key="s"
+      >
+        <view class="addressLi clearfix" @click="onSelect(i, s)">
+          <view class="addressLi_l">
+            <div class="a_icon iconfont" v-if="i.status == 1">&#xe62a;</div>
+            <div class="a_icon" v-else>{{ i.name.slice(0,1) }}</div>
+            <!-- <text v-if="i.id != presentId" class="iconfont">&#xe623;</text>
+            <text v-else class="iconfont pitchOn">&#xe624;</text> -->
+          </view>
+          <view class="addressLi_r">
+            <view class="user">
+              <text class="name">{{ i.name }}</text>
+              <text>{{ i.mobile }}</text>
+              <text v-if="i.status == 1" class="defaultAddress">默认</text>
+            </view>
+            <view class="address">{{ i.province + ' ' + i.city + ' ' + i.area + ' ' + i.street + ' ' + i.address }}</view>
+          </view>
+        </view>
+        <template v-slot:right>
+          <view class="btns clearfix">
+            <view class="btn edit" @click="onedit(i)"
+              ><text class="iconfont">&#xe600;</text></view
+            >
+            <view class="btn del" @click="delAddress(i.id)"
+              ><text class="iconfont">&#xe601;</text></view
+            >
+          </view>
+        </template>
+      </uni-swipe-action-item>
+    </uni-swipe-action>
+    <div class="zanwu" v-else>
+      <img src="@/static/img/zanwu.png" alt="" class="zanwuimg">
+      <view class="zanwutxt">暂无地址信息</view>
+    </div>
+    <div class="footbtn" @click="goto('/pagesB/address/addaddress')">添加地址</div>
+  </div>
+</template>
+
+<script>
+import { post } from "@/request/api.js";
+let app = getApp();
+var appEv = app.$vm.$options;
+export default {
+  name: "addresslist",
+  props: {},
+  components: {},
+  data() {
+    return {
+      addressList: [],
+    };
+  },
+  methods: {
+    // 获取用户地址
+    loadAddress() {
+      post("user/addressList").then((res) => {
+        if (res.code === 0) {
+          this.addressList = res.data.data;
+        }
+      });
+    },
+    onedit(da) {
+      uni.setStorageSync('address_form', da);
+      this.goto('/pagesB/address/addaddress',{isedit:1})
+      // let { id, name, mobile, address, province, city, area, street, status } = da;
+      // this.userAddress = { id, name, mobile, address };
+      // this.address = { province, city, area, street };
+      // this.userAddress.region = province + " " + city + " " + area + " " + street;
+      // this.is_default = status;
+    },
+    delAddress(id) {
+      post("user/delAddress", { id }).then((res) => {
+        if (res.code === 0) {
+          appEv.errTips(res.msg);
+          this.loadAddress();
+        }
+      });
+    },
+  },
+  onLoad(da) {},
+  onShow() {
+    this.loadAddress();
+  },
+  mounted() {},
+};
+</script>
+
+<style scoped lang='scss'>
+.swipeAction {
+  font-size: 28rpx;
+
+  .addressLi {
+    .addressLi_l {
+      width: 100rpx;
+      height: 80rpx;
+      display: flex;
+      align-items: center;
+
+      .a_icon{
+        width: 60rpx;
+        height: 60rpx;
+        color: #f50;
+        background: rgba($color: #f50, $alpha: 0.15);
+        text-align: center;
+        line-height: 60rpx;
+        border-radius: 50%;
+        font-size: 34rpx;
+      }
+
+      .iconfont {
+        background: rgba($color: #f50, $alpha: 0.2);
+        color: #fff;
+      }
+    }
+
+    .addressLi_r {
+      width: calc(100% - 100rpx);
+      // padding-right: 20rpx;
+    }
+
+    .addressLi_l,
+    .addressLi_r {
+      float: left;
+    }
+
+    .user {
+      margin-bottom: 10rpx;
+    }
+
+    .name {
+      // font-size: 32rpx;
+      margin-right: 10rpx;
+    }
+
+    .address {
+      font-size: 24rpx;
+      color: #999;
+      padding: 0;
+    }
+  }
+
+  // .swipeAction_item {
+  // background: #fff;
+  // margin-bottom: 20rpx;
+  // }
+
+  .btns {
+    .btn {
+      float: left;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      height: 100%;
+      padding: 0 30rpx;
+      color: #fff;
+      font-size: 36rpx;
+    }
+
+    .edit {
+      background: rgba(25, 137, 250, 0.5);
+    }
+
+    .del {
+      background: rgba(238, 10, 36, 0.5);
+    }
+
+    .iconfont {
+      color: #fff;
+    }
+  }
+}
+
+::v-deep .uni-swipe_box {
+  padding: 20rpx 30rpx;
+  background: #fff;
+  margin-bottom: 20rpx;
+}
+
+.defaultAddress {
+  border: 1rpx solid #2db389;
+  color: #2db389;
+  border-radius: 6rpx;
+  font-size: 18rpx;
+  padding: 0 6rpx;
+  margin-left: 20rpx;
+}
+
+.footbtn{
+  width: calc(100% - 60rpx);
+  height: 80rpx;
+  background: #17bb87;
+  border-radius: 45rpx;
+  position: fixed;
+  bottom: 50rpx;
+  left: 30rpx;
+  color: #fff;
+  font-size: 36rpx;
+  text-align: center;
+  line-height: 80rpx;
+}
+.zanwu{
+  text-align: center;
+  .zanwutxt{
+    margin-top: 16rpx;
+    font-size: 28rpx;
+    color: #888;
+  }
+}
+</style>

BIN=BIN
src/static/img/upcoming.png


BIN=BIN
src/static/img/ycjs.png


BIN=BIN
src/static/img/zanwu.png


BIN=BIN
src/static/my/dizhi.png


BIN=BIN
src/static/my/regional.png