Skip to content

Commit bfdaa45

Browse files
committed
增加会员卡展示
1 parent 38c8716 commit bfdaa45

File tree

8 files changed

+220
-14
lines changed

8 files changed

+220
-14
lines changed

App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
if (e && e.query && e.query.inviter_id) {
3535
this.$u.vuex('referrer', e.query.inviter_id)
3636
}
37+
if (e && e.query && e.query.kjJoinUid) {
38+
this.$u.vuex('kjJoinUid', e.query.kjJoinUid)
39+
}
3740
if (e && e.query && e.query.code) {
3841
// 微信登陆
3942
this.wxmpLogin(e.query.code)
@@ -189,6 +192,7 @@
189192
@import "@/uni_modules/uview-ui/index.scss";
190193
191194
.price-score {
195+
position: relative;
192196
display: flex;
193197
color: #e64340;
194198
font-size: 38rpx;

pages.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@
342342
"style": {
343343
"navigationBarTitleText": "重置交易密码"
344344
}
345+
},
346+
{
347+
"path" : "pages/my/cardlogs",
348+
"style": {
349+
"navigationBarTitleText": "会员卡消费记录"
350+
}
345351
}
346352
],
347353
"subPackages": [

pages/goods/detail.vue

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,26 @@
4444
<view v-if="goodsDetail.basicInfo.characteristic" class="title-sub">
4545
{{ goodsDetail.basicInfo.characteristic }}
4646
</view>
47-
<view class="title-sub" v-if="goodsDetail.basicInfo.commissionType == 1">分享有赏,好友下单后可得
47+
<view class="commission" v-if="goodsDetail.basicInfo.commissionType == 1">分享有赏,好友下单后可得
4848
{{goodsDetail.basicInfo.commission}} 积分奖励
4949
</view>
50-
<view class="title-sub" v-if="goodsDetail.basicInfo.commissionType == 2">分享有赏,好友下单后可得
50+
<view class="commission" v-if="goodsDetail.basicInfo.commissionType == 2">分享有赏,好友下单后可得
5151
{{goodsDetail.basicInfo.commission}}元 现金奖励
5252
</view>
5353
</view>
54+
<u-cell-group v-if="curGoodsKanjia" title="砍价设置">
55+
<u-cell title="数量" :value="curGoodsKanjia.number + '份'"></u-cell>
56+
<u-cell title="已售" :value="curGoodsKanjia.numberBuy + '份'"></u-cell>
57+
<u-cell title="原价" :value="curGoodsKanjia.originalPrice"></u-cell>
58+
<u-cell title="底价" :value="curGoodsKanjia.minPrice"></u-cell>
59+
<u-cell title="截止" :value="curGoodsKanjia.dateEnd"></u-cell>
60+
</u-cell-group>
61+
<view v-if="curKanjiaprogress && curKanjiaprogress.kanjiaInfo.uid != uid" class="curKanjiaJoin">
62+
帮<text>{{curKanjiaprogress.joiner.nick}}</text> 砍价吧!
63+
</view>
64+
<view v-if="curGoodsKanjia && curKanjiaprogress" class="curKanjiaprogress">
65+
<u-line-progress :percentage="100 * (curGoodsKanjia.originalPrice - curKanjiaprogress.kanjiaInfo.curPrice) / (curGoodsKanjia.originalPrice - curGoodsKanjia.minPrice)" activeColor="#ff0000"></u-line-progress>
66+
</view>
5467
<view id="content">
5568
<u-divider text="详细介绍"></u-divider>
5669
<view class="content">
@@ -96,13 +109,22 @@
96109
</view>
97110
</view>
98111
</scroll-view>
99-
<view class="bottom-btns">
112+
<view v-if="curGoodsKanjia && (!curKanjiaprogress || curKanjiaprogress.kanjiaInfo.uid != uid)"
113+
class="bottom-btns">
114+
<view class="btn">
115+
<u-button text="我要砍价" shape="circle" color="linear-gradient(90deg, #ff6034, #ee0a24, #ff6034)"
116+
@click="joinKanjia"></u-button>
117+
</view>
118+
</view>
119+
<view v-else class="bottom-btns">
100120
<!-- #ifdef MP-WEIXIN || MP-BAIDU -->
101121
<view class="icon-btn">
102122
<u-icon name="chat" size="48rpx"></u-icon>
103123
<text>客服</text>
104-
<button open-type='contact' :send-message-title="goodsDetail.basicInfo.name" :send-message-img="goodsDetail.basicInfo.pic"
105-
:send-message-path="'/pages/goods/detail?id='+goodsDetail.basicInfo.id" show-message-card></button>
124+
<button open-type='contact' :send-message-title="goodsDetail.basicInfo.name"
125+
:send-message-img="goodsDetail.basicInfo.pic"
126+
:send-message-path="'/pages/goods/detail?id='+goodsDetail.basicInfo.id"
127+
show-message-card></button>
106128
</view>
107129
<!-- #endif -->
108130
<view class="icon-btn" @click="goCart">
@@ -140,7 +162,8 @@
140162
</u-modal> -->
141163
<u-popup :show="showhaibao">
142164
<view class="haibaopop">
143-
<hch-poster v-if="showhaibao" ref="hchPoster" @cancel="haibaoCancel" :posterData.sync="posterData" @previewImage='haibaoPreview' />
165+
<hch-poster v-if="showhaibao" ref="hchPoster" @cancel="haibaoCancel" :posterData.sync="posterData"
166+
@previewImage='haibaoPreview' />
144167
</view>
145168
</u-popup>
146169
</view>
@@ -178,7 +201,10 @@
178201
videoMp4Src: undefined,
179202
showhaibao: false,
180203
// 海报模板数据
181-
posterData: {}
204+
posterData: {},
205+
curGoodsKanjia: undefined,
206+
curKanjiaprogress: undefined,
207+
myHelpDetail: undefined,
182208
}
183209
},
184210
onLoad(e) {
@@ -199,10 +225,15 @@
199225
200226
},
201227
onShareAppMessage(e) {
202-
return {
228+
const d = {
203229
title: this.goodsDetail.basicInfo.name,
204-
path: '/pages/goods/details?id=' + this.goodsDetail.basicInfo.id
230+
path: '/pages/goods/details?id=' + this.goodsDetail.basicInfo.id + '&inviter_id=' + this.uid
231+
}
232+
if (this.kjJoinUid) {
233+
_data.title = this.curKanjiaprogress.joiner.nick + '邀请您帮TA砍价'
234+
_data.path += '&kjJoinUid=' + this.kjJoinUid
205235
}
236+
return d
206237
},
207238
created() {
208239
@@ -226,6 +257,9 @@
226257
if (res.data.basicInfo.videoId) {
227258
this.getVideoSrc(res.data.basicInfo.videoId)
228259
}
260+
if (res.data.basicInfo.kanjia) {
261+
this.kanjiaSet()
262+
}
229263
} else {
230264
// 不是api工厂商品
231265
this.goodsDetail = {
@@ -530,6 +564,46 @@
530564
haibaoCancel() {
531565
this.showhaibao = false
532566
},
567+
async kanjiaSet() {
568+
const res = await this.$wxapi.kanjiaSet(this.goodsDetail.basicInfo.id)
569+
if (res.code == 0) {
570+
this.curGoodsKanjia = res.data[0]
571+
this.curGoodsKanjia.dateEnd = this.curGoodsKanjia.dateEnd.replace(/00:00:00/g, '')
572+
this.curGoodsKanjia.dateEnd = this.curGoodsKanjia.dateEnd.replace(/ /g, '')
573+
this.kanjiaprogress()
574+
}
575+
},
576+
async kanjiaprogress() {
577+
let kjJoinUid = this.kjJoinUid
578+
if (!kjJoinUid) {
579+
kjJoinUid = this.uid
580+
}
581+
const res = await this.$wxapi.kanjiaDetail(this.curGoodsKanjia.id, kjJoinUid)
582+
if (res.code == 0) {
583+
this.curKanjiaprogress = res.data
584+
}
585+
},
586+
async joinKanjia() {
587+
// 报名参加砍价活动
588+
if (!this.curGoodsKanjia) {
589+
return
590+
}
591+
uni.showLoading({
592+
title: '加载中'
593+
})
594+
const res = await this.$wxapi.kanjiaJoin(this.token, this.curGoodsKanjia.id)
595+
uni.hideLoading()
596+
if (res.code == 0) {
597+
this.$u.vuex('kjJoinUid', this.uid)
598+
this.myHelpDetail = null
599+
this.kanjiaSet()
600+
} else {
601+
uni.showToast({
602+
title: res.msg,
603+
icon: 'none'
604+
})
605+
}
606+
},
533607
}
534608
}
535609
</script>
@@ -608,6 +682,12 @@
608682
font-size: 26rpx;
609683
}
610684
685+
.commission {
686+
padding: 16rpx 32rpx;
687+
color: #e64340;
688+
font-size: 24rpx;
689+
}
690+
611691
.amount {
612692
text-align: center;
613693
font-size: 68rpx;
@@ -644,6 +724,7 @@
644724
font-size: 24rpx;
645725
color: #333;
646726
margin-right: 32rpx;
727+
647728
button {
648729
position: absolute;
649730
height: 100%;
@@ -686,11 +767,26 @@
686767
flex: 1;
687768
}
688769
}
770+
689771
.haibaopop {
690772
width: 100vw;
691773
height: 100vh;
692774
}
775+
693776
.goods-title {
694777
padding: 0 32rpx;
695778
}
779+
.curKanjiaJoin {
780+
padding: 32rpx;
781+
font-size: 28rpx;
782+
text {
783+
color: #e64340;
784+
font-weight: bold;
785+
padding: 0 8rpx;
786+
font-size: 32rpx;
787+
}
788+
}
789+
.curKanjiaprogress {
790+
padding: 32rpx;
791+
}
696792
</style>

pages/goods/list.vue

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
2828
<view v-if="item.minScore" class="item"><text><image class="score-icon" src="/static/images/score.png"></image></text>{{item.minScore}}</view>
2929
</view>
30+
<view class="cart">
31+
<u-icon name="shopping-cart" size="64rpx" color="#F20C32" @click="addCart(item)"></u-icon>
32+
</view>
3033
</view>
3134

3235
</view>
@@ -46,10 +49,14 @@
4649
<view class="price-score">
4750
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
4851
<view v-if="item.minScore" class="item"><text><image class="score-icon" src="/static/images/score.png"></image></text>{{item.minScore}}</view>
52+
<view class="cart">
53+
<u-icon name="shopping-cart" size="64rpx" color="#F20C32" @click="addCart(item)"></u-icon>
54+
</view>
4955
</view>
5056
</view>
5157
</view>
5258
</view>
59+
<goods-pop :show="showGoodsPop" :goodsDetail="goodsDetail" @close="showGoodsPop = false"></goods-pop>
5360
</view>
5461
</template>
5562

@@ -81,7 +88,9 @@
8188
},
8289
],
8390
goods: undefined,
84-
showmod: 1
91+
showmod: 1,
92+
showGoodsPop: false,
93+
goodsDetail: undefined,
8594
}
8695
},
8796
created() {
@@ -166,7 +175,19 @@
166175
uni.navigateTo({
167176
url: '/pages/goods/detail?id=' + item.id
168177
})
169-
}
178+
},
179+
async addCart(item) {
180+
const res = await this.$wxapi.goodsDetail(item.id, this.token)
181+
if (res.code != 0) {
182+
uni.showToast({
183+
title: res.msg,
184+
icon: 'none'
185+
})
186+
return
187+
}
188+
this.goodsDetail = res.data
189+
this.showGoodsPop = true
190+
},
170191
}
171192
}
172193
</script>
@@ -192,6 +213,8 @@
192213
border-radius: 16rpx;
193214
}
194215
.r {
216+
position: relative;
217+
flex: 1;
195218
margin-left: 32rpx;
196219
.goods-title {
197220
color: #333;
@@ -207,6 +230,11 @@
207230
margin-left: 8rpx;
208231
}
209232
}
233+
.cart {
234+
position: absolute;
235+
right: 0;
236+
bottom: 32rpx;
237+
}
210238
}
211239
.count-down {
212240
background: rgba(250, 195, 198, 0.3);
@@ -290,6 +318,11 @@
290318
text-decoration: line-through;
291319
margin-left: 20rpx;
292320
}
321+
.cart {
322+
position: absolute;
323+
right: 0;
324+
top: 0;
325+
}
293326
}
294327
}
295328
</style>

pages/login/reg.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@
163163
})
164164
return
165165
}
166+
if(res.code == 10000) {
167+
uni.showModal({
168+
showCancel:false,
169+
title: '提示',
170+
content: '当前手机号码已存在,无需重新注册',
171+
confirmText: '知道了',
172+
})
173+
return
174+
}
166175
this.$u.vuex('token', res.data.token)
167176
this.$u.vuex('uid', res.data.uid)
168177
setTimeout(() => {

pages/my/cardlogs.vue

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<view>
3+
<u-cell v-for="(item,index) in cardMyLogs" :title="item.typeStr" :label="item.dateAdd" :value="item.amount + '(余额:' + item.balance + ')'"></u-cell>
4+
</view>
5+
</template>
6+
7+
<script>
8+
export default {
9+
data() {
10+
return {
11+
cardMyLogs: undefined,
12+
cardid: undefined
13+
}
14+
},
15+
created() {
16+
17+
},
18+
mounted() {
19+
20+
},
21+
onReady() {
22+
23+
},
24+
onLoad(e) {
25+
this.cardid = e.cardid
26+
this._cardMyLogs()
27+
},
28+
onShow() {
29+
30+
},
31+
methods: {
32+
async _cardMyLogs() {
33+
const res = await this.$wxapi.cardMyLogs({
34+
token: this.token,
35+
cardId: this.cardid
36+
})
37+
if (res.code == 0) {
38+
this.cardMyLogs = res.data.result
39+
}
40+
}
41+
}
42+
}
43+
</script>
44+
<style scoped lang="scss">
45+
46+
</style>

0 commit comments

Comments
 (0)