|
|
@@ -169,7 +169,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { productList, getFamilyMembers, addFamilyMember } from '../../utils/api.js'
|
|
|
+import { productList, getFamilyMembers, addFamilyMember, getPublicConfig } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -488,7 +488,18 @@ export default {
|
|
|
loadRecommendProducts: function() {
|
|
|
var self = this
|
|
|
self.loadingProducts = true
|
|
|
- productList({ domain: 'body', productType: 'assessment', size: 4 }).then(function(res) {
|
|
|
+ // 先从配置读取类目ID,再加载该类目下的商品
|
|
|
+ getPublicConfig('report_upload_category_id').then(function(configRes) {
|
|
|
+ var params = { size: 4 }
|
|
|
+ var categoryId = configRes && configRes.data
|
|
|
+ if (categoryId) {
|
|
|
+ params.categoryId = parseInt(categoryId)
|
|
|
+ } else {
|
|
|
+ params.domain = 'body'
|
|
|
+ params.productType = 'assessment'
|
|
|
+ }
|
|
|
+ return productList(params)
|
|
|
+ }).then(function(res) {
|
|
|
if (res && res.data && res.data.records) {
|
|
|
self.recommendedProducts = res.data.records
|
|
|
} else {
|
|
|
@@ -501,7 +512,21 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
goToProduct: function(productId) {
|
|
|
- uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + productId })
|
|
|
+ // 直接进入结算页,跳过商品详情页
|
|
|
+ var product = this.recommendedProducts.find(function(p) { return p.id === productId })
|
|
|
+ if (product) {
|
|
|
+ var productData = {
|
|
|
+ productId: product.id,
|
|
|
+ productName: product.name,
|
|
|
+ coverImage: product.coverImage || '',
|
|
|
+ unitPrice: product.price || 0,
|
|
|
+ quantity: 1
|
|
|
+ }
|
|
|
+ uni.setStorageSync('checkoutItems', [productData])
|
|
|
+ uni.navigateTo({ url: '/pages/shop/checkout/checkout?from=report_upload&id=' + productId })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({ url: '/pages/discover-detail/product-detail/product-detail?id=' + productId })
|
|
|
+ }
|
|
|
},
|
|
|
formatPriceWithSymbol: function(cents) {
|
|
|
if (cents === null || cents === undefined) return '¥0'
|