This commit is contained in:
2023-10-08 22:53:13 +08:00
parent b883b02fb9
commit e36d60d015
83 changed files with 18303 additions and 9590 deletions

View File

@@ -27,8 +27,8 @@
:symbol="payType === 'jf' ? '积分' : '元'"
/>
</view>
<view class="title">{{ goodInfo.name }} </view>
<view class="sub">{{ goodInfo.profile }} </view>
<view class="title">{{ goodInfo.name }}</view>
<view class="sub">{{ goodInfo.profile }}</view>
</view>
<nut-cell title="请选择规格: " is-link @click="openSku"></nut-cell>
<!-- 产品介绍 -->
@@ -40,7 +40,6 @@
:nodes="goodInfo.details"
></rich-text>
<nut-empty v-else description="暂无产品介绍"></nut-empty>
</view>
<view style="height: 9vh"></view>
<!-- 底部 -->
@@ -50,33 +49,30 @@
<Home />
<view>首页</view>
</view>
<view
class="icon"
v-if="payType === 'jf'"
@click="toPage('/pages/cart/index')"
>
<Cart />
<view>购物车</view>
</view>
<!-- <view-->
<!-- class="icon"-->
<!-- v-if="payType === 'jf'"-->
<!-- @click="toPage('/pages/cart/index')"-->
<!-- >-->
<!-- <Cart/>-->
<!-- <view>购物车</view>-->
<!-- </view>-->
<view class="icon" @click="toPage('/pages/kefu/index', 2)">
<My />
<view>客服</view>
</view>
</view>
<!-- 占位 -->
<view>
<nut-button
v-if="payType === 'jf'"
style="margin-right: 10px"
type="warning"
@click="add_cart()"
>加入购物车
</nut-button>
<nut-button
:style="payType === 'wx' ? 'width: 200px' : ''"
type="primary"
@click="toOrderDetail()"
<view style="width: 80%">
<!-- <nut-button-->
<!-- v-if="payType === 'jf'"-->
<!-- style="margin-right: 10px"-->
<!-- type="warning"-->
<!-- @click="add_cart()"-->
<!-- >加入购物车-->
<!-- </nut-button>-->
<nut-button type="primary" block @click="toOrderDetail()"
>{{ payType === "jf" ? "立即兑换" : "立即购买" }}
</nut-button>
</view>
@@ -99,6 +95,7 @@
<nut-input-number
v-model="count"
@change="addCount"
button-size="30"
/>
</template>
</nut-cell>
@@ -126,11 +123,16 @@
var statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
import { ref } from "vue";
import Taro from "@tarojs/taro";
import { Left, Home, Cart, My } from "@nutui/icons-vue-taro";
import {
Left,
Home,
// Cart,
My,
} from "@nutui/icons-vue-taro";
import {
getGoodsDetail,
getActiveGoodsDetail,
addCart,
// addCart,
createOrder,
createActiveOrder,
} from "@/api/goods";
@@ -178,11 +180,12 @@ const get_good_detail = async (gid: string) => {
} else {
res = await getActiveGoodsDetail({ gid: gid });
}
goodInfo.value = res.data.data;
goodInfo.value = {
...res.data.data,
// details: res.data.data.details.,
};
swiperList.value = res.data.data.rotation.split(",");
console.log(goodInfo.value);
} catch (e) {
Taro.showToast({
title: e.msg,
@@ -221,25 +224,40 @@ const openSku = () => {
// const selectSku = () => {};
// const clickBtnOperate = () => {};
// const close = () => {};
const add_cart = async () => {
if (isSkuShow.value === false) return openSku();
try {
await addCart({ gid: goodInfo.value.gid });
Taro.showToast({
title: "加入购物车成功",
icon: "success",
duration: 2000,
});
} catch (e) {
Taro.showToast({
title: e.msg,
icon: "none",
});
}
isSkuShow.value = false;
};
// const add_cart = async () => {
// if (isSkuShow.value === false) return openSku();
// try {
// await addCart({ gid: goodInfo.value.gid });
// Taro.showToast({
// title: "加入购物车成功",
// icon: "success",
// duration: 2000,
// });
// } catch (e) {
// Taro.showToast({
// title: e.msg,
// icon: "none",
// });
// }
// isSkuShow.value = false;
// };
const toOrderDetail = async () => {
if (!Taro.getStorageSync("token")) {
return Taro.showModal({
title: "提示",
content: "你还没登录,请先登录",
cancelText: "先逛逛",
confirmText: "去登录",
success: (res) => {
if (res.confirm) {
Taro.reLaunch({
url: "/pages/users/login/index",
});
}
},
});
}
if (isSkuShow.value === false) return openSku();
// Taro.navigateTo({
// url: '/pages/goods/order_create/index'
@@ -260,7 +278,7 @@ const toOrderDetail = async () => {
});
}
orderData.value = res.data.data;
orderData.value = res?.data?.data;
isShowPay.value = true;
@@ -298,6 +316,12 @@ const toPage = (url: string, type: number = 1) => {
</script>
<style lang="scss">
page {
--nut-cell-box-shadow: none;
// --nut-cell-padding: 0;
--nut-cell-title-font: 30px;
}
// sku遮罩
.overlay {
background-color: rgba(0, 0, 0, 0.5);
@@ -311,12 +335,7 @@ const toPage = (url: string, type: number = 1) => {
position: fixed;
left: 30px;
top: 0;
/* #ifdef MP */
// height: 43px;
/* #endif */
/* #ifdef H5 */
height: 114px;
/* #endif */
}
.head-menu {
@@ -337,7 +356,7 @@ const toPage = (url: string, type: number = 1) => {
.nut-swiper-item img {
width: 100%;
height: 550px;
height: 730px;
}
.card {
@@ -371,13 +390,12 @@ const toPage = (url: string, type: number = 1) => {
}
.rich {
box-sizing: border-box;
// &[img] {
// max-width: 100%;
// }
width: 100%;
// &[alt] {
// max-width: 100%;
// img {
// width: 100%;
// height: auto;
// display: block;
// }
}
}
@@ -395,8 +413,9 @@ const toPage = (url: string, type: number = 1) => {
.bottom-box {
border-top: 1px solid #e5e5e585;
position: fixed;
box-sizing: border-box;
bottom: 0;
height: 5.5vh;
height: 150rpx;
background: #fff;
display: flex;
justify-content: space-between;
@@ -405,7 +424,7 @@ const toPage = (url: string, type: number = 1) => {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
z-index: 999;
width: 100vw;
width: 100%;
.left {
display: flex;