删除冗余代码

This commit is contained in:
唐明明
2022-08-29 11:08:37 +08:00
34 changed files with 10591 additions and 4428 deletions

View File

@@ -31,158 +31,189 @@
</template>
<script>
import {
smsAuth,
getInvitationSms,
keyAuth
} from '@/apis/interfaces/auth.js'
export default {
data() {
return {
phone : '',
code : '',
parentId : '',
getSms : false,
sendCode : '获取验证码',
isShowParent: false,
isKeyAuth : false
};
},
onShow () {
uni.showLoading({
title: '加载中...',
mask : true
})
// 预登录
uni.preLogin({
provider: 'univerify',
success: res => {
this.isKeyAuth = true
},
complete() {
uni.hideLoading()
}
})
},
methods: {
// 获取验证码
getPhoneCode() {
uni.showLoading({
title : '加载中...',
mask :true
})
let outTime;
let smsTime = 60;
getInvitationSms({
mobileNo: this.phone,
}).then(res => {
uni.showToast({
title: res.message,
icon: "none",
});
this.isShowParent = res.is_show_parent
this.getSms = true;
this.sendCode = smsTime + 's后重新获取';
outTime = setInterval(() => {
if (smsTime <= 1) {
this.getSms = false;
this.sendCode = '重新获取';
clearInterval(outTime);
return
}
this.sendCode = smsTime + 's后重新获取';
smsTime -= 1;
}, 1000);
}).catch((err) => {
uni.showToast({
title: err.message,
icon: "none",
});
});
},
// 登录
login(type) {
if (type === 'code') {
uni.showLoading({
title: '登录中'
})
smsAuth({
mobileNo : this.phone,
code : this.code,
parent_id : this.parentId
}).then((res) => {
this.setAuthToken(res.token_type + ' ' + res.access_token, res.is_new)
uni.hideLoading()
}).catch((err) => {
uni.showToast({
title: err.message,
icon: "none",
});
});
return
}
if (type === 'Akey') {
this.onKeyLogin()
}
},
// 一键登录
onKeyLogin(){
uni.login({
provider:'univerify',
univerifyStyle:{
icon: {
path: require('@/static/logo.png')
},
authButton: {
normalColor: '#34CE98',
highlightColor: '#25b381',
disabledColor: '#25b381'
},
otherLoginButton: {
visible: false
},
privacyTerms: {
termsColor: '#34CE98',
uncheckedImage: require('@/static/icon/unchecked-icon.png'),
checkedImage: require('@/static/icon/checked-icon.png')
}
},
success: Result => {
if(Result.errMsg === 'login:ok'){
let {access_token, openid} = Result.authResult
keyAuth({
access_token,
openid
}).then(res => {
this.setAuthToken(res.token_type + ' ' + res.access_token, res.is_new)
uni.closeAuthView()
}).catch(err => {
uni.showToast({
title: '登录失败:' + err.message,
icon : 'none'
})
uni.closeAuthView()
})
}
},
fail: err => {
console.log(err)
}
})
},
// setToken
setAuthToken(token, isNew){
this.$store.commit('setToken', token);
if(isNew){
uni.setStorageSync('isnew', 0)
this.$Router.replace({name: 'AuthRole'})
return
}
uni.setStorageSync('isnew', 1)
this.$Router.pushTab({name: 'Life'})
}
}
}
import {
smsAuth,
getInvitationSms,
keyAuth
} from '@/apis/interfaces/auth.js'
export default {
data() {
return {
phone: '',
code: '',
parentId: '', // 父类邀请码
getSms: false,
sendCode: '获取验证码',
isShowParent: false,
isKeyAuth: false,
shareId: ''
};
},
onShow() {
setTimeout(() => {
if (plus.runtime.arguments.split('?')[1]) {
let args = plus.runtime.arguments.split('?')[1]
this.shareId = args.split('invitation')[0]
this.parentId = args.split('invitation')[1]
}
}, 100);
uni.showLoading({
title: '加载中...',
mask: true
})
// 预登录
uni.preLogin({
provider: 'univerify',
success: res => {
this.isKeyAuth = true
},
complete() {
uni.hideLoading()
}
})
},
methods: {
// 获取验证码
getPhoneCode() {
uni.showLoading({
title: '加载中...',
mask: true
})
let outTime;
let smsTime = 60;
getInvitationSms({
mobileNo: this.phone,
}).then(res => {
uni.showToast({
title: res.message,
icon: "none",
});
this.isShowParent = res.is_show_parent
this.getSms = true;
this.sendCode = smsTime + 's后重新获取';
outTime = setInterval(() => {
if (smsTime <= 1) {
this.getSms = false;
this.sendCode = '重新获取';
clearInterval(outTime);
return
}
this.sendCode = smsTime + 's后重新获取';
smsTime -= 1;
}, 1000);
}).catch((err) => {
uni.showToast({
title: err.message,
icon: "none",
});
});
},
// 登录
login(type) {
if (type === 'code') {
uni.showLoading({
title: '登录中'
})
smsAuth({
mobileNo: this.phone,
code: this.code,
parent_id: this.parentId
}).then((res) => {
this.setAuthToken(res.token_type + ' ' + res.access_token, res.is_new)
uni.hideLoading()
}).catch((err) => {
uni.showToast({
title: err.message,
icon: "none",
});
});
return
}
if (type === 'Akey') {
this.onKeyLogin()
}
},
// 一键登录
onKeyLogin() {
uni.login({
provider: 'univerify',
univerifyStyle: {
icon: {
path: require('@/static/logo.png')
},
authButton: {
normalColor: '#34CE98',
highlightColor: '#25b381',
disabledColor: '#25b381'
},
otherLoginButton: {
visible: false
},
privacyTerms: {
termsColor: '#34CE98',
uncheckedImage: require('@/static/icon/unchecked-icon.png'),
checkedImage: require('@/static/icon/checked-icon.png')
}
},
success: Result => {
if (Result.errMsg === 'login:ok') {
let {
access_token,
openid
} = Result.authResult
keyAuth({
access_token,
openid
}).then(res => {
this.setAuthToken(res.token_type + ' ' + res.access_token, res
.is_new)
uni.closeAuthView()
}).catch(err => {
uni.showToast({
title: '登录失败:' + err.message,
icon: 'none'
})
uni.closeAuthView()
})
}
},
fail: err => {
console.log(err)
}
})
},
// setToken
setAuthToken(token, isNew) {
this.$store.commit('setToken', token);
if (isNew) {
uni.setStorageSync('isnew', 0)
this.$Router.replace({
name: 'AuthRole',
params: {
shareId: this.shareId
}
})
return
}
uni.setStorageSync('isnew', 1)
if (this.shareId != '' && this.shareId != undefined) {
setTimeout(() => {
uni.hideLoading()
plus.runtime.arguments = null;
plus.runtime.arguments = '';
uni.reLaunch({
url: '/pages/group-book/success/success?access=1&id=' + this.shareId
})
}, 1000)
} else {
this.$Router.pushTab({
name: 'Life'
})
}
}
}
}
</script>
<style lang="scss">

View File

@@ -71,7 +71,19 @@
storage_id : this.storageId
}).then(res => {
uni.setStorageSync('isnew', 1)
this.$Router.pushTab({name: 'Life'})
if(this.$Route.query.shareId!='' && this.$Route.query.shareId != undefined){
setTimeout(() => {
uni.hideLoading()
plus.runtime.arguments = null;
plus.runtime.arguments = '';
uni.reLaunch({
url: '/pages/group-book/success/success?access=1&id=' + this.$Route.query.shareId
})
}, 1000)
}else{
this.$Router.pushTab({name: 'Life'})
}
uni.setStorageSync('isnew', 1)
}).catch(err => {
this.disabled = false
uni.showToast({

BIN
pages/group-book/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,416 @@
<template>
<view class="pin-detail">
<view class="goods">
<image class="cover" :src="goods.cover" mode="aspectFill" />
<view class="info">
<view class="title">{{goods.name}} </view>
<view class="subtitle">
<view class="hasPined" v-if="collage.sale>0">
<image src="/static/store/fire.png" mode="widthFix" />已拼{{collage.sale}}
</view>
<view class="tuan">{{collage.number}}人团</view>
</view>
<view class="price">
<view class="now">{{goods.price}}<span>DT积分</span></view>
<view class="old"> {{goods.cost}}积分 </view>
</view>
</view>
</view>
<view class="pin">
<view class="title">
<block v-if="collage.down>0 && collage.status == 3">
<u-count-down :time="collage.down" format="DD:HH:mm:ss" autoStart millisecond @change="onChange">
&nbsp; </u-count-down>
距离结束<span>{{ timeData.days }}</span>&nbsp;
<span>{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;</span>小时<span>{{ timeData.minutes }}&nbsp;</span>分钟<span>{{ timeData.seconds }}&nbsp;</span>
</block>
<block v-if="collage.status != 3">
<span>{{collage.status_text}}</span>
</block>
</view>
<view class="avatars">
<block>
<image v-for="(item,index) in users" :key='index+1' :class="['avatar',item.master?'pin':''] " :src="item" mode="aspectFill" />
</block>
<block v-if="collage.surplus>0">
<image v-for="(item,index) in collage.surplus" :key='index+2' class="wen" src="/static/book/wen.png" mode="aspectFill" />
</block>
</view>
<view class="title" v-if="collage.sale>0">已拼<span>{{collage.sale}}</span></view>
<view class="progress">
{{collage.number - collage.surplus}}
<u-line-progress activeColor="#34ce98" class="line" :percentage="collage.score" :showText="false" />
{{collage.number}}
</view>
</view>
<view class="warn" v-if="collage.status == 3 || collage.status == 2">完成支付后需在24小时内邀请好友参加拼团否则拼团失败自动退款</view>
<view class="order" v-if="orderDetail.order_no != ''">
<view class="title">订单详情</view>
<view class="order-item">
<view class="order-item-title">订单编号</view>
<view class="order-item-detail">{{orderDetail.order_no}}</view>
</view>
<view class="order-item">
<view class="order-item-title">下单时间</view>
<view class="order-item-detail">{{orderDetail.created_at}}</view>
</view>
<view class="order-item">
<view class="order-item-title">支付时间</view>
<view class="order-item-detail">{{orderDetail.paid_at}}</view>
</view>
<view class="order-item" v-if="collage.status == 1&& express.deliver_at">
<view class="order-item-title">发货时间</view>
<view class="order-item-detail">{{ express.deliver_at || '--'}}</view>
</view>
<view class="order-item" v-if="collage.status == 1 && express.receive_at">
<view class="order-item-title">签收时间</view>
<view class="order-item-detail">{{ express.receive_at || '--'}}</view>
</view>
<view class="order-item">
<view class="order-item-title">支付方式</view>
<view class="order-item-detail">DT支付</view>
</view>
<view class="order-item">
<view class="order-item-title">备注信息</view>
<view class="order-item-detail">{{orderDetail.remark || '--'}}</view>
</view>
</view>
<view class="btn" v-if="collage.status == 1 && can">
<view v-if="can.logistic_show" @click="onBtn('logistic')" class="btn-item"> 查看物流 </view>
<view v-if="can.sign" @click="onBtn('sign')" class="btn-item success"> 确认签收 </view>
</view>
</view>
</template>
<script>
import {
myPinDetail
} from '@/apis/interfaces/pin.js'
import { sign } from '@/apis/interfaces/order'
export default {
data() {
return {
orderDetail: {},
goods: {},
collage: {},
users: [],
timeData: {},
express: {},
can: {}
};
},
onLoad() {
this.getInfo()
},
methods: {
getInfo(){
myPinDetail(this.$Route.query.id).then(res => {
this.orderDetail = res.order_detail;
this.goods = res.item;
let collage = res.collage;
collage.score = 100
this.collage = collage;
this.users = res.users;
this.express = res.order_detail.express;
this.can = res.order_detail.can;
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none",
mask: true,
duration: 3000
})
})
},
onChange(e) {
this.timeData = e
},
onBtn(type) {
switch (type) {
case 'logistic':
this.$Router.push({
name: 'OrderLogistics',
params: {
orderNo: this.orderDetail.order_no,
},
});
break;
case 'sign':
uni.showModal({
title: '温馨提示',
content: '是否确认收到货物并签收该订单',
confirmText: '确认签收',
confirmColor: "#34CE98",
cancelText: '再想想',
cancelColor: "#666666",
success: (res) => {
if (res.confirm) {
sign(this.orderDetail.order_no).then(res => {
this.getInfo();
return;
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
}
}
});
break;
}
}
}
}
</script>
<style lang="scss">
.pin-detail {
background-color: $window-color;
min-height: 100vh;
position: relative;
.goods {
padding: $padding;
border-top: solid 20rpx #f9f9f9;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
background-color: #fff;
.cover {
width: 200rpx;
height: 200rpx;
border-radius: 10rpx;
}
.info {
flex: 1;
margin-left: 20rpx;
font-size: 32rpx;
.title {
font-size: 32rpx;
color: #454545;
}
.subtitle {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
color: #999;
font-size: 26rpx;
margin-top: 20rpx;
.hasPined {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
color: #d81e06;
background-color: rgba(255, 0, 0, .1);
padding: 4rpx 24rpx;
border-radius: 30rpx;
image {
width: 34rpx;
height: 34rpx;
margin: 6rpx;
}
}
.tuan {
margin-left: 20rpx;
}
}
.price {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
margin-top: 20rpx;
margin-left: 10rpx;
.now {
font-size: 38rpx;
font-weight: bold;
color: #d81e06;
span {
font-weight: normal;
font-size: 24rpx;
padding-left: 4rpx;
}
}
.old {
font-weight: normal;
font-size: 26rpx;
color: #999;
margin-left: 30rpx;
text-decoration: line-through;
padding-top: 16rpx;
}
}
}
}
.pin {
margin-top: $margin - 10;
background-color: #fff;
padding: $padding;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
.title {
font-size: 30rpx;
color: #454545;
span {
color: #d81e06;
font-size: 36rpx;
font-weight: bold;
padding: 0 6rpx;
}
}
.progress {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
color: #454545;
font-size: 28rpx;
margin-top: $margin*2 - 20;
.line {
flex: 1;
margin: 0 $margin - 10;
}
}
.avatars {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
position: relative;
margin-top: $margin;
image {
width: 100rpx;
height: 100rpx;
// padding: 20rpx;
border-radius: 50%;
margin: 10rpx 20rpx;
border: solid 2rpx #f9f9f9;
}
.pin {
position: relative;
&::after {
position: absolute;
top: 0;
left: 0;
content: '拼主';
background: orange;
padding: 4rpx 0;
font-size: 20rpx;
width: 100%;
text-align: center;
color: #fff;
}
}
}
}
.warn {
text-align: center;
padding: $padding - 10 $padding + 20;
color: grey;
font-size: 26rpx;
}
.order {
background-color: #fff;
padding: $padding;
margin-top: 20rpx;
padding-bottom: 150rpx;
.title {
font-size: 32rpx;
color: #454545;
font-weight: bold;
border-bottom: solid 1rpx #f9f9f9;
padding-bottom: 20rpx;
}
.order-item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
;
box-sizing: border-box;
color: #454545;
padding: $padding 0;
border-bottom: solid 1rpx #f9f9f9;
.order-item-title {
font-size: 30rpx;
}
.order-item-detail {
font-size: 30rpx;
}
}
}
.btn {
position: fixed;
bottom: 0;
background-color: #fff;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
padding: 0 $padding + 20 $padding $padding + 20;
.btn-item {
font-size: 26rpx;
margin-left: $margin/2;
color: #333;
line-height: 56rpx;
border: solid 1rpx #ddd;
padding: 0 ($margin - 10);
border-radius: 28rpx;
display: inline-block;
margin-top: $margin;
}
.success {
color: #34CE98;
border-color: #34CE98;
}
}
}
</style>

View File

@@ -0,0 +1,215 @@
<template>
<view class="content">
<!-- tabs -->
<u-sticky>
<u-tabs class="tabs" :list="tabs" :scrollable="false" :current="index" lineColor="#34CE98" @click="onTabs"
sticky />
</u-sticky>
<block v-if="array.length >= 1">
<!-- 订单列表 -->
<orderPin v-for="(item, arrayIndex) in array" :key="arrayIndex" :order-info="item" @onBtn="onType" />
<!-- 加载更多 -->
<view class="pages-load">
<u-loadmore :status="status" />
</view>
</block>
<block v-else>
<view class="vertical order-null">
<u-empty mode="order" icon="http://cdn.uviewui.com/uview/empty/order.png" text="暂无相关订单"
textColor="#999" />
</view>
</block>
<!-- 分享 -->
<uni-popup ref="popupShare" type="share" background-color="#fff">
<uni-popup-share title="立即分享到" @select="select" />
</uni-popup>
</view>
</template>
<script>
import {
orders,
del,
cancel,
sign
} from '@/apis/interfaces/order'
import {
myPinList
} from '@/apis/interfaces/pin'
import eventBus from '../../../utils/eventBus.js';
import orderPin from '@/components/oct-order-pin/index.vue'
export default {
components: {
orderPin
},
data() {
return {
status: "loading",
tabs: [{
name: "全部",
type: "",
},
{
name: "拼团中",
type: "3",
},
{
name: "拼团成功",
type: "1",
},
{
name: "拼团失败",
type: "2",
}
],
index: '0',
array: [],
page: 1,
shareInfo: {},
};
},
onLoad() {
this.getOrder()
},
onShow() {
if (this.$store.getters.getRefresh == 1) {
this.$store.commit('setRefresh', 0)
this.array = []
this.page = 1
this.getOrder()
}
},
methods: {
getOrder() {
myPinList({
state: this.tabs[this.index].type,
page: this.page
}).then(res => {
console.log(res)
if (res.page.current === 1) {
this.array = []
}
let ordersArr = res.data.map(val => {
return {
no: val.order_no,
cover: val.item.cover,
name: val.item.name,
price: val.item.price,
sum: 1,
collage: val.collage,
shop: val.shop,
goods_id: val.item.goods_id,
unit: val.item.unit,
users: val.users,
invite: val.invite,
order: val.order,
url: val.url
}
})
this.array = this.array.concat(ordersArr)
this.status = res.page.has_more ? 'loadmore' : 'nomore'
})
},
onTabs(e) {
this.page = 1
this.index = e.index
this.getOrder()
},
onType(e) {
let orderNo = e.order.no;
let shopId = e.order.shop.shop_id;
let goodsId = e.order.goods_id;
switch (e.type) {
case 'share':
this.shareInfo = e.order
this.$refs.popupShare.open();
console.log('触发分享', this.shareInfo)
break;
case 'goInfo':
uni.navigateTo({
url:'/pages/group-book/detail/detail?id='+e.order.no
})
break;
}
},
// 分享选项
select(e) {
console.log(this.shareInfo.url + this.shareInfo.collage.collage_id + 'invitation' + this
.shareInfo.invite, this.shareInfo.collage.surplus, this.shareInfo.cover, this.shareInfo.name)
switch (e.item.name) {
case 'wxchum':
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 0,
href: this.shareInfo.url + this.shareInfo.collage.collage_id + 'invitation' + this
.shareInfo.invite,
title: '【仅剩' + this.shareInfo.collage.surplus + '个名额】邀请您一起拼团',
summary: '好货不用一分钱,点点就能带回家【 ' + this.shareInfo.name + '】',
imageUrl: this.shareInfo.cover,
fail: (err) => {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
},
success: (res) => {
this.shareInfo = {}
}
})
break;
case 'wxcircle':
uni.share({
provider: 'weixin',
scene: 'WXSceneTimeline',
type: 0,
href: this.shareInfo.url + this.shareInfo.collage.collage_id + 'invitation' + this
.shareInfo.invite,
summary: '好货不用一分钱,点点就能带回家【 ' + this.shareInfo.name + '】',
imageUrl: this.shareInfo.cover,
fail: (err) => {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
},
success: (res) => {
this.shareInfo = {}
}
})
break;
}
},
},
onReachBottom() {
if (this.status === 'loadmore') {
this.page += 1
this.status = 'loading'
this.getOrder()
}
}
}
</script>
<style lang="scss">
.content {
background: $window-color;
min-height: 100vh;
}
.tabs {
background: white;
}
// 数据列表空
.order-null {
height: 80vh;
}
// 加载分页
.pages-load {
padding-bottom: $padding;
}
</style>

View File

@@ -1,17 +1,22 @@
<template>
<view class="pinSuccess">
<view class="count-down">
<u-count-down ref="countDown" :time="downTime" format="HH:mm:ss" :autoStart="true" millisecond/>
<view class="count-down" v-if="downTime>0">
<u-count-down ref="countDown" :time="downTime" format="HH:mm:ss" :autoStart="true" millisecond />
</view>
<view class="title"> 还差 <span>{{surplus}}</span> 赶紧邀请好友来拼单吧 </view>
<view class="btn invite"> 邀请好友拼单 </view>
<view class="title" v-if="surplus>0"> 还差 <span>{{surplus}}</span> 赶紧邀请好友来拼单吧 </view>
<block v-if="share.status == 3">
<view class="btn invite" v-if="!share.can_share " @click="onTake"> 参与该拼单 </view>
<view class="btn invite" v-if="share.can_share" @click="onShare"> 邀请好友拼单 </view>
</block>
<view class="btn index" @click="goIndex"> 去首页逛逛</view>
<view class="goodInfo">
<view class="avatars">
<block v-for="(item,index) in details" :key='index'>
<image class="avatar pin" :src="item.cover" mode="aspectFill" />
<block >
<image v-for="(item,index) in details" :key='index+1' :class="['avatar',item.master?'pin':''] " :src="item.cover" mode="aspectFill" />
</block>
<block v-if="surplus>0">
<image v-for="(item,index) in surplus" :key='index+2' class="wen" src="/static/book/wen.png" mode="aspectFill" />
</block>
<image class="wen" src="/static/book/wen.png" mode="aspectFill" />
</view>
<block>
<view class="orderInfo">
@@ -22,13 +27,17 @@
</view>
</view>
<view class="orderInfo">
<view class="left"> 拼单规则 </view>
<view class="left">拼单规则</view>
<view class="right">
<view class="right-title">人满发货 · 人不满退款 · 只能拼一次 </view>
</view>
</view>
</block>
</view>
<!-- 分享 -->
<uni-popup ref="popupShare" type="share" background-color="#fff">
<uni-popup-share title="立即分享到" @select="select" />
</uni-popup>
</view>
</template>
@@ -42,53 +51,108 @@
goodName: '',
details: [],
downTime: 0,
surplus: 1,
order: {}, // order 是{} 标识不是我的订单,否则就是我的订单可以跳转订单详情
surplus: 0,
goods: {}, // order 是{} 标识不是我的订单,否则就是我的订单可以跳转订单详情
share:{},
access: '0', // 参与别人的1 自己的分享的0 后来想想这个接口作用不大了 ~ 闹挺 ~ 所以这个字段暂时不用,用后端返回的新字段来区分是自己的拼单还是别人的拼单;
};
},
onLoad() {
repages(this.$Route.query.id).then(res => {
this.order = res.order
this.goodName = res.order.goods.name
this.downTime = res.share.down * 1000
this.surplus = res.share.surplus
this.details = res.share.details
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none",
mask: true,
duration: 3000
})
this.access = this.$Route.query.access
repages(this.$Route.query.id,{invite:this.invite}).then(res => {
this.share = res.share
this.goods = res.goods
this.goodName = res.goods.name
this.surplus = res.share.surplus
this.details = res.share.details
this.downTime = res.share.down * 1000
uni.setNavigationBarTitle({
title:res.share.status_text
})
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none",
mask: true,
duration: 3000
})
},
onHide() {
try {
if(this.$refs.countDown){
this.$refs.countDown.pause()
}
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
}
})
},
methods: {
onHide() {
try {
if (this.$refs.countDown) {
this.$refs.countDown.pause()
}
} catch (err) {
uni.showToast({
title: err,
icon: 'none'
})
}
},
methods: {
// 参与拼单
onTake(){
console.log()
uni.navigateTo({
url: '/pages/store/goods?id=' + this.goods.goods_id+'&shareId='+this.share.collage_id ,// shareId 代表当前商品详情下面拼单有带 id
})
},
// 分享
onShare() {
this.$refs.popupShare.open();
},
// 分享选项
select(e) {
switch (e.item.name) {
case 'wxchum':
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 0,
href: this.share.url + this.share.collage_id+'invitation'+this.share.invite.invite,
title: '【仅剩' + this.surplus +'个名额】邀请您一起拼团',
summary: '好货不用一分钱,点点就能带回家【 ' + this.goods.name + '】',
imageUrl: this.goods.cover,
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
break;
case 'wxcircle':
uni.share({
provider: 'weixin',
scene: 'WXSceneTimeline',
type: 0,
href: this.share.url + this.share.collage_id+'invitation'+this.share.invite.invite,
summary: '好货不用一分钱,点点就能带回家【 ' + this.goods.name + '】',
imageUrl: this.goods.cover,
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
}
})
break;
}
},
// 返回首页
goIndex() {
uni.reLaunch({
url: '/pages/store/index'
})
},
goDetail(){
if(!this.order.order_no){
console.log('不是我的跳商品详情')
uni.navigateTo({
url:'/pages/store/goods?id='+this.order.goods.goods_id
})
}else{
console.log('是我的跳转订单详情')
}
},
// 商品详情
goDetail() {
uni.navigateTo({
url: '/pages/store/goods?id=' + this.goods.goods_id
})
}
}
}
@@ -139,7 +203,7 @@
.index {
background-color: rgba($color: #fff, $alpha: 1.0);
color: $main-color;
color: $main-color;
}
.goodInfo {
@@ -210,7 +274,7 @@
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx 0;
font-size: 26rpx;
font-size: 28rpx;
color: #666;
border-bottom: solid 1rpx #f9f9f9;
@@ -222,7 +286,7 @@
flex-direction: row;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
box-sizing: border-box;
.right-title {
margin-right: 10rpx;

View File

@@ -197,7 +197,9 @@
cancelColor: "#666666",
success: (res) => {
if(res.confirm){
console.log('挑战到我的拼单列表')
uni.navigateTo({
url:'/pages/group-book/list/list'
})
} if(res.cancel){
uni.navigateTo({
url:'/pages/store/index'

BIN
pages/store/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -3,33 +3,34 @@
<!-- 产品封面 -->
<view class="goods-swiper">
<swiper :indicator-dots="false" @change="current = $event.detail.current + 1">
<swiper-item v-for="(item, index) in goods.pictures" :key="index">
<swiper-item v-for="(item, index) in goods.pictures" :key="index+1">
<view class="swiper-cover">
<image :src="item" mode="aspectFill" />
</view>
</swiper-item>
</swiper>
<view class="swiper-pages"> {{current}}/{{goods.pictures.length}}</view>
<view class="swiper-pages"> {{current}}/{{goods.pictures.length}}</view>
<!-- vip 商品提示 -->
<view class="vipGoodsInfo" v-if="shop_vip.status" >{{shop_vip.message}} </view>
<view class="vipGoodsInfo" v-if="shop_vip.status">{{shop_vip.message}} </view>
<!-- 拼团 商品标题上面提示 -->
<view class="vipGoodsInfo" v-if="goods.is_active " >拼团商品</view>
<view class="vipGoodsInfo" v-if="goods.is_active ">拼团商品</view>
</view>
<!-- 详情 -->
<view class="main">
<view class="title"> {{goods.name}} </view>
<view class="sub-title">
<!-- vip 商品前边 tags -->
<span class='vipType' v-if="shop_vip.messageTitle != ''">{{shop_vip.messageTitle}}</span>{{goods.description}}
<view class="sub-title">
<!-- vip 商品前边 tags -->
<span class='vipType'
v-if="shop_vip.messageTitle != ''">{{shop_vip.messageTitle}}</span>{{goods.description}}
</view>
<view class="box-flex">
<view class="box-flex">
<!-- vip 商品展示原价 -->
<view class="price">
<view class="price">
{{goods.price.show}}<text>DT积分</text>
<span class ='del' v-if="shop_vip.status">{{goods.original_price}} DT积分</span>
</view>
<span class='del' v-if="shop_vip.status">{{goods.original_price}} DT积分</span>
</view>
<!-- vip 商品及普通商品展示库存量 -->
<view class="sales" v-if="goods.skus && !goods.is_active">库存量{{goods.skus[0].stock}}</view>
<view class="sales" v-if="goods.skus && !goods.is_active">库存量{{goods.skus[0].stock}}</view>
<!-- 拼团商品展示已拼数量及参团数 -->
<view class="_pin" v-if="goods.is_active">
<view class="_has" v-if="goods.active.count>0">
@@ -47,7 +48,7 @@
<view class=" des"> {{shop_vip.card.description}} </view>
</view>
<view class="btn" @click="toVip">
<!-- 1 开通 2续费 3升级 number 类型 -->
<!-- 1 开通 2续费 3升级 number 类型 -->
查看详情
<!-- {{shop_vip.card.state === 1 ?'立即开通':shop_vip.card.state === 2 ?'立即续费':'立即升级'}} -->
</view>
@@ -59,7 +60,7 @@
</view>
<!-- 可拼团列表 -->
<view class="is_active" v-if="goods.is_active && collages.length>0">
<view class="is_active" v-if="goods.is_active && collages.length>0 && shareId == ''">
<view class="title" v-if="collages.length > 2">
这些人刚刚拼单成功可参与拼单
<span @click="getMorePin = true">查看更多
@@ -74,7 +75,8 @@
<u-avatar-group :urls="item.covers" size="34" gap="0.6" class="avatar-group" />
<view class="nickname"> {{item.names}}</view>
</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">{{ item.can_share?'去分享':'去拼单'}}</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">
{{ item.can_share?'去分享':'去拼单'}}</view>
<view class="noneBtn" v-else @click="showPinToast">去拼单</view>
</view>
</block>
@@ -100,7 +102,7 @@
<!-- 商品详情 -->
<view class="imgs">
<u-notice-bar v-if="shop_vip.status" text="戒指尺寸有大小,请购买戒指时参照详情介绍,备注所选尺寸" fontSize='14' />
<u-notice-bar v-if="shop_vip.status" text="戒指尺寸有大小,请购买戒指时参照详情介绍备注所选尺寸" fontSize='14' />
<block v-for="(item, index) in goods.content" :key="index">
<image :src="item" mode="widthFix" />
</block>
@@ -109,12 +111,14 @@
<!-- 立即购买 shop_vip.status 区分是否是 vip 商品 否则的就却分是拼团商品还是普通商品 -->
<view class="footer">
<view @click="toShop(goods.shop.shop_id)" class="shop"> <uni-icons type="shop" size="26" color="grey" />店铺 </view>
<view @click="toShop(goods.shop.shop_id)" class="shop">
<uni-icons type="shop" size="26" color="grey" />店铺
</view>
<!-- vip 规格弹窗立即领取 -->
<button type="default" v-if="shop_vip.status" hover-class="none" @click="vipBuy">立即领取</button>
<!-- 非vip 规格弹窗 普通商品立即购买拼单商品立即拼单 -->
<block v-else>
<block v-if="goods.is_active">
<block v-if="goods.is_active">
<button type="default" v-if="goods.active.can_join" hover-class="none" @click="buy"> 立即拼单 </button>
<button type="default" v-else hover-class="none" @click="share"> 立即分享 </button>
</block>
@@ -132,7 +136,8 @@
<u-avatar-group :urls="item.covers" size="34" gap="0.6" class="avatar-group" />
<view class="nickname"> {{item.names}}</view>
</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">{{ item.can_share?'去分享':'去拼单'}}</view>
<view class="btn" v-if="goods.active.can_join || item.can_share" @click="toPin(item)">
{{ item.can_share?'去分享':'去拼单'}}</view>
<view class="noneBtn" v-else @click="showPinToast">去拼单</view>
</view>
</block>
@@ -145,7 +150,7 @@
<view scroll-y="true" class="content-2">
<view class="title"> 参与{{collageitem.names}}的拼单 </view>
<view class="number">仅剩<span>{{collageitem.surplus}}</span>个名额</view>
<view class="avatars" v-for="(item,index) in collageitem.details" :key='index' >
<view class="avatars" v-for="(item,index) in collageitem.details" :key='index'>
<image :class="['avatar',item.master?'pin':'']" :src="item.cover" mode="aspectFill" />
<image class="wen" src="/static/book/wen.png" mode="aspectFill" />
</view>
@@ -171,8 +176,9 @@
<view class="sku-title">{{item.name}}</view>
<view class="sku-list">
<block v-for="it in item.values" :key='it.value_id'>
<view :class="['sku-item',specselect[index] == it.value_id ? 'sku-active':'']" @click="clickSkus(index,it.value_id)">
{{it.value}}
<view :class="['sku-item',specselect[index] == it.value_id ? 'sku-active':'']"
@click="clickSkus(index,it.value_id)">
{{it.value}}
</view>
</block>
</view>
@@ -180,7 +186,8 @@
<view class="buy-number">
<view class="buy-title">数量</view>
<uni-number-box :min="1" :max="selectSkusValues.stock" :disabled="selectSkusValues.stock == 0" @change="qty = $event" />
<uni-number-box :min="1" :max="selectSkusValues.stock" :disabled="selectSkusValues.stock == 0"
@change="qty = $event" />
</view>
<!-- 立即购买 shop_vip.status 区分是否是 vip 商品 只支持单规格php 规定不支持多规格 否则的就却分是拼团商品还是普通商品 -->
@@ -189,10 +196,16 @@
@click="vipBuy">立即领取</button>
<!-- 非vip 规格弹窗 普通商品立即购买拼单商品立即拼单 -->
<block v-else>
<button class="now-buy" type="default" hover-class="none" @click="buy2(selectSkusValues)">立即购买</button>
<button class="now-buy" type="default" hover-class="none"
@click="buy2(selectSkusValues)">立即购买</button>
</block>
</scroll-view>
</u-popup>
<!-- 分享 -->
<uni-popup ref="popupShare" type="share" background-color="#fff">
<uni-popup-share title="立即分享到" @select="select" />
</uni-popup>
</view>
</template>
@@ -231,11 +244,16 @@
// "is_receive": false // 当前会员是否已领取过 false 未领取 true 已领取
},
// collageid:'' ,// 拼团 id
collageitem:'',// 已选择的拼团的 item
collageitem: '', // 已选择的拼团的 item
shareId: '', // 从分享页带过来的 id 区分是否能展示可拼团列表及底部按钮直接拼!
};
},
onShow() {
this.getGoods()
if (this.$Route.query.shareId) {
this.shareId = this.$Route.query.shareId;
console.log(this.shareId)
}
},
methods: {
getGoods() {
@@ -263,31 +281,81 @@
this.getMorePin = false
this.pinShow = false
this.qty = 1;
// this.specselect = this.skus[0].unit.split('|')
// this.selectSkusValues = this.skus[0]
// this.specselect = this.skus[0].unit.split('|')
// this.selectSkusValues = this.skus[0]
},
// 去拼单
toPin(item) {
console.log(item);
this.close();
if(item.can_share){
this.share()
}else{
this.collageitem = item
if (item.can_share) {
this.share(item)
} else {
this.pinShow = true;
this.collageitem = item
}
},
// 分享
share(){
console.log(' 分享。。。')
share() {
this.$refs.popupShare.open();
},
// 分享
onShare() {},
// 分享选项
select(e) {
console.log(this.collageitem)
switch (e.item.name) {
case 'wxchum':
uni.share({
provider: 'weixin',
scene: 'WXSceneSession',
type: 0,
href: this.collageitem.url + this.collageitem.collage_id + 'invitation' + this
.collageitem.invite,
title: '【仅剩' + this.collageitem.surplus + '个名额】邀请您一起拼团',
summary: '好货不用一分钱,点点就能带回家【 ' + this.goods.name + '】',
imageUrl: this.goods.cover,
fail: (err) => {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
},
success: (res) => {
this.collageitem = {}
}
})
break;
case 'wxcircle':
uni.share({
provider: 'weixin',
scene: 'WXSceneTimeline',
type: 0,
href: this.collageitem.url + this.collageitem.collage_id + 'invitation' + this
.collageitem.invite,
summary: '好货不用一分钱,点点就能带回家【 ' + this.goods.name + '】',
imageUrl: this.goods.cover,
fail: (err) => {
uni.showToast({
title: err.errMsg,
icon: 'none'
})
},
success: (res) => {
this.collageitem = {}
}
})
break;
}
},
// 弹出 拼团不可点
showPinToast(){
uni.showToast({
title:this.goods.active.message,
icon:'none',
mask:true,
})
showPinToast() {
uni.showToast({
title: this.goods.active.message,
icon: 'none',
mask: true,
})
},
clickSkus(index, id) {
this.skuid = ''
@@ -331,23 +399,23 @@
if (this.shop_vip.is_receive) {
uni.showModal({
title: '温馨提示',
content: this.shop_vip.alert_text+'请联系线下商家:' + this.goods.shop.mobile,
content: this.shop_vip.alert_text + '请联系线下商家:' + this.goods.shop.mobile,
cancelText: '再看看',
cancelColor: '#999',
showCancel:false,
showCancel: false,
confirmColor: '#34ce98',
confirmText: ' 知道了',
success: (res) => {
// if (res.confirm) {
// //#ifdef MP-WEIXIN
// uni.makePhoneCall({
// phoneNumber: '18354789632'
// });
// //#endif
// //#ifdef APP-PLUS
// plus.device.dial('18354789632', true);
// //#endif
// }
// if (res.confirm) {
// //#ifdef MP-WEIXIN
// uni.makePhoneCall({
// phoneNumber: '18354789632'
// });
// //#endif
// //#ifdef APP-PLUS
// plus.device.dial('18354789632', true);
// //#endif
// }
}
})
} else {
@@ -366,7 +434,8 @@
if (res.confirm) {
this.close();
uni.navigateTo({
url: '/pages/store/vip/index/index?id=' + this.goods.shop.shop_id
url: '/pages/store/vip/index/index?id=' + this.goods.shop
.shop_id
})
}
}
@@ -407,14 +476,17 @@
skuId: this.skuid,
qty: this.qty
}
if(this.goods.is_active){
params.type ='pin';
params.collageid = this.collageitem.collage_id || '';
if (this.goods.is_active) {
params.type = 'pin';
params.collageid = this.collageitem.collage_id || '';
}
if (this.shareId != '') {
params.collageid = this.shareId || '';
}
console.log(params)
this.$Router.push({
name: 'StoreBuy',
params:params
params: params
})
this.close()
},
@@ -479,7 +551,8 @@
font-size: $title-size-m;
text-shadow: 0 5rpx 5rpx rgba($color: #000000, $alpha: .02);
}
.vipGoodsInfo{
.vipGoodsInfo {
position: absolute;
bottom: 0;
left: 0;
@@ -488,7 +561,7 @@
color: #fff;
font-size: 30rpx;
padding: 4rpx 30rpx;
border-radius: 0 0 40rpx 0;
border-radius: 0 0 40rpx 0;
}
}
@@ -501,14 +574,16 @@
border-radius: $radius $radius 0 0;
box-shadow: 0 0 10rpx 10rpx rgba($color: #000000, $alpha: .02);
padding-bottom: ($padding*2) + 90;
.vipType{
.vipType {
color: #fff;
font-size:28rpx;
margin-right:10rpx;
font-size: 28rpx;
margin-right: 10rpx;
padding: 2rpx 20rpx;
background-color: #e5c175;
border-radius: 20rpx 0 20rpx 0;
}
.hr {
position: relative;
min-height: 1rpx;
@@ -568,11 +643,12 @@
font-size: 60%;
margin-left: 10rpx;
}
.del{
.del {
text-decoration: line-through;
margin-left: 20rpx;
font-size: 26rpx;
color:#999;
color: #999;
font-weight: normal;
}
}
@@ -737,7 +813,8 @@
padding: 6rpx 20rpx;
border-radius: 10rpx;
}
.noneBtn{
.noneBtn {
border: #999 1rpx solid;
color: #999;
padding: 6rpx 20rpx;
@@ -914,7 +991,7 @@
height: 90rpx;
margin: 10rpx 20rpx;
border-radius: 50%;
border:solid 2rpx #f9f9f9;
border: solid 2rpx #f9f9f9;
}
.me {
@@ -1013,7 +1090,8 @@
padding: 6rpx 20rpx;
border-radius: 10rpx;
}
.noneBtn{
.noneBtn {
border: #999 1rpx solid;
color: #999;
padding: 6rpx 20rpx;
@@ -1150,4 +1228,4 @@
margin-top: $margin;
}
}
</style>
</style>

View File

@@ -25,8 +25,13 @@
<view class="classify-item-title">{{item.name}}</view>
</view>
</view>
</u-scroll-list>
</u-scroll-list>
<!-- 拼团广告图 -->
<view class="collage" v-if="collage_banner!=''">
<image @click="goCollage" :src="collage_banner" mode="widthFix" />
</view>
<!-- 每日上新 -->
<view class="new-box">
<view class="title">上新精选<text class="title-des"> | 精品上新新品推荐</text></view>
@@ -40,11 +45,11 @@
<view class="news-price nowrap">{{item.price.price_min}} <text>DT积分</text></view>
</view>
</view>
</view>
</view>
<!-- VIP换购 -->
<view class="new-box" style="margin-top: 30rpx;" v-if="vips.length>0">
<view class="title">VIP换购 <view class="more"><text class="title-des"> | 款商品任意换购</text> <text
<view class="title">VIP换购 <view class="more"><text class="title-des"> | 款商品任意换购</text> <text
class="more-txt" @click="$Router.push({name: 'VipList'})">更多 ></text></view>
</view>
<view class="news">
@@ -116,7 +121,8 @@
goodsArr: [],
meals: [],
shops: [],
vips:[]
vips:[],
collage_banner:''
};
},
mounted() {
@@ -131,12 +137,17 @@
this.goodTabs = res.categories
this.meals = res.meals
this.shops = res.shops
this.vips = res.vips
this.vips = res.vips
this.collage_banner = res.collage_banner
uni.stopPullDownRefresh()
})
},
goCollage(){
uni.navigateTo({
url:'/pages/group-book/index'
})
},
goBook(item) {
console.log(item)
if (item.url) {
if (item.url.openType === 'navigateTo') {
if (item.url.params != '') {
@@ -302,6 +313,14 @@
&-item:nth-child(2) {
background: #c9ead9;
}
}
// 全民拼团
.collage{
box-sizing: border-box;
image{
width: 100%;
height: 0;
}
}
// 上新精选

View File

@@ -113,7 +113,11 @@
</view>
</block>
</view>
<view class="btns-box">
<view class="btns-box">
<view class="btns-box-item" @click="onBtn('PinList', {})">
<image class="icon" src="@/static/user/userIcon_15.png" mode="widthFix" />
我的拼单 <uni-icons class="forward" type="forward" color="#999" />
</view>
<view class="btns-box-item" @click="onBtn('MyCard', {})">
<image class="icon" src="@/static/user/userIcon_00.png" mode="widthFix" />
我的卡券 <uni-icons class="forward" type="forward" color="#999" />