|
|
@@ -24,8 +24,11 @@
|
|
|
|
|
|
</view>
|
|
|
<view class="btn-box">
|
|
|
-
|
|
|
- <view class="sub-btn" @click="addAddress()">新建收货地址</view>
|
|
|
+ <view class="sub-btn flex-1" @click="addAddress()">新建收货地址</view>
|
|
|
+ <view class="icon-btn" style="width: 15%;" @click="openShare">
|
|
|
+ <image src="/static/images/icon_wx.png" mode="aspectFill"></image>
|
|
|
+ <text>分享</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -49,10 +52,25 @@
|
|
|
},
|
|
|
methods: {
|
|
|
selectAddress(item){
|
|
|
- uni.$emit('updateAddress',item);
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
+ // 获取当前所有页面栈
|
|
|
+ const pages = getCurrentPages();
|
|
|
+ if (pages.length >= 2) {
|
|
|
+ const prevPage = pages[pages.length - 2];
|
|
|
+ if (prevPage.route === 'pages_mall/index' || prevPage.route === 'pages/user/index') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: './addEditAddress?type=edit&addressId='+item.addressId
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.$emit('updateAddress',item);
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: './addEditAddress?type=edit&addressId='+item.addressId
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
editAddress(item){
|
|
|
uni.navigateTo({
|
|
|
@@ -114,6 +132,42 @@
|
|
|
uni.navigateTo({
|
|
|
url: './addEditAddress?type=add'
|
|
|
})
|
|
|
+ },
|
|
|
+ openShare() {
|
|
|
+ //#ifdef H5
|
|
|
+ uni.showToast({
|
|
|
+ title: '请使用APP操作',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ //#endif
|
|
|
+
|
|
|
+ //#ifdef APP-PLUS
|
|
|
+ uni.share({
|
|
|
+ provider: "weixin",
|
|
|
+ scene: 'WXSceneSession',
|
|
|
+ type: 5,
|
|
|
+ imageUrl: 'https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/app/app-address.jpg', //分享封面图片
|
|
|
+ title: '乐享韶华-邀请你填写地址,下单更方便', // 分享标题
|
|
|
+ miniProgram: {
|
|
|
+ id: getApp().globalData.miniprogamId,
|
|
|
+ path: '/pages_user/user/address',
|
|
|
+ type: 0, //0-正式版; 1-测试版; 2-体验版。 默认值为0。
|
|
|
+ webUrl: "http://uniapp.dcloud.io"
|
|
|
+ },
|
|
|
+ success: function(res) {
|
|
|
+ uni.showToast({
|
|
|
+ title: "分享成功",
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ // 此处是调起微信分享失败的回调
|
|
|
+ },
|
|
|
+ complete: (e) => {
|
|
|
+ console.log("WXSceneSession", e)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //#endif
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -214,6 +268,9 @@
|
|
|
left: 0;
|
|
|
box-sizing: border-box;
|
|
|
background: #FFFFFF;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
|
|
|
.sub-btn{
|
|
|
|
|
|
@@ -229,5 +286,22 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .icon-btn {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ image {
|
|
|
+ width: 55rpx;
|
|
|
+ height: 55rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ text {
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #222222;
|
|
|
+ }
|
|
|
+ }
|
|
|
</style>
|
|
|
|