金诚优选前端代码
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.
 
 
 
 
 

198 lines
5.0 KiB

<template>
<view id="collage">
<view class="white"></view>
<view class="collage-progress">
<progress :percent="percent" stroke-width="4" activeColor="#EA4448" backgroundColor="#DBDBDB"></progress>
<view class="launch active-emj" style="left: 10%">
<view class="iconfont icon-faqipintuan"></view>
<view class="text">发起拼团</view>
</view>
<view class="invite" style="left:40%">
<view class="iconfont icon-yaoqinghaoyou"></view>
<view class="text">邀请好友参团</view>
</view>
<view class="success" style="left: 80%">
<view class="iconfont icon-pintuanchenggong"></view>
<view class="text">拼团成功</view>
</view>
</view>
<view class="white b"></view>
<view class="collage-goods" v-if="detali && detali.data">
<view class="goods-img">
<image mode="widthFix" :src="detali.data.img"></image>
</view>
<view class="goods-infomation">
<view class="info-name">{{detali.data.name}}</view>
<view class="original-cost marg-t">
<view class="price">¥ {{detali.data.sell_price}}
</view>
<view class="o-text">单买价</view>
</view>
<view class="purchase-cost mar-t bor-c">
<view class="price bor-c">¥ {{detali.meta.multiGroupon.price}}
</view>
<view class="o-text p-text">{{detali.meta.multiGroupon.number}}人团</view>
</view>
</view>
</view>
<view class="btn-box">
<view class="btn close" @tap="back">
取消开团
</view>
<view class="btn" @tap="submit">
确认开团
</view>
</view>
</view>
</template>
<script>
import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
export default {
data() {
return {
percent: 0,
detali: ''
};
},
onLoad(e) {
console.log(e.id);
// this.setData({
// id: e.id,
// multi_groupon_id: e.multi_groupon_id
// });
//
this.id=e.id;
this.multi_groupon_id=e.multi_groupon_id;
this.getGoodsDetail(e.id);
},
components: {},
props: {},
methods: {
getGoodsDetail(id) {
wx.showLoading({
title: '加载中',
mask: true
});
this.$http.get({
api: `api/store/detail/${id}`,
data: {
include: 'photos,oneComment,guessYouLike,point,user'
}
}).then(res => {
if (res.statusCode == 200) {
res = res.data;
if (res.status) {
this.setData({
detali: res
});
} else {
wx.showModal({
content: res.message || '请求失败',
showCancel: false
});
}
wx.hideLoading();
} else {
wx.showModal({
content: '请求失败',
showCancel: false
});
wx.hideLoading();
}
}).catch(err => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
},
back() {
wx.redirectTo({
url: '/pages/store/detail/detail?id=' + this.id
});
},
submit() {
var token = this.$cookieStorage.get('user_token');
wx.showLoading({
title: '加载中',
mask: true
});
this.$http.get({
api: 'api/multiGroupon/apply',
header: {
Authorization: token
},
data: {
multi_groupon_id: this.multi_groupon_id
}
}).then(res => {
if (res.statusCode == 200) {
res = res.data;
if (res.status) {
wx.redirectTo({
url: '/pages/store/collage/collage?multi_groupon_item_id=' + res.data.groupon_item_id
});
} else {
wx.showModal({
content: res.message || '请求失败',
showCancel: false
});
}
wx.hideLoading();
} else {
wx.showModal({
content: '请求失败',
showCancel: false
});
wx.hideLoading();
}
}).catch(err => {
wx.showModal({
content: '请求失败',
showCancel: false
});
wx.hideLoading();
});
},
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 "virtual";
</style>