You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
330 lines
9.4 KiB
330 lines
9.4 KiB
<template>
|
|
<view id="ordershare">
|
|
<view class="header">
|
|
<view class="statustxt">支付完成,货物整装待发</view>
|
|
<view class="infomation">
|
|
<view class="item mar-r">
|
|
<view class="title">昵称</view>
|
|
<view class="text">{{info.accept_name}}</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="title">手机号</view>
|
|
<view class="text">{{info.mobile}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="goods-info">
|
|
<view class="title mx-1px-bottom">
|
|
<view>
|
|
商品信息
|
|
</view>
|
|
<view :data-id="info.items[0].item_meta.detail_id" class="buy" @tap="jumpDetail">
|
|
去购买
|
|
</view>
|
|
</view>
|
|
<view class="middle-item mx-1px-bottom" :data-id="item.item_meta.detail_id" v-for="(item, index) in info.items" :key="index" @tap="jumpDetail">
|
|
<image :src="item.item_meta.image"></image>
|
|
<view class="text">
|
|
<view class="names">
|
|
{{item.item_name}}
|
|
</view>
|
|
<view class="model">
|
|
{{item.item_meta.specs_text}}
|
|
</view>
|
|
</view>
|
|
<view class="money-box">
|
|
<view>
|
|
{{item.quantity}}件
|
|
</view>
|
|
<view>
|
|
¥{{item.units_total_yuan}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="somebody" v-if="info.users_avatar && info.users_avatar.length">
|
|
<view class="title mx-1px-bottom">还有这些朋友订购了这件商品</view>
|
|
<view class="content">
|
|
<view class="item-img" v-for="(item, index) in info.users_avatar" :key="index" >
|
|
<image :src="item"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="order-info">
|
|
<view class="item mx-1px-bottom">
|
|
<view class="title">下单时间</view>
|
|
<view class="txt">{{info.submit_time}}</view>
|
|
</view>
|
|
<view class="item mx-1px-bottom">
|
|
<view class="title">商品总数</view>
|
|
<view class="txt">{{info.count}}件</view>
|
|
</view>
|
|
<view class="item mx-1px-bottom">
|
|
<view class="title">总价格</view>
|
|
<view class="txt">¥ {{info.total_yuan}}</view>
|
|
</view>
|
|
<view class="item mx-1px-bottom">
|
|
<view class="title">支付时间</view>
|
|
<view class="txt">{{info.pay_time}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="call-goods" v-if="info.commend_goods && info.commend_goods.length">
|
|
<view class="title mx-1px-bottom">
|
|
相关推荐
|
|
</view>
|
|
<view class="content">
|
|
<view class="like_list">
|
|
<view class="like_box" :data-id="item.id" v-for="(item, index) in info.commend_goods" :key="index" @tap="jumpDetail">
|
|
<view>
|
|
<view class="like_image">
|
|
<image class="responsive" :src="item.img"></image>
|
|
</view>
|
|
<view class="like_name">
|
|
{{item.name}}
|
|
</view>
|
|
<view class="like_money">
|
|
¥{{item.sell_price}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- #ifdef APP-PLUS || MP-WEIXIN -->
|
|
<view class="order-share" @tap="changeShare" v-if="info.is_share_order == 1">
|
|
<view class="text" :style="'background: ' + config.mainColor">订单分享</view>
|
|
</view>
|
|
<!-- #endif -->
|
|
<!-- #ifdef H5 -->
|
|
<view class="order-share" @tap="togglePopup('middle-img')" v-if="info.is_share_order == 1">
|
|
<view class="text" :style="'background: ' + config.mainColor">订单分享</view>
|
|
</view>
|
|
<!-- #endif -->
|
|
|
|
<!--点击分享弹出层-->
|
|
<!--弹出分享部分-->
|
|
<view class="maks" :class="show_share ? 'cur' : ''" @tap="changeShare">
|
|
|
|
|
|
</view>
|
|
|
|
<view class="share-box" :class="show_share ? 'cur' : ''">
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<button class="shaer-item" open-type="share">
|
|
分享给好友
|
|
</button>
|
|
<!-- #endif -->
|
|
<!-- #ifdef APP-PLUS -->
|
|
<button class="shaer-item" @click="shareapp">
|
|
分享给好友
|
|
</button>
|
|
<!-- #endif -->
|
|
<view class="shaer-item mx-1px-top" @tap="getShearImg">
|
|
生成海报
|
|
</view>
|
|
<view class="shaer-item clear" @tap="changeShare">
|
|
取消
|
|
</view>
|
|
</view>
|
|
<!-- #ifdef H5 -->
|
|
<view >
|
|
<uni-popup :show="type === 'middle-img'" position="top" mode="fixed" @hidePopup="togglePopup('')">
|
|
<view class="uni-center center-box">
|
|
<image style="position: absolute; top: 0;right:0" @tap="togglePopup('')" class="image" src="/static/ico-share-wechat.png" />
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
<!-- #endif -->
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
show_share: false,
|
|
info: '',
|
|
is_order: true,
|
|
order_no: '',
|
|
config: '',
|
|
type:0
|
|
};
|
|
},
|
|
|
|
onLoad(e) {
|
|
// 第三方平台配置颜色
|
|
var bgConfig = this.$cookieStorage.get('globalConfig') || '';
|
|
this.setData({
|
|
config: bgConfig
|
|
});
|
|
var order_no = e.order_no;
|
|
|
|
if (e.scene) {
|
|
var scene = decodeURIComponent(e.scene);
|
|
var sceneArr = scene.split(',');
|
|
order_no = sceneArr[0];
|
|
}
|
|
|
|
this.setData({
|
|
order_no: order_no
|
|
});
|
|
|
|
if (!e.is_order) {
|
|
this.setData({
|
|
is_order: false
|
|
});
|
|
}
|
|
|
|
this.queryOrderInfo(order_no);
|
|
},
|
|
|
|
//分享给好友
|
|
onShareAppMessage(res) {
|
|
return {
|
|
title: this.info.accept_name + this.info.share_order_title || '分享了一个订单',
|
|
path: '/pages/order/orderShare/orderShare?order_no=' + this.order_no
|
|
};
|
|
},
|
|
methods: {
|
|
togglePopup(type) {
|
|
this.type = type;
|
|
},
|
|
shareapp(){
|
|
var accept_name = this.info.accept_name;
|
|
var share_order_title = this.info.share_order_title;
|
|
order_no = this.order_no;
|
|
uni.getProvider({
|
|
service:'share',
|
|
success:function(res){
|
|
uni.share({
|
|
provider: "weixin",
|
|
scene: "WXSceneSession",
|
|
type: 5,
|
|
title:accept_name + share_order_title,
|
|
imageUrl:'https://cdn.guojiang.club/guojiang_logo.png',
|
|
miniProgram:{
|
|
id:'gh_72e65196278a',
|
|
path:'pages/order/orderShare/orderShare?order_no=' + order_no,
|
|
type:0,
|
|
webUrl: 'https://guojiang.club'
|
|
},
|
|
success: function (res) {
|
|
console.log("success:" + JSON.stringify(res));
|
|
},
|
|
fail: function (err) {
|
|
console.log("fail:" + JSON.stringify(err));
|
|
}
|
|
});
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
changeShare() {
|
|
this.setData({
|
|
show_share: !this.show_share
|
|
});
|
|
},
|
|
|
|
jumpDetail(e) {
|
|
var id = e.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: '/pages/store/detail/detail?id=' + id
|
|
});
|
|
},
|
|
|
|
getShearImg() {
|
|
wx.navigateTo({
|
|
url: '/pages/order/shareImg/shareImg?order_no=' + this.order_no
|
|
});
|
|
},
|
|
|
|
queryOrderInfo(order_no) {
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
mask: true
|
|
});
|
|
var token = this.$cookieStorage.get('user_token') || '';
|
|
this.$http.ajax({
|
|
method: this.is_order ? 'post' : 'get',
|
|
api: 'api/order/' + order_no + '/share',
|
|
header: {
|
|
Authorization: token
|
|
}
|
|
}).then(res => {
|
|
if (res.statusCode == 200) {
|
|
res = res.data;
|
|
|
|
if (res.status) {
|
|
this.setData({
|
|
info: res.data
|
|
});
|
|
|
|
if (res.data.is_share_order == 0) {
|
|
wx.hideShareMenu();
|
|
}
|
|
// #ifdef H5
|
|
if(res.data.is_share_order != 0){
|
|
if (this.$wechat && this.$wechat.isWechat()) {
|
|
var title = this.info.accept_name + this.info.share_order_title || '分享了一个订单'
|
|
this.$wechat.share({
|
|
title: title
|
|
});
|
|
}
|
|
}
|
|
// #endif
|
|
} else {
|
|
wx.showModal({
|
|
content: res.message || '请求失败',
|
|
showCancel: false
|
|
});
|
|
}
|
|
} else {
|
|
wx.showModal({
|
|
content: '请求失败',
|
|
showCancel: false
|
|
});
|
|
}
|
|
|
|
wx.hideLoading();
|
|
}).catch(() => {
|
|
wx.hideLoading();
|
|
wx.showModal({
|
|
content: '请求失败',
|
|
showCancel: false
|
|
});
|
|
});
|
|
},
|
|
|
|
setData: function (obj) {
|
|
let that = this;
|
|
let keys = [];
|
|
let val, data;
|
|
Object.keys(obj).forEach(function (key) {
|
|
keys = key.split('.');
|
|
val = obj[key];
|
|
data = that.$data;
|
|
keys.forEach(function (key2, index) {
|
|
if (index + 1 == keys.length) {
|
|
that.$set(data, key2, val);
|
|
} else {
|
|
if (!data[key2]) {
|
|
that.$set(data, key2, {});
|
|
}
|
|
}
|
|
|
|
data = data[key2];
|
|
});
|
|
});
|
|
}
|
|
},
|
|
computed: {},
|
|
watch: {}
|
|
};
|
|
</script>
|
|
<style rel="stylesheet/less" lang="less">
|
|
@import "orderShare";
|
|
</style>
|