Skip to content

Commit 3474bee

Browse files
committed
fixed
1 parent 5f1b32f commit 3474bee

9 files changed

Lines changed: 184 additions & 99 deletions

File tree

App.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,21 @@
108108
<style lang="scss">
109109
/*每个页面公共css */
110110
@import "@/uni_modules/uview-ui/index.scss";
111+
.price-score {
112+
display: flex;
113+
color: #e64340;
114+
font-size: 38rpx;
115+
text {
116+
padding: 0 4rpx;
117+
font-size: 28rpx;
118+
}
119+
.item {
120+
padding: 0 8rpx;
121+
}
122+
.original {
123+
margin-left: 32rpx;
124+
color:#aaa;
125+
text-decoration:line-through
126+
}
127+
}
111128
</style>

components/goods-pop/goods-pop.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<view v-if="goodsDetail.basicInfo.numberSells" class="t2">已售:{{ goodsDetail.basicInfo.numberSells }}
99
</view>
1010
<view class="price">
11-
<font>¥</font>{{ price }}
11+
<view v-if="price"><font>¥</font>{{ price }}</view>
1212
<view v-if="score">
13-
<font>+¢</font>{{ score }}
13+
<font>¢</font>{{ score }}
1414
</view>
1515
</view>
1616
</view>
@@ -38,7 +38,14 @@
3838
<u-number-box v-model="buyNumber" :min="min" :max="max" integer></u-number-box>
3939
</view>
4040
<u-line></u-line>
41-
<view class="btns">
41+
<view v-if="goodsDetail.basicInfo.supplyType == 'jdJoycityPoints'" class="btns">
42+
<view class="btn">
43+
<u-button text="立即购买" shape="circle" color="linear-gradient(90deg, #ff6034, #ee0a24, #ff6034)"
44+
@click="tobuy">
45+
</u-button>
46+
</view>
47+
</view>
48+
<view v-else class="btns">
4249
<!-- #ifdef MP-WEIXIN || MP-BAIDU -->
4350
<view class="icon-btn">
4451
<u-icon name="chat" size="48rpx"></u-icon>
@@ -473,12 +480,17 @@
473480
goodsType = 1
474481
goodsId = this.goodsDetail.basicInfo.yyId
475482
}
483+
if(this.goodsDetail.basicInfo.supplyType == 'jdJoycityPoints') {
484+
goodsType = 2
485+
goodsId = this.goodsDetail.basicInfo.yyIdStr
486+
}
476487
const goodsList = [{
477488
goodsId,
478489
goodsName: this.goodsDetail.basicInfo.name,
479-
number: 1,
490+
number: this.buyNumber,
480491
pic: this.goodsDetail.basicInfo.pic,
481492
price: this.goodsDetail.basicInfo.minPrice,
493+
score: this.goodsDetail.basicInfo.minScore,
482494
sku: [], // optionId optionName optionValueId optionValueName
483495
additions: [], // id name pid pname price
484496
goodsType

node_modules/apifm-uniapp/index.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pages/category/category.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@
3131
<view class="goods-info">
3232
<u--text class="t" :lines="3" :text="item.name" @click="goDetail(item)"></u--text>
3333
<view v-if="item.numberSells" class="t2">已售:{{ item.numberSells }}</view>
34-
<view class="price">
35-
<font>¥</font>{{ item.minPrice }}
36-
<view v-if="item.gotScore">
37-
<font>+¢</font>{{ item.gotScore }}
38-
</view>
34+
<view class="price-score">
35+
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
36+
<view v-if="item.minScore" class="item"><text>∮</text>{{item.minScore}}</view>
3937
</view>
40-
<view class="addCar">
38+
<view v-if="item.supplyType != 'jdJoycityPoints'" class="addCar">
4139
<u-icon v-if="item.propertyIds || item.hasAddition" name="plus-circle" color="#e64340"
4240
size="48rpx" @click="_showGoodsPop(item)"></u-icon>
4341
<u-icon v-else name="shopping-cart" color="#e64340" size="64rpx" @click="addCart(item)">

pages/goods/detail.vue

Lines changed: 105 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
<view id="basic">
88
<u-swiper :list="goodsDetail.pics" keyName="pic" indicator circular height="750rpx"></u-swiper>
99
<view class="price-share">
10-
<view class="price">¥{{goodsDetail.basicInfo.minPrice}} <text
11-
v-if="goodsDetail.basicInfo.originalPrice">¥{{goodsDetail.basicInfo.originalPrice}}</text>
10+
<view class="price-score">
11+
<view v-if="goodsDetail.basicInfo.minPrice" class="item">
12+
<text>¥</text>{{goodsDetail.basicInfo.minPrice}}</view>
13+
<view v-if="goodsDetail.basicInfo.minScore" class="item">
14+
<text>∮</text>{{goodsDetail.basicInfo.minScore}}</view>
1215
</view>
1316
<!-- #ifdef MP -->
1417
<view class="btns">
@@ -38,9 +41,10 @@
3841
</view>
3942
<view id="content">
4043
<u-divider text="详细介绍"></u-divider>
41-
<view class="content">
42-
<view v-if="wxintroduction">
43-
<u--image v-for="(item,index) in wxintroduction" :src="item" mode="widthFix" width="750rpx" height="auto"></u--image>
44+
<view class="content">
45+
<view v-if="wxintroduction">
46+
<u--image v-for="(item,index) in wxintroduction" :src="item" mode="widthFix" width="750rpx"
47+
height="auto"></u--image>
4448
</view>
4549
<u-parse v-else :content="goodsDetail.content"></u-parse>
4650
</view>
@@ -50,14 +54,17 @@
5054
<view v-if="reputationList" class="reputation-box">
5155
<view v-for="(item,index) in reputationList" :key="index" class="album">
5256
<view class="album__avatar">
53-
<u--image class="image" :src="item.user.avatarUrl" shape="circle" width="120rpx" height="120rpx"></u--image>
57+
<u--image class="image" :src="item.user.avatarUrl" shape="circle" width="120rpx"
58+
height="120rpx"></u--image>
5459
</view>
5560
<view class="album__content">
5661
<u--text :text="item.user.nick" type="primary" bold size="17"></u--text>
5762
<u-rate v-model="item.goods.goodReputation"></u-rate>
58-
<u--text margin="8rpx 0 8rpx 0" size="26rpx" color="#666666" :text="item.goods.goodReputationRemark"></u--text>
59-
<u--text margin="0 0 8rpx 0" size="24rpx" color="#666666" :text="item.goods.dateReputation"></u--text>
60-
<!-- <u-album v-if="item.reputationPics" :urls="urls2"></u-album> -->
63+
<u--text margin="8rpx 0 8rpx 0" size="26rpx" color="#666666"
64+
:text="item.goods.goodReputationRemark"></u--text>
65+
<u--text margin="0 0 8rpx 0" size="24rpx" color="#666666"
66+
:text="item.goods.dateReputation"></u--text>
67+
<!-- <u-album v-if="item.reputationPics" :urls="urls2"></u-album> -->
6168
<view style="height: 32rpx;"></view>
6269
</view>
6370
</view>
@@ -76,8 +83,15 @@
7683
title="掌柜回复:{{item.goods.goodReputationReply}}" /> -->
7784
</view>
7885
</view>
79-
</scroll-view>
80-
<view class="bottom-btns">
86+
</scroll-view>
87+
<view v-if="goodsDetail.basicInfo.supplyType == 'jdJoycityPoints'" class="bottom-btns">
88+
<view class="btn">
89+
<u-button text="立即购买" shape="circle" color="linear-gradient(90deg, #ff6034, #ee0a24, #ff6034)"
90+
@click="_showGoodsPop">
91+
</u-button>
92+
</view>
93+
</view>
94+
<view v-else class="bottom-btns">
8195
<!-- #ifdef MP-WEIXIN || MP-BAIDU -->
8296
<view class="icon-btn">
8397
<u-icon name="chat" size="48rpx"></u-icon>
@@ -119,19 +133,23 @@
119133
export default {
120134
data() {
121135
return {
122-
tabs: [{
123-
viewId: 'basic',
124-
name: '商品信息',
125-
}, {
126-
viewId: 'content',
127-
name: '详细介绍',
128-
}, {
129-
viewId: 'reputation',
130-
name: '用户评价',
131-
}],
136+
tabs: [
137+
{
138+
viewId: 'basic',
139+
name: '商品信息',
140+
},
141+
{
142+
viewId: 'content',
143+
name: '详细介绍',
144+
},
145+
// {
146+
// viewId: 'reputation',
147+
// name: '用户评价',
148+
// },
149+
],
132150
curViewId: 'basic',
133-
goodsDetail: undefined,
134-
jdGoodsDetail: undefined,
151+
goodsDetail: undefined,
152+
jdGoodsDetail: undefined,
135153
wxintroduction: undefined,
136154
faved: false,
137155
showGoodsPop: false,
@@ -174,22 +192,57 @@
174192
title: res.msg,
175193
icon: 'none'
176194
})
177-
setTimeout(() => {
178-
uni.navigateBack()
195+
setTimeout(() => {
196+
uni.navigateBack()
179197
}, 3000)
180198
return
181199
}
182200
this.goodsDetail = res.data
183201
// 检测是否收藏
184202
this.goodsFavCheck()
185-
this._reputationList()
186-
if(this.goodsDetail.basicInfo.supplyType == 'vop_jd') {
187-
this.jdvopGoodsDetail(this.goodsDetail.basicInfo.yyId)
203+
this._reputationList()
204+
if (this.goodsDetail.basicInfo.supplyType == 'vop_jd') {
205+
this.jdvopGoodsDetail(this.goodsDetail.basicInfo.yyId)
206+
}
207+
if (this.goodsDetail.basicInfo.supplyType == 'jdJoycityPoints') {
208+
this.joycityPointsGoodsDetail(this.goodsDetail.basicInfo.yyIdStr)
209+
}
210+
},
211+
async jdvopGoodsDetail(skuId) {
212+
// https://www.yuque.com/apifm/nu0f75/ar77dc
213+
const res = await this.$wxapi.jdvopGoodsDetail(skuId)
214+
if (res.code != 0) {
215+
uni.showToast({
216+
title: res.msg,
217+
icon: 'none'
218+
})
219+
setTimeout(() => {
220+
uni.navigateBack()
221+
}, 3000)
222+
return
223+
}
224+
this.jdGoodsDetail = res.data
225+
this.goodsDetail.basicInfo.minPrice = this.jdGoodsDetail.price.priceSale
226+
this.goodsDetail.basicInfo.originalPrice = this.jdGoodsDetail.price.priceJd
227+
this.goodsDetail.basicInfo.name = this.jdGoodsDetail.price.skuName
228+
if (this.jdGoodsDetail.info.wxintroduction) {
229+
this.wxintroduction = JSON.parse(this.jdGoodsDetail.info.wxintroduction)
230+
}
231+
this.jdvopGoodsSkuImages(skuId)
232+
},
233+
async jdvopGoodsSkuImages(skuId) {
234+
// https://www.yuque.com/apifm/nu0f75/pvcu30
235+
const res = await this.$wxapi.jdvopGoodsSkuImages(skuId)
236+
if (res.code == 0) {
237+
const pics = res.data
238+
pics.forEach(ele => {
239+
ele.pic = this.jdGoodsDetail.imageDomain + ele.path
240+
})
241+
this.goodsDetail.pics = pics
188242
}
189243
},
190-
async jdvopGoodsDetail(skuId) {
191-
// https://www.yuque.com/apifm/nu0f75/ar77dc
192-
const res = await this.$wxapi.jdvopGoodsDetail(skuId)
244+
async joycityPointsGoodsDetail(skuId) {
245+
const res = await this.$wxapi.joycityPointsGoodsDetail(skuId)
193246
if (res.code != 0) {
194247
uni.showToast({
195248
title: res.msg,
@@ -200,26 +253,20 @@
200253
}, 3000)
201254
return
202255
}
203-
this.jdGoodsDetail = res.data
204-
this.goodsDetail.basicInfo.minPrice = this.jdGoodsDetail.price.priceSale
205-
this.goodsDetail.basicInfo.originalPrice = this.jdGoodsDetail.price.priceJd
206-
this.goodsDetail.basicInfo.name = this.jdGoodsDetail.price.skuName
207-
if (this.jdGoodsDetail.info.wxintroduction) {
208-
this.wxintroduction = JSON.parse(this.jdGoodsDetail.info.wxintroduction)
209-
}
210-
this.jdvopGoodsSkuImages(skuId)
211-
},
212-
async jdvopGoodsSkuImages(skuId) {
213-
// https://www.yuque.com/apifm/nu0f75/pvcu30
214-
const res = await this.$wxapi.jdvopGoodsSkuImages(skuId)
215-
if (res.code == 0) {
216-
const pics = res.data
217-
pics.forEach(ele => {
218-
ele.pic = this.jdGoodsDetail.imageDomain + ele.path
256+
const pics = []
257+
res.data.providerImgUrls.split(',').forEach(ele => {
258+
pics.push({
259+
pic: ele
219260
})
220-
this.goodsDetail.pics = pics
221-
}
222-
},
261+
})
262+
this.goodsDetail.pics = pics
263+
this.goodsDetail.basicInfo.name = res.data.goodsName
264+
this.goodsDetail.basicInfo.minPrice = 0
265+
this.goodsDetail.basicInfo.minScore = res.data.goodsPrice
266+
this.goodsDetail.basicInfo.originalPrice = res.data.suggestedPrice
267+
// this.goodsDetail.content = res.data.usageGuide
268+
this.wxintroduction = res.data.pics
269+
},
223270
goCart() {
224271
uni.switchTab({
225272
url: "/pages/cart/index"
@@ -293,7 +340,7 @@
293340
res.data.result.forEach(ele => {
294341
if (ele.user && !ele.user.avatarUrl) {
295342
ele.user.avatarUrl = '/static/images/empty.jpg'
296-
}
343+
}
297344
if (ele.user && !ele.user.nick) {
298345
ele.user.nick = '匿名用户'
299346
}
@@ -403,7 +450,13 @@
403450
}
404451
405452
.content {
406-
margin-top: 32rpx;
453+
margin-top: 32rpx;
454+
image {
455+
height: auto;
456+
}
457+
div {
458+
height: auto;
459+
}
407460
}
408461
409462
.bottom-btns {

pages/goods/list.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
<view class="goods-title" @click="goDetail(item)">{{item.name}}</view>
2121
<u--text v-if="item.characteristic" class="goods-title" :text="item.characteristic" size="28rpx"
2222
color="#c95060"></u--text>
23-
<view class="price-box">
24-
<view class="price">¥{{item.minPrice}} <text v-if="item.originalPrice">¥{{item.originalPrice}}</text></view>
23+
<view class="price-score">
24+
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
25+
<view v-if="item.minScore" class="item"><text>∮</text>{{item.minScore}}</view>
2526
</view>
2627
</view>
2728

@@ -36,10 +37,9 @@
3637
<u--text class="goods-title" :text="item.name" :lines="3" size="28rpx" color="#333" @click="goDetail(item)"></u--text>
3738
<u--text v-if="item.characteristic" class="goods-title" :text="item.characteristic" size="28rpx"
3839
color="#c95060"></u--text>
39-
<view style='display:flex;'>
40-
<view class="goods-price">¥ {{item.minPrice}}</view>
41-
<view v-if="item.originalPrice && item.originalPrice > 0" class="goods-price"
42-
style='color:#aaa;text-decoration:line-through'>¥ {{item.originalPrice}}</view>
40+
<view class="price-score">
41+
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
42+
<view v-if="item.minScore" class="item"><text>∮</text>{{item.minScore}}</view>
4343
</view>
4444
</view>
4545
</view>

pages/index/index.vue

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@
8383
<u--text class="goods-title" :text="item.name" :lines="3" size="28rpx" color="#333" @click="goDetail(item)"></u--text>
8484
<u--text v-if="item.characteristic" class="goods-title" :text="item.characteristic" size="28rpx"
8585
color="#c95060"></u--text>
86-
<view style='display:flex;'>
87-
<view class="goods-price">¥ {{item.minPrice}}</view>
88-
<view v-if="item.originalPrice && item.originalPrice > 0" class="goods-price"
89-
style='color:#aaa;text-decoration:line-through'>¥ {{item.originalPrice}}</view>
86+
<view class="price-score">
87+
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
88+
<view v-if="item.minScore" class="item"><text>∮</text>{{item.minScore}}</view>
9089
</view>
9190
</view>
9291
</view>
@@ -153,10 +152,9 @@
153152
<u--text class="goods-title" :text="item.name" :lines="3" size="28rpx" color="#333" @click="goDetail(item)"></u--text>
154153
<u--text v-if="item.characteristic" class="goods-title" :text="item.characteristic" size="28rpx"
155154
color="#c95060"></u--text>
156-
<view style='display:flex;'>
157-
<view class="goods-price">¥ {{item.minPrice}}</view>
158-
<view v-if="item.originalPrice && item.originalPrice > 0" class="goods-price"
159-
style='color:#aaa;text-decoration:line-through'>¥ {{item.originalPrice}}</view>
155+
<view class="price-score">
156+
<view v-if="item.minPrice" class="item"><text>¥</text>{{item.minPrice}}</view>
157+
<view v-if="item.minScore" class="item"><text>∮</text>{{item.minScore}}</view>
160158
</view>
161159
</view>
162160
</view>

0 commit comments

Comments
 (0)