From 6577a7ad7f2044bcfe75601e0360e9172a7d2380 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期六, 28 二月 2026 15:07:23 +0800
Subject: [PATCH] 提交
---
mini-program/pages/details/details.vue | 64 +++++++++++++++++++++++++++-----
1 files changed, 54 insertions(+), 10 deletions(-)
diff --git a/mini-program/pages/details/details.vue b/mini-program/pages/details/details.vue
index 512ff82..06e5264 100644
--- a/mini-program/pages/details/details.vue
+++ b/mini-program/pages/details/details.vue
@@ -27,9 +27,10 @@
<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 +50,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 +72,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 +134,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