123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- <template>
- <view style="position: relative;">
- <!-- 胶囊 -->
- <mvBar :mysNavConfig="mysNavConfig"></mvBar>
- <view :style="{marginTop:navH}"></view>
- <view>
- <!-- 收货地址 -->
- <view class="card" style="margin-top: 6%;" v-for="item in list">
- <view class="">
- <view class="" style="display: flex;justify-content:space-around;align-items: center;">
- <view class="">
- <image class="head-img" :src="picture.icon_loc" mode="">
- </image>
- </view>
- <view class="" style="padding-left: 3%;padding-right: 3%;width: 80%;">
- <view style="display: flex;">
- <p class='ipon' style="padding-right: 200rpx;">{{item.receiver_name}}</p>
- <p class='ipon'>{{item.phone_number}}</p>
- </view>
- <p class='ipon'>{{item.full_detail_addr}}</p>
- </view>
- </view>
- <view class="" style="border-bottom: 2rpx solid #C0C0C0;margin-top: 3%;margin-bottom: 3%;"> </view>
- <view class="func">
- <view class="func-left">
- <label style="font-size: 28rpx;vertical-align: middle;">
- <radio color="#F0D232" :value="item.default_tag" :checked="item.default_tag" style="transform:scale(0.6);
- font-size: 24rpx;" @click="setdefault(item)" name="radio" />
- </label>
- <span>默认地址</span>
- </view>
- <view class="func-right">
- <view class="func-btn" @click="edit(item)">
- <image :src="picture.icon_edit" mode="">
- </image>
- <span>编辑</span>
- </view>
- <view class="func-btn" @click="del(item)">
- <image :src="picture.icon_del" mode="" style="width: 33rpx;height: 33rpx;">
- </image>
- <span>删除</span>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="" style="width: 100%;height: 150rpx;">
- </view>
- <view class="signup">
- <view class="signupbtn">
- <button type="default" class="btn1" @click="addreceipt()">手动添加</button>
- </view>
- <view class="signupbtn">
- <button type="default" class="btn1" @click="chooseAddr()">
- <image class="weixinlogo" :src="weixinimage">
- </image>
- <p class="auto-text">
- 自动获取</p>
- </button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import region from '@/components/pca-code.json';
- import mvBar from "@/components/mys_navBar/mysNavBar";
- export default {
- components: {
- mvBar,
- },
- data() {
- return {
- navH: getApp().globalData.navHeight,
- weixinimage: "../../../static/img/icon-weixin.png",
- picture: {
- icon_edit: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-edit.png',
- icon_del: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-del.png',
- icon_loc: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-loc.png',
- home8: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home8.png',
- home10: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home10.png',
- home11: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/home11.png',
- },
- list: [],
- mysNavConfig: {
- /* 开启单页显示首页图标 */
- isHome: true,
- /* 固定导航 */
- navFixed: true,
- /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
- navTitle: {
- text: "收货地址管理",
- color: "",
- fontSize: "32rpx", // px upx rpx
- fontWeight: "normal", // 100 - 700
- },
- btnType: "type2",
- onLeftClick: "",
- /* type2 按钮 */
- type2Config: {
- // 左图标
- leftPath: "/static/img/png2.png",
- // 右图标
- rightPath: "/static/img/png4.png",
- // 圆角
- radius: "40rpx",
- },
- },
- };
- },
- onShow() {
- this.getlist()
- },
- onLoad() {},
- methods: {
- // 列表
- getlist() {
- return this.$https.get('/youngee/c/t/g/get-talent-address')
- .then(res => {
- console.log(res)
- this.list = res.data.data
- for (let k = 0; k < this.list.length; ++k) {
- let a = this.list[k].region_code.toString().slice(0, 2)
- let b = this.list[k].region_code.toString().slice(0, 4)
- let c = 0
- for (var i = 0; i < region.length; i++) {
- if (region[i].code == a) {
- a = region[i].name
- for (var j = 0; j < region[i].children.length; j++) {
- if (region[i].children[j].code == b) {
- b = region[i].children[j].name
- for (var o = 0; o < region[i].children[j].children.length; o++) {
- if (region[i].children[j].children[o].code == this.list[k]
- .region_code) {
- c = region[i].children[j].children[o].name
- }
- }
- }
- }
- }
- }
- this.list[k].full_detail_addr = a + b + c + this.list[k].detail_addr
- }
- })
- },
- // 进入添加收货地址
- addreceipt() {
- uni.navigateTo({
- url: '/pages/mycenter/myinformation/addlocation?ismodify=0'
- });
- },
- chooseAddr() {
- const that = this
- uni.chooseAddress({
- success(res) {
- console.log(res)
- console.log(res.userName)
- console.log(res.postalCode)
- console.log(res.provinceName)
- console.log(res.cityName)
- console.log(res.countyName)
- console.log(res.detailInfo)
- console.log(res.nationalCode)
- console.log(res.telNumber)
- that.$https.post('/youngee/c/t/p/add-talent-address', {
- region_code: res.nationalCode,
- detail_addr: res.provinceName + res.cityName + res.countyName + res.detailInfo,
- phone_number: res.telNumber,
- receiver_name: res.userName,
- mail_code: res.postalCode,
- default_tag: 1
- })
- .then(res => {
- console.log(res)
- that.getlist()
- })
- },
- fail: (res) => {
- console.log(res)
- }
- })
- },
- // 改变默认地址
- setdefault(item) {
- console.log(item.default_tag)
- if (item.default_tag === 1)
- return
- this.$https.post('/youngee/c/t/p/change-default-delivery-addr', {
- address_id: item.address_id,
- })
- .then(res => {
- console.log(res)
- this.getlist()
- uni.showToast({
- title: '修改成功'
- })
- })
- // var that = this;
- // uni.showModal({
- // title: '提示',
- // content: '确认修改默认地址',
- // success: function(res) {
- // if (res.confirm) {
- // that.$https.post('/youngee/c/t/p/change-default-delivery-addr', {
- // address_id: item.address_id,
- // })
- // .then(res => {
- // console.log(res)
- // that.getlist()
- // uni.showToast({
- // title: '修改成功'
- // })
- // })
- // } else if (res.cancel) {
- // console.log('用户点击取消');
- // }
- // },
- // })
- },
- // 编辑地址
- edit(item) {
- console.log(item.receiver_name)
- uni.navigateTo({
- url: '/pages/mycenter/myinformation/addlocation?address_id=' + item.address_id + '&ismodify=1'
- });
- },
- // 删除地址
- del(item) {
- let that = this
- uni.showModal({
- title: '提示',
- content: '确认删除',
- success: function(res) {
- if (res.confirm) {
- // console.log(item)
- that.$https.post('/youngee/c/t/p/delete-talent-address', {
- address_id: item.address_id,
- default_tag: item.default_tag,
- })
- .then(res => {
- console.log(res)
- that.getlist()
- uni.showToast({
- title: '删除成功'
- })
- })
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- },
- })
- },
- }
- };
- </script>
- <style>
- </style>
- <style lang="scss" scoped>
- view {
- font-size: 28rpx;
- // line-height: inherit;
- }
- .menu {
- position: fixed;
- top: 180rpx;
- border-bottom: #FCCF41;
- background-color: #FFFFFF;
- justify-content: space-around;
- height: 5%;
- width: 100%;
- display: flex;
- z-index: 10;
- }
- .menu-item p {
- font-weight: 600;
- &.lor {
- border-bottom: 5rpx solid #F0D232;
- color: #F0D232;
- padding-bottom: 15rpx;
- }
- }
- .signup {
- display: flex;
- align-items: center;
- justify-content: space-around;
- width: 100%;
- position: fixed;
- padding-bottom: 10rpx;
- bottom: 0rpx;
- display: flex;
- height: 100rpx;
- padding-top: 2%;
- box-shadow: 0rpx 5rpx 40rpx #ccc;
- // width: 100%;
- // position: fixed;
- // bottom: 0rpx;
- // display: flex;
- // height: 90rpx;
- // background-color: #FFFFFF;
- // justify-content: space-around;
- // ;
- // /* 垂直居中 */
- // align-items: center;
- }
- .signupbtn p {
- font-size: 32rpx;
- }
- .btn1 {
- // width: 60%;
- background-color: #f2d22d;
- color: #000;
- border-color: #ffffff;
- border-radius: 10rpx;
- font-size: 32rpx;
- line-height: 200%;
- letter-spacing: 10rpx;
- font-weight: 500;
- height: 100%;
- width: 280rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .auto-btn {
- width: 300rpx;
- text-align: center;
- background-color: #FCCF41;
- border-radius: 10rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- line-height: 180%;
- margin-right: 10%;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .auto-text {
- display: inline-block;
- // font-size:32rpx;
- }
- .weixinlogo {
- display: inline-block;
- padding-right: 5rpx;
- width: 35rpx;
- height: 35rpx;
- }
- .radio {
- color: #F0D232;
- }
- .taskimg {
- width: 30rpx;
- height: 30rpx;
- background-image: url(../../../static/home/home12.png);
- background-size: 30rpx;
- background-repeat: no-repeat;
- box-sizing: border-box;
- display: inline-block;
- vertical-align: middle;
- &.on {
- background-image: url(../../../static/home/home13.png);
- }
- }
- .func {
- display: flex;
- justify-content: space-between;
- }
- .func-left {
- display: flex;
- align-items: center;
- }
- .func-right {
- display: flex;
- justify-content: center;
- padding: 0 0 0 1%;
- }
- .func-btn {
- display: flex;
- align-items: center;
- padding-left: 20rpx;
- }
- .func-btn span {
- color: #333333;
- font-size: 30rpx;
- font-weight: 500;
- }
- .func-btn image {
- vertical-align: middle;
- width: 30rpx;
- height: 30rpx;
- display: inline-block;
- padding-right: 14rpx;
- }
- .head-img {
- vertical-align: middle;
- width: 50rpx;
- height: 50rpx;
- display: inline-block;
- padding-right: 30rpx;
- }
- .ipon {
- color: #333333;
- font-size: 30rpx;
- font-weight: 500;
- margin-bottom: 10rpx;
- }
- .card {
- width: 88%;
- padding: 24rpx;
- margin-top: 30rpx;
- border-radius: 10rpx;
- background-color: #ffffff;
- margin: 0 auto;
- box-shadow: 0px 0px 10rpx 2rpx #CCCCCC;
- }
- .butto {
- text-align: center;
- }
- .option {
- padding: 20rpx;
- }
- .uni-margin-wrap {
- width: 690rpx;
- width: 100%;
- ;
- }
- .swiper {
- height: 300rpx;
- }
- .swiper-item {
- display: block;
- height: 300rpx;
- line-height: 300rpx;
- text-align: center;
- }
- .swiper-list {
- margin-top: 40rpx;
- margin-bottom: 0;
- }
- .uni-common-mt {
- margin-top: 60rpx;
- position: relative;
- }
- .info {
- position: absolute;
- right: 20rpx;
- }
- .uni-padding-wrap {
- width: 550rpx;
- padding: 0 100rpx;
- }
- </style>
|