|
@@ -6,15 +6,17 @@
|
|
|
<view class="list-scroll-view">
|
|
|
<view class="one_1">
|
|
|
<text class="localicon iconfont icon-dingweixiao"></text>
|
|
|
- <view class="other">
|
|
|
+ <view class="other" v-if="info._id">
|
|
|
<view class="name">
|
|
|
<text>{{info.name}},</text>{{info.phone}}
|
|
|
</view>
|
|
|
<view class="other_1">
|
|
|
- {{info.address}}
|
|
|
+ <text>{{info.province}}</text><text>{{info.city}}</text>
|
|
|
+ <text>{{info.area}}</text><text>{{info.address}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <text class="iconfont icon-jiantouyou"></text>
|
|
|
+ <view class="address" v-else><text>请选择一个收货地址</text></view>
|
|
|
+ <text @click="toChoose" class="iconfont icon-jiantouyou"></text>
|
|
|
</view>
|
|
|
<view class="one_2">
|
|
|
<view class="list">
|
|
@@ -52,12 +54,12 @@
|
|
|
</view>
|
|
|
<view class="other">
|
|
|
<view class="other_1">运费</view>
|
|
|
- <view class="other_2">¥{{info.freight}}</view>
|
|
|
+ <view class="other_2">¥{{shop.freight}}</view>
|
|
|
</view>
|
|
|
<view class="other">
|
|
|
<view class="other_1">订单备注</view>
|
|
|
<view class="other_3">
|
|
|
- <input type="text" v-model="info.remarks" placeholder="选填,可填写您与卖家达成一致的要求" />
|
|
|
+ <input type="text" v-model="shop.remarks" placeholder="选填,可填写您与卖家达成一致的要求" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -74,6 +76,35 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <uni-popup ref="popup" background-color="#fff" type="right">
|
|
|
+ <view class="content" v-for="(item,index) in addressList" :key="index">
|
|
|
+ <view class="one">
|
|
|
+ <view class="one_1">
|
|
|
+ <view class="name">
|
|
|
+ <text>{{item.name}},</text>{{item.phone}}
|
|
|
+ </view>
|
|
|
+ <view class="address">
|
|
|
+ <text>{{item.province}}</text><text>{{item.city}}</text>
|
|
|
+ <text>{{item.area}}</text><text>{{item.address}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <text class="iconfont icon-jiantouyou"></text>
|
|
|
+ </view>
|
|
|
+ <view class="two">
|
|
|
+ <view class="two_1">
|
|
|
+ <checkbox-group @change="toCheckbox(item)">
|
|
|
+ <label>
|
|
|
+ <checkbox value="checked" style="transform:scale(0.7)" />选择地址
|
|
|
+ </label>
|
|
|
+ </checkbox-group>
|
|
|
+ </view>
|
|
|
+ <view class="two_2">
|
|
|
+ <text class="text" v-if="item.is_default=='1'">默认</text>
|
|
|
+ <text @click="toDel(item)" class="iconfont icon-del"></text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</mobile-frame>
|
|
|
</template>
|
|
|
|
|
@@ -81,13 +112,9 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- info: {
|
|
|
- name: '张饱饱',
|
|
|
- phone: '12345678901',
|
|
|
- money: 79.8,
|
|
|
- freight: 7,
|
|
|
- address: '吉林省 长春市 朝阳区 南湖街道朝阳区吉林省科技厅科研园(富强街西)105'
|
|
|
- },
|
|
|
+ user: {},
|
|
|
+ id: {},
|
|
|
+ info: {},
|
|
|
shop: {
|
|
|
shop: '官方自营店',
|
|
|
status: '1',
|
|
@@ -100,16 +127,93 @@
|
|
|
price: 58,
|
|
|
buy_num: 1,
|
|
|
market_num: 1,
|
|
|
- money: 58
|
|
|
+ money: 58,
|
|
|
+ freight:7
|
|
|
},
|
|
|
+ // 收货地址
|
|
|
+ addressList: [],
|
|
|
+ // 选择地址
|
|
|
+ checked: '',
|
|
|
};
|
|
|
},
|
|
|
- onShow: function() {},
|
|
|
+ onShow: function() {
|
|
|
+ const that = this;
|
|
|
+ that.watchLogin()
|
|
|
+ },
|
|
|
+ onLoad: async function(e) {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `id`, e.id || '');
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 选择收货地址
|
|
|
+ toChoose() {
|
|
|
+ const that = this;
|
|
|
+ that.$refs.popup.open();
|
|
|
+ },
|
|
|
+ // 是否选中
|
|
|
+ toCheckbox(e) {
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, `info`, e);
|
|
|
+ that.$refs.popup.close();
|
|
|
+ },
|
|
|
+ // 删除收货地址
|
|
|
+ toDel(e) {
|
|
|
+ const that = this;
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '确定删除该地址吗?',
|
|
|
+ success: async function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ const arr = await that.$api(`/address/${e._id}`, 'DELETE');
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ uni.showToast({
|
|
|
+ title: '删除信息成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ that.clearPage();
|
|
|
+ that.search();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: arr.errmsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 提交订单
|
|
|
toSubmit() {
|
|
|
|
|
|
},
|
|
|
+ // 监听用户是否登录
|
|
|
+ watchLogin() {
|
|
|
+ const that = this;
|
|
|
+ uni.getStorage({
|
|
|
+ key: 'token',
|
|
|
+ success: function(res) {
|
|
|
+ let user = that.$jwt(res.data);
|
|
|
+ that.$set(that, `user`, user);
|
|
|
+ that.search()
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: `/pages/login/index`
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查询列表
|
|
|
+ async search() {
|
|
|
+ const that = this;
|
|
|
+ let user = that.user;
|
|
|
+ const res = await that.$api(`/address`, 'GET', {
|
|
|
+ customer: user._id
|
|
|
+ })
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ that.$set(that, `addressList`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -128,23 +232,38 @@
|
|
|
|
|
|
.one_1 {
|
|
|
display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ width: 100vw;
|
|
|
padding: 2vw;
|
|
|
border-bottom: 1vw dashed var(--fcColor);
|
|
|
|
|
|
+ .address {
|
|
|
+ flex-grow: 1;
|
|
|
+ margin: 0 0 0 2vw;
|
|
|
+ font-size: var(--font14Size);
|
|
|
+ color: var(--f85Color);
|
|
|
+ }
|
|
|
+
|
|
|
.iconfont {
|
|
|
- line-height: 15vw;
|
|
|
font-size: var(--font20Szie);
|
|
|
}
|
|
|
|
|
|
.other {
|
|
|
width: 82vw;
|
|
|
padding: 0 2vw;
|
|
|
- .name{
|
|
|
+
|
|
|
+ .name {
|
|
|
font-size: var(--font16Size);
|
|
|
}
|
|
|
- .other_1{
|
|
|
+
|
|
|
+ .other_1 {
|
|
|
font-size: var(--font14Size);
|
|
|
color: var(--f85Color);
|
|
|
+
|
|
|
+ text {
|
|
|
+ margin: 0 1vw 0 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -267,4 +386,49 @@
|
|
|
flex-wrap: wrap;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ background-color: var(--f1Color);
|
|
|
+ margin: 2vw 0 0 0;
|
|
|
+
|
|
|
+ .one {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 2vw;
|
|
|
+ background-color: var(--mainColor);
|
|
|
+
|
|
|
+ .name {
|
|
|
+ font-size: var(--font16Size);
|
|
|
+ }
|
|
|
+
|
|
|
+ .address {
|
|
|
+ font-size: var(--font14Size);
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconfont {
|
|
|
+ line-height: 15vw;
|
|
|
+ font-size: var(--font20Szie);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .two {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ border-top: 0.1vw solid var(--fcColor);
|
|
|
+ padding: 2vw;
|
|
|
+ background-color: var(--mainColor);
|
|
|
+ font-size: var(--font14Size);
|
|
|
+
|
|
|
+ .text {
|
|
|
+ margin: 0 2vw 0 0;
|
|
|
+ border: 0.1vw solid var(--fFB1Color);
|
|
|
+ padding: 1vw;
|
|
|
+ font-size: var(--font12Size);
|
|
|
+ border-radius: 2vw;
|
|
|
+ color: var(--fFB1Color);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|