From b902b40fda2f1dccca0825277d07908119deecfd Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期一, 02 三月 2026 09:57:58 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
mini-program/pages/details/details.vue | 68 ++++++++++++++++++++++++++++-----
1 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/mini-program/pages/details/details.vue b/mini-program/pages/details/details.vue
index 512ff82..26b24f5 100644
--- a/mini-program/pages/details/details.vue
+++ b/mini-program/pages/details/details.vue
@@ -21,15 +21,18 @@
</view>
<view class="content">
<view class="content-label">鍟嗗搧璇︽儏</view>
- <view class="content-val" v-html="info.content"></view>
+ <view class="content-val">
+ <u-parse :content="info.content"></u-parse>
+ </view>
</view>
<view style="width: 100%; height: calc(env(safe-area-inset-bottom) + 108rpx);"></view>
<view class="footer">
<view class="edit">
<view class="edit-left">
- <view class="edit-left-row" @click="toIndex">
- <image src="/static/icon/detail_ic_home@2x.png" mode="widthFix"></image>
- <text>棣栭〉</text>
+ <view class="edit-left-row" @click="shoucang">
+ <image src="/static/icon/ic_collect_sel@2x.png" mode="widthFix" v-if="info.collectStatus === 1"></image>
+ <image src="/static/icon/ic_collect@2x.png" mode="widthFix" v-else></image>
+ <text>{{info.collectStatus === 1 ? '宸叉敹钘�' : '鏀惰棌'}}</text>
</view>
<view class="edit-left-row">
<button open-type="contact">瀹㈡湇</button>
@@ -49,12 +52,15 @@
</view>
<view style="width: 100%; height: env(safe-area-inset-bottom);"></view>
</view>
+ <Login ref="login" />
</view>
</template>
<script>
import { mapState } from 'vuex'
+ import Login from '@/components/login/login.vue'
export default {
+ components: { Login },
computed: {
...mapState(['userInfo'])
},
@@ -68,15 +74,56 @@
onLoad(option) {
this.id = option.id
this.getDetails()
- this.cardNum()
+
+ },
+ onShow() {
+ if (this.userInfo) {
+ this.cardNum()
+ }
},
methods: {
+ shoucang() {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return
+ }
+ if (this.info.collectStatus === 1) {
+ this.$u.api.cancelbatch({ ids: this.info.id })
+ .then(res => {
+ if (res.code === 200) {
+ this.info.collectStatus = 0
+ }
+ })
+ } else {
+ this.$u.api.saveCollect({ objId: this.info.id, type: 1 })
+ .then(res => {
+ if (res.code === 200) {
+ this.info.collectStatus = 1
+ }
+ })
+ }
+ },
submit() {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return
+ }
+ let shop = [
+ {
+ goodsNum: 1,
+ goodsSkuId: this.info.goodsSkuResponseList[0].id
+ }
+ ]
+ uni.setStorageSync('shop', shop)
uni.navigateTo({
- url: '/pages/confirm-order/confirm-order?id=' + this.id
+ url: '/pages/confirm-order/confirm-order'
})
},
addCard(e) {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return
+ }
this.$u.api.addCart({
goodsId: e.id,
goodsSkuId: e.skuResponsesList[0].id,
@@ -89,13 +136,12 @@
})
},
toCard() {
+ if (!this.userInfo) {
+ this.$refs.login.open()
+ return
+ }
uni.navigateTo({
url: '/pages/shopping-cart/shopping-cart'
- })
- },
- toIndex() {
- uni.switchTab({
- url: '/pages/index/index'
})
},
cardNum() {
--
Gitblit v1.9.3