|
|
|
@ -7,28 +7,32 @@ |
|
|
|
|
|
|
|
<view class="summary"> |
|
|
|
<view class="card info"> |
|
|
|
<view class="name">{{ detail.fullName }}</view> |
|
|
|
<view class="flex tags"> |
|
|
|
<!-- todo: check key --> |
|
|
|
<view class="name">{{ detail.info }}</view> |
|
|
|
<!-- todo: check key --> |
|
|
|
<view class="flex tags" v-if="detail.tags"> |
|
|
|
<view class="tag" v-for="(tag, tIdx) in detail.tags" :key="tIdx"> |
|
|
|
{{ tag }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex price"> |
|
|
|
<view class="flex price-val">¥<text class="highlight">{{ (detail.price || 0).toFixed(2) }}</text>/份</view> |
|
|
|
<view class="price-bef">¥<text>{{ detail.originalPrice }}</text>/份</view> |
|
|
|
<view class="flex price-val">¥<text class="highlight">{{ (detail.currentPrice || 0).toFixed(2) }}</text>/{{ detail.unit }}</view> |
|
|
|
<view class="price-bef" v-if="detail.originalPrice">¥<text>{{ detail.originalPrice }}</text>/{{ detail.unit }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="card bar"> |
|
|
|
<view class="flex row"> |
|
|
|
<view class="flex row-content"> |
|
|
|
<view class="label">品类:</view> |
|
|
|
<!-- todo: check key --> |
|
|
|
<view class="value">{{ detail.category }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex row" @click="openPicker"> |
|
|
|
<view class="flex row-content"> |
|
|
|
<view class="label">规格:</view> |
|
|
|
<view class="value">{{ detail.countDesc || '请选择规格' }}</view> |
|
|
|
<!-- todo: check key --> |
|
|
|
<view class="value">{{ detail.specName || '请选择规格' }}</view> |
|
|
|
</view> |
|
|
|
<uv-picker ref="picker" :columns="[detail.options]" keyName="label" confirmColor="#7451DE" @confirm="onChange"></uv-picker> |
|
|
|
<uv-icon name="arrow-right" color="#C6C6C6" size="24rpx"></uv-icon> |
|
|
|
@ -36,14 +40,15 @@ |
|
|
|
<view class="flex row"> |
|
|
|
<view class="flex row-content"> |
|
|
|
<view class="label">服务:</view> |
|
|
|
<!-- todo: check key --> |
|
|
|
<view class="value">{{ detail.deliverService }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="detail"> |
|
|
|
<uv-parse :content="detail.details"></uv-parse> |
|
|
|
<view class="detail" v-if="detail.detail"> |
|
|
|
<uv-parse :content="detail.detail"></uv-parse> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="comment"> |
|
|
|
@ -51,6 +56,7 @@ |
|
|
|
<view class="highlight">用户评价</view> |
|
|
|
<view>User reviews</view> |
|
|
|
</view> |
|
|
|
<!-- todo: check api --> |
|
|
|
<view class="comment-item" v-for="item in commentList" :key="item.id"> |
|
|
|
<commentCard :data="item"></commentCard> |
|
|
|
</view> |
|
|
|
@ -93,6 +99,7 @@ |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
bannerList() { |
|
|
|
// todo: check key |
|
|
|
const { image } = this.detail |
|
|
|
|
|
|
|
if (!image) { |
|
|
|
@ -104,38 +111,19 @@ |
|
|
|
}, |
|
|
|
onLoad(arg) { |
|
|
|
console.log('onLoad', arg) |
|
|
|
this.id = arg.id |
|
|
|
|
|
|
|
// todo: fetch detail data |
|
|
|
const { id } = arg |
|
|
|
|
|
|
|
this.detail = { |
|
|
|
id: '001', |
|
|
|
image: new Array(4).fill('/pages_order/static/product/product-detail.png'), |
|
|
|
name: 'NMN', |
|
|
|
fullName: 'NMN 是 NAD* 的前体,在细胞能量代谢、DNA 修复和抗衰老等方面发挥重要作用。提高 NAD*水平能改善代谢健康1-8。', |
|
|
|
tags: ['专业设备', '科学流程', '质量保证'], |
|
|
|
sales: 24770, |
|
|
|
price: 688.00, |
|
|
|
originalPrice: 1664, |
|
|
|
category: '逆龄抗衰', |
|
|
|
count: null, |
|
|
|
countDesc: null, |
|
|
|
options: [ |
|
|
|
{ id: '001', label: '每天1颗', count: 1, value: 688, originValue: 1664 }, |
|
|
|
{ id: '002', label: '每天2颗', count: 2, value: 688*2, originValue: 1664*2 }, |
|
|
|
{ id: '003', label: '每天3颗', count: 3, value: 688*3, originValue: 1664*3 }, |
|
|
|
{ id: '004', label: '每天4颗', count: 4, value: 688*4, originValue: 1664*4 }, |
|
|
|
], |
|
|
|
deliverService: '上门取件·送货上门', |
|
|
|
details: `<p>商品详情↓<br/><br/><br/><br/>商品详情↑</p>` |
|
|
|
} |
|
|
|
this.id = id |
|
|
|
|
|
|
|
this.getData(id) |
|
|
|
|
|
|
|
this.commentList = [ |
|
|
|
{ |
|
|
|
id: '001', |
|
|
|
userName: '战斗世界', |
|
|
|
avatar: '/pages_order/static/report/avatar.png', |
|
|
|
countDesc: '三月装', |
|
|
|
specName: '三月装', |
|
|
|
createTime: '2023-04-18', |
|
|
|
content: '包装很精致,性价比非常高,终于收到啦,期待效果,每日一包,超级方便,真的能坚持服用', |
|
|
|
images: [ |
|
|
|
@ -151,7 +139,7 @@ |
|
|
|
id: '002', |
|
|
|
userName: '战斗世界', |
|
|
|
avatar: '/pages_order/static/report/avatar.png', |
|
|
|
countDesc: '三月装', |
|
|
|
specName: '三月装', |
|
|
|
createTime: '2023-04-18', |
|
|
|
content: '包装很精致,性价比非常高,终于收到啦,期待效果,每日一包,超级方便,真的能坚持服用', |
|
|
|
images: [ |
|
|
|
@ -167,7 +155,7 @@ |
|
|
|
id: '003', |
|
|
|
userName: '战斗世界', |
|
|
|
avatar: '/pages_order/static/report/avatar.png', |
|
|
|
countDesc: '三月装', |
|
|
|
specName: '三月装', |
|
|
|
createTime: '2023-04-18', |
|
|
|
content: '包装很精致,性价比非常高,终于收到啦,期待效果,每日一包,超级方便,真的能坚持服用', |
|
|
|
images: [ |
|
|
|
@ -180,8 +168,39 @@ |
|
|
|
deliverySpeedScore: 4.5, |
|
|
|
}, |
|
|
|
] |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
this.detail = { |
|
|
|
id: '001', |
|
|
|
image: new Array(4).fill('/pages_order/static/product/product-detail.png'), |
|
|
|
name: 'NMN', |
|
|
|
fullName: 'NMN 是 NAD* 的前体,在细胞能量代谢、DNA 修复和抗衰老等方面发挥重要作用。提高 NAD*水平能改善代谢健康1-8。', |
|
|
|
tags: ['专业设备', '科学流程', '质量保证'], |
|
|
|
sales: 24770, |
|
|
|
price: 688.00, |
|
|
|
originalPrice: 1664, |
|
|
|
category: '逆龄抗衰', |
|
|
|
count: null, |
|
|
|
specName: null, |
|
|
|
options: [ |
|
|
|
{ id: '001', label: '每天1颗', count: 1, value: 688, originValue: 1664 }, |
|
|
|
{ id: '002', label: '每天2颗', count: 2, value: 688*2, originValue: 1664*2 }, |
|
|
|
{ id: '003', label: '每天3颗', count: 3, value: 688*3, originValue: 1664*3 }, |
|
|
|
{ id: '004', label: '每天4颗', count: 4, value: 688*4, originValue: 1664*4 }, |
|
|
|
], |
|
|
|
deliverService: '上门取件·送货上门', |
|
|
|
details: `<p>商品详情↓<br/><br/><br/><br/>商品详情↑</p>` |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getData(id) { |
|
|
|
try { |
|
|
|
this.detail = await this.$fetch('getProductDetail', { id }) |
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
openPicker() { |
|
|
|
this.$refs.picker.open(); |
|
|
|
}, |
|
|
|
@ -191,7 +210,7 @@ |
|
|
|
|
|
|
|
this.detail.price = target.value |
|
|
|
this.detail.count = target.count |
|
|
|
this.detail.countDesc = target.label |
|
|
|
this.detail.specName = target.label |
|
|
|
}, |
|
|
|
jumpToComment() { |
|
|
|
this.$utils.navigateTo('/pages_order/comment/commentRecords') |
|
|
|
@ -199,14 +218,17 @@ |
|
|
|
jumpToCreateOrder() { |
|
|
|
// todo |
|
|
|
}, |
|
|
|
onSelectCount(optionId) { |
|
|
|
const { options } = this.detail |
|
|
|
onSelectCount(id) { |
|
|
|
const { specs } = this.detail |
|
|
|
|
|
|
|
let target = options.find(item => item.id === optionId) |
|
|
|
let target = specs.find(item => item.id === id) |
|
|
|
|
|
|
|
this.detail.price = target.value |
|
|
|
this.detail.count = target.count |
|
|
|
this.detail.countDesc = target.label |
|
|
|
// todo: check price |
|
|
|
// this.detail.price = target.value |
|
|
|
// todo: check count ? |
|
|
|
// this.detail.count = target.count |
|
|
|
this.detail.skuId = target.id |
|
|
|
this.detail.specName = target.specName |
|
|
|
|
|
|
|
this.onBuy() |
|
|
|
}, |
|
|
|
@ -222,9 +244,8 @@ |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// todo |
|
|
|
|
|
|
|
this.$refs.agreementPopup.open() |
|
|
|
// todo: check timing |
|
|
|
// this.$refs.agreementPopup.open() |
|
|
|
|
|
|
|
this.$store.commit('createOrder', [this.detail]) |
|
|
|
}, |
|
|
|
|