|
|
@@ -56,7 +56,7 @@
|
|
|
<view class="p-ab u-flex-center">
|
|
|
<view class="triangle-bottomright"></view>
|
|
|
<view class="seckill u-text-center u-font28">
|
|
|
- <!-- active_state 0:未开始 * 1:进行中 * 2:已结束 -->
|
|
|
+ <!-- activeState 0:未开始 * 1:进行中 * 2:已结束 -->
|
|
|
<view
|
|
|
class="u-bold"
|
|
|
style="padding: 20rpx"
|
|
|
@@ -111,9 +111,7 @@
|
|
|
已售
|
|
|
<text class="u-FF0000">{{ dataForm.resultSaleNum }}</text>
|
|
|
件,仅剩
|
|
|
- <text class="u-FF0000">{{
|
|
|
- dataForm.residueStockTotal
|
|
|
- }}</text>
|
|
|
+ <text class="u-FF0000">{{ dataForm.residueStockTotal }}</text>
|
|
|
件
|
|
|
</text>
|
|
|
</view>
|
|
|
@@ -197,8 +195,7 @@
|
|
|
>
|
|
|
还差
|
|
|
<text class="u-FF0000">{{
|
|
|
- item.groupPeopleNum -
|
|
|
- item.memberUserInfos.length
|
|
|
+ item.groupPeopleNum - item.memberUserInfos.length
|
|
|
}}</text>
|
|
|
人拼成
|
|
|
</view>
|
|
|
@@ -221,18 +218,18 @@
|
|
|
<view class="u-plr30 u-flex-center-sb pt-pb35">
|
|
|
<view class="u-flex-center" @click="goShop">
|
|
|
<view>
|
|
|
- <image class="u-avatar104" :src="shop.logo"></image>
|
|
|
+ <image class="u-avatar104" :src="shop.image"></image>
|
|
|
</view>
|
|
|
<view class="u-ml25">
|
|
|
<view class="u-font28 u-1A1A1A u-bold">{{
|
|
|
- shop.shopName
|
|
|
+ shop.businessName
|
|
|
}}</view>
|
|
|
<view class="u-999 u-font24 u-mt5 u-text2">
|
|
|
<text
|
|
|
class="iconfont"
|
|
|
style="color: #fa6138"
|
|
|
@click.stop="goLocal"
|
|
|
- ></text
|
|
|
+ ></text
|
|
|
>
|
|
|
{{ shop.provinceName }}{{ shop.cityName }}{{ shop.areaName
|
|
|
}}{{ shop.address }}
|
|
|
@@ -267,7 +264,7 @@
|
|
|
<view class="richText ql-editor-box">
|
|
|
<uv-parse
|
|
|
class="custom-parse"
|
|
|
- :content="goodsInfo.mobileDetail"
|
|
|
+ :content="goodsInfo.content"
|
|
|
></uv-parse>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -295,7 +292,7 @@
|
|
|
<view class="u-flex-center" v-if="!selectGroup">
|
|
|
<button
|
|
|
class="gb-btn btn-bg-dccda4 u-00321E btn-bg-dccda4-48"
|
|
|
- @click="goProduct(dataForm.goodsId)"
|
|
|
+ @click="goProduct(dataForm.productId)"
|
|
|
>
|
|
|
<view>
|
|
|
<view class="u-font36 u-bold"
|
|
|
@@ -308,7 +305,7 @@
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
- v-if="dataForm.active_state == 1"
|
|
|
+ v-if="dataForm.activeState == 1"
|
|
|
class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
|
|
|
@click="buy(1, dataForm.id)"
|
|
|
>
|
|
|
@@ -322,7 +319,7 @@
|
|
|
<view class="u-font22">发起拼团</view>
|
|
|
</button>
|
|
|
<button
|
|
|
- v-if="dataForm.active_state == 0"
|
|
|
+ v-if="dataForm.activeState == 0"
|
|
|
class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
|
|
|
@click="notStarted()"
|
|
|
>
|
|
|
@@ -336,7 +333,7 @@
|
|
|
<view class="u-font22">发起拼团</view>
|
|
|
</button>
|
|
|
<button
|
|
|
- v-if="dataForm.active_state == 2"
|
|
|
+ v-if="dataForm.activeState == 2"
|
|
|
class="gb-btn btn-bg-00320E u-DCCDA4 btn-bg-dccda4-482"
|
|
|
@click="itSover()"
|
|
|
>
|
|
|
@@ -355,7 +352,7 @@
|
|
|
<view class="u-flex-center" v-if="selectGroup">
|
|
|
<button
|
|
|
class="gb-btn btn-bg-dccda4 u-00321E"
|
|
|
- @click="goProduct(dataForm.goodsId)"
|
|
|
+ @click="goProduct(dataForm.productId)"
|
|
|
>
|
|
|
<view>
|
|
|
<view class="u-font36 u-bold"
|
|
|
@@ -379,7 +376,7 @@
|
|
|
</button>
|
|
|
<button
|
|
|
class="gb-btn btn-bg-dccda4 u-00321E"
|
|
|
- @click="goGdProduct(dataForm.goodsId)"
|
|
|
+ @click="goGdProduct(dataForm.productId)"
|
|
|
>
|
|
|
<view>
|
|
|
<view class="u-font36 u-bold"
|
|
|
@@ -395,63 +392,44 @@
|
|
|
</view>
|
|
|
|
|
|
<!--规格-->
|
|
|
- <uv-popup type="bottom" ref="specOpenRef" :touchmove="true">
|
|
|
+ <uv-popup mode="bottom" ref="specOpenRef" :touchmove="true" round="30rpx">
|
|
|
<view class="u-bg-fff spec">
|
|
|
<view class="u-plr30 flex-sb u-border-one-one pb30">
|
|
|
<view class="u-flex-center">
|
|
|
- <image
|
|
|
- class="u-goods200"
|
|
|
- :src="choseConfig.coverImage ? choseConfig.coverImage : cover"
|
|
|
- ></image>
|
|
|
+ <image class="u-goods200" :src="skuObj.cover"></image>
|
|
|
<view class="u-ml20">
|
|
|
<view class="u-999 u-font24 price-zhe">
|
|
|
<view class="u-FF0000 u-font36"
|
|
|
><rich-text
|
|
|
- :nodes="
|
|
|
- $mUtil.priceBigSmall(
|
|
|
- choseConfig.activityPrice
|
|
|
- ? choseConfig.activityPrice
|
|
|
- : moPrice
|
|
|
- )
|
|
|
- "
|
|
|
+ :nodes="$mUtil.priceBigSmall(skuObj.salePrice)"
|
|
|
></rich-text>
|
|
|
</view>
|
|
|
<text class="u-del u-ml15"
|
|
|
- >¥{{
|
|
|
- choseConfig.marketPrice
|
|
|
- ? choseConfig.marketPrice
|
|
|
- : moDelPrice
|
|
|
- }}</text
|
|
|
+ >¥{{ skuObj.originalSalePrice }}</text
|
|
|
>
|
|
|
<!-- <text class="u-ml10">{{ dataForm.discount }}折</text> -->
|
|
|
</view>
|
|
|
<view class="u-font22 u-999 u-mt5">
|
|
|
- 活动库存 {{ stock }} 件
|
|
|
- <text class="u-ml30"
|
|
|
- >商品库存{{
|
|
|
- choseConfig.ableStock
|
|
|
- ? choseConfig.ableStock
|
|
|
- : goodsTotalStock
|
|
|
- }}件</text
|
|
|
- >
|
|
|
+ 活动库存 {{ skuObj.stock }} 件
|
|
|
</view>
|
|
|
|
|
|
- <view class="u-font22 u-999 u-mt5"
|
|
|
- ><!-- 商品库存 {{goodsTotalStock}}件 --></view
|
|
|
- >
|
|
|
+ <view class="u-font22 u-999 u-mt5"></view>
|
|
|
<view class="u-1A1A1A u-mt25">{{
|
|
|
- choseConfig.skuSetName ? choseConfig.skuSetName : "请选择"
|
|
|
+ skuObj.skuSetName ? skuObj.skuSetName : "请选择"
|
|
|
}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="iconfont u-999 closeIcon" @click="specOpenClose"
|
|
|
+ <!-- <view class="iconfont u-999 closeIcon" @click="specOpenClose"
|
|
|
></view
|
|
|
- >
|
|
|
+ > -->
|
|
|
+ <view class="closeIcon" @click.stop="specOpenClose">
|
|
|
+ <uv-icon name="close-circle" color="#999999" size="36rpx"></uv-icon>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
<view class="content">
|
|
|
- <scroll-view scroll-y="true">
|
|
|
+ <scroll-view scroll-y style="max-height: 30vh">
|
|
|
<view class="">
|
|
|
<view
|
|
|
class="u-mt30 bottom-bor"
|
|
|
@@ -480,19 +458,15 @@
|
|
|
<view class="u-flex-center-sb">
|
|
|
<view>购买数量</view>
|
|
|
<view class="u-flex-center">
|
|
|
- <view class="iconfont minus" @click="resNum"></view>
|
|
|
- <view class="num">{{ addNumber }}</view>
|
|
|
- <view class="iconfont plus-sign" @click="addNum"></view>
|
|
|
+ <uv-number-box
|
|
|
+ v-model="addNumber"
|
|
|
+ disabledInput
|
|
|
+ ></uv-number-box>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="specOpen-btn">
|
|
|
- <view v-if="btnType == 0"
|
|
|
- ><button class="u-btn-two" @click="btnBuy(btnType)">
|
|
|
- 立即购买
|
|
|
- </button></view
|
|
|
- >
|
|
|
- <view v-else
|
|
|
- ><button class="u-btn-two" @click="btnBuy(btnType)">
|
|
|
+ <view
|
|
|
+ ><button class="u-btn-two" @click="btnBuy(1)">
|
|
|
立即购买
|
|
|
</button></view
|
|
|
>
|
|
|
@@ -502,7 +476,12 @@
|
|
|
</view>
|
|
|
</uv-popup>
|
|
|
<!--更多拼团-->
|
|
|
- <uv-popup type="center" backgroundColor="transparent" ref="gbOpenRef">
|
|
|
+ <uv-popup
|
|
|
+ mode="center"
|
|
|
+ backgroundColor="transparent"
|
|
|
+ ref="gbOpenRef"
|
|
|
+ round="30rpx"
|
|
|
+ >
|
|
|
<view class="iconfont u-text-right u-font40 u-FFF" @click="gbClose"
|
|
|
></view
|
|
|
>
|
|
|
@@ -574,35 +553,35 @@
|
|
|
<script setup>
|
|
|
import { ref, reactive, onMounted } from "vue";
|
|
|
import { onLoad, onShow, onShareAppMessage } from "@dcloudio/uni-app";
|
|
|
+import {
|
|
|
+ activitygoodsGoodsInfo_Api,
|
|
|
+ groupbuyingList_Api,
|
|
|
+ groupbuyTeamInfo_Api,
|
|
|
+ activitygoodsGroupbuying_Api,
|
|
|
+} from "@/api/groupbuy";
|
|
|
+import {
|
|
|
+ getBusinessInfoId_Api,
|
|
|
+ productInfo,
|
|
|
+ shopOrderCommentPage,
|
|
|
+} from "@/api/shop.js";
|
|
|
import comment from "@/components/ld-comment/ld-comment.vue";
|
|
|
import jVideo from "@/components/j-video/j-video.vue";
|
|
|
+import utils from "@/util/index.js";
|
|
|
const gbOpenRef = ref();
|
|
|
const specOpenRef = ref();
|
|
|
// 响应式数据
|
|
|
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight);
|
|
|
|
|
|
const imglist = ref([]);
|
|
|
-const goodsTotalStock = ref(null);
|
|
|
const isChecked = ref(0);
|
|
|
const btnName = ref("");
|
|
|
-const btnType = ref("");
|
|
|
+
|
|
|
const dataForm = ref({});
|
|
|
const shop = ref({});
|
|
|
-const shopDiscounts = ref({});
|
|
|
-const stock = ref(0);
|
|
|
-const cover = ref("");
|
|
|
const loading = ref(true);
|
|
|
-const moDelPrice = ref("");
|
|
|
-const moPrice = ref("");
|
|
|
-const goodsSkuList = ref([]);
|
|
|
const skuTab = ref([]);
|
|
|
-const goodsId = ref(null);
|
|
|
-const limitBuyNum = ref(0);
|
|
|
-const choseConfig = ref({});
|
|
|
const hasId = ref("");
|
|
|
const addNumber = ref(1);
|
|
|
-const goStatus = ref(0);
|
|
|
-const shopId = ref(0);
|
|
|
const commentList = ref([]);
|
|
|
const commentListLength = ref(0);
|
|
|
const goodsInfo = ref({});
|
|
|
@@ -610,13 +589,12 @@ const time1 = ref([0, 0, 0, 0]);
|
|
|
const time2 = ref([0, 0, 0, 0]);
|
|
|
const teamlist = ref([]);
|
|
|
const selectGroup = ref(null);
|
|
|
-const show = ref(false);
|
|
|
const teamId = ref(null);
|
|
|
-const id = ref(null);
|
|
|
+
|
|
|
+const skuObj = ref({});
|
|
|
|
|
|
// 页面生命周期
|
|
|
onLoad((options) => {
|
|
|
- id.value = options.id;
|
|
|
if (options.id) {
|
|
|
getDetailInfo(options.id);
|
|
|
}
|
|
|
@@ -638,9 +616,11 @@ onShareAppMessage((res) => {
|
|
|
return {
|
|
|
title: dataForm.value.shareTitle,
|
|
|
imageUrl: dataForm.value.shareImg,
|
|
|
- path: `/pages/product/goods/puzzleGoods?id=${dataForm.value.id}&Sshopid=${
|
|
|
- shopId.value
|
|
|
- }&teamId=${teamId.value || ""}&share=1&shareId=${user.id || ""}`,
|
|
|
+ path: `/pages/product/goods/puzzleGoods?id=${
|
|
|
+ dataForm.value.id
|
|
|
+ }&SbusinessId=${dataForm.value.businessId}&teamId=${
|
|
|
+ teamId.value || ""
|
|
|
+ }&share=1&shareId=${user.id || ""}`,
|
|
|
};
|
|
|
});
|
|
|
|
|
|
@@ -666,11 +646,12 @@ const goLocal = () => {
|
|
|
|
|
|
const goShop = () => {
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/convenienceService/shopDetails?shopId=" + shopId.value,
|
|
|
+ url: "/pages/shop/index?businessId=" + dataForm.value.businessId,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const recordSave = (shareUserId, goodsId) => {
|
|
|
+ return;
|
|
|
globalThis.$http
|
|
|
.post("/share/record/save", {
|
|
|
shareUserId: shareUserId,
|
|
|
@@ -686,12 +667,10 @@ const groupGoBuy = () => {
|
|
|
|
|
|
const gogroup = (item) => {
|
|
|
gbOpenRef.value.close();
|
|
|
- btnType.value = 1;
|
|
|
-
|
|
|
- globalThis.$http.get(`/groupbuy/team/info/${item.id}`).then((res) => {
|
|
|
+ groupbuyTeamInfo_Api(item.id).then((res) => {
|
|
|
if (res && res.code == 200) {
|
|
|
- time2.value = uni.$uv
|
|
|
- .countDown(Math.floor(res.data.count_down_end_time))
|
|
|
+ time2.value = utils
|
|
|
+ .countDown(Math.floor(res.data.countDownEndTime))
|
|
|
.split(":")
|
|
|
.map((val) => Number(val));
|
|
|
console.log(time2.value, 123);
|
|
|
@@ -702,118 +681,102 @@ const gogroup = (item) => {
|
|
|
};
|
|
|
|
|
|
const goGdProduct = () => {
|
|
|
- checkSku(selectGroup.value.group_buy_goodsId);
|
|
|
+ // checkSku(selectGroup.value.groupBuyGoodsId);
|
|
|
+ specOpenRef.value.open();
|
|
|
};
|
|
|
|
|
|
const overDown2 = () => {
|
|
|
getTeam();
|
|
|
};
|
|
|
|
|
|
-const getIndexList = (shopid) => {
|
|
|
- globalThis.$http.get("/yxt/shop/info/" + shopid).then((res) => {
|
|
|
- uni.stopPullDownRefresh();
|
|
|
- loading.value = false;
|
|
|
- if (res.data && res.code == 200) {
|
|
|
- shop.value = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const getByShop = (id) => {
|
|
|
- globalThis.$http.get("/marketing/firstOrder/getByShop/" + id).then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- shopDiscounts.value = res.data;
|
|
|
+// 获取店铺信息
|
|
|
+const getIndexList = (businessId) => {
|
|
|
+ getBusinessInfoId_Api(businessId).then((ret) => {
|
|
|
+ if (ret.data && ret.code == 200) {
|
|
|
+ shop.value = ret.data;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getTeam = () => {
|
|
|
- globalThis.$http
|
|
|
- .get(`/groupbuy/team/list/${shopId.value}/${dataForm.value.id}`)
|
|
|
- .then((res) => {
|
|
|
+ // console.log(dataForm.value.businessId, dataForm.value.id);
|
|
|
+ if (!dataForm.value.businessId || !dataForm.value.id) return;
|
|
|
+ groupbuyingList_Api(dataForm.value.businessId, dataForm.value.id).then(
|
|
|
+ (res) => {
|
|
|
if (res && res.code == 200) {
|
|
|
- res.list.forEach((val) => {
|
|
|
- val.time = uni.$uv
|
|
|
- .countDown(Math.floor(val.end_time / 1000))
|
|
|
+ res.data = res.data.map((val) => {
|
|
|
+ val.time = utils
|
|
|
+ .countDown(val.endTime)
|
|
|
.split(":")
|
|
|
.map((val) => Number(val));
|
|
|
+ return val;
|
|
|
});
|
|
|
- teamlist.value = res.list;
|
|
|
+ teamlist.value = res.data;
|
|
|
if (teamId.value) {
|
|
|
- btnType.value = 1;
|
|
|
- selectGroup.value = teamlist.value.filter(
|
|
|
- (val) => val.id == teamId.value
|
|
|
- )[0];
|
|
|
+ selectGroup.value = res.data.find((val) => val.id == teamId.value);
|
|
|
console.log("团队信息2" + JSON.stringify(selectGroup.value));
|
|
|
- time2.value = uni.$uv
|
|
|
- .countDown(Math.floor(selectGroup.value.end_time / 1000))
|
|
|
+ time2.value = utils
|
|
|
+ .countDown(selectGroup.value.endTime)
|
|
|
.split(":")
|
|
|
.map((val) => Number(val));
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
const getDetailInfo = (id) => {
|
|
|
- globalThis.$http
|
|
|
- .get("/groupbuy/activitygoods/goodsInfo/" + id)
|
|
|
- .then((res) => {
|
|
|
- loading.value = false;
|
|
|
-
|
|
|
- if (res && res.code == 200) {
|
|
|
- dataForm.value = res.data;
|
|
|
- shopId.value = res.data.shopId;
|
|
|
- imglist.value = res.data.cover.split(",");
|
|
|
- getByShop(shopId.value);
|
|
|
- getIndexList(shopId.value);
|
|
|
-
|
|
|
- if (res.data.active_state == 0) {
|
|
|
- time1.value = uni.$uv
|
|
|
- .countDown(res.data.activity_start_time)
|
|
|
- .split(":")
|
|
|
- .map((val) => Number(val));
|
|
|
- } else {
|
|
|
- time1.value = uni.$uv
|
|
|
- .countDown(res.data.finish_time)
|
|
|
- .split(":")
|
|
|
- .map((val) => Number(val));
|
|
|
- }
|
|
|
-
|
|
|
- globalThis.$http
|
|
|
- .get(`/goods/content/${dataForm.value.goodsId}`)
|
|
|
- .then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- goodsInfo.value = res.data;
|
|
|
- globalThis.$http
|
|
|
- .get("/marketing/firstOrder/getByShop/" + shopId.value)
|
|
|
- .then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- shopDiscounts.value = res.data;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ activitygoodsGoodsInfo_Api(id).then((res) => {
|
|
|
+ loading.value = false;
|
|
|
+ if (res && res.code == 200) {
|
|
|
+ dataForm.value = res.data;
|
|
|
+ dataForm.value.businessId = res.data.businessId;
|
|
|
+ getIndexList(dataForm.value.businessId);
|
|
|
+ if (res.data.activeState == 0) {
|
|
|
+ time1.value = utils
|
|
|
+ .countDown(res.data.startTime)
|
|
|
+ .split(":")
|
|
|
+ .map((val) => Number(val));
|
|
|
+ } else {
|
|
|
+ time1.value = utils
|
|
|
+ .countDown(res.data.finishTime)
|
|
|
+ .split(":")
|
|
|
+ .map((val) => Number(val));
|
|
|
+ }
|
|
|
|
|
|
- globalThis.$http
|
|
|
- .get(
|
|
|
- `/comment/orderGoods/getgoodscomments/${dataForm.value.goodsId}`
|
|
|
- )
|
|
|
- .then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- commentList.value = res.list;
|
|
|
- commentListLength.value =
|
|
|
- res.list && res.list.length ? res.list.length : 0;
|
|
|
+ productInfo(dataForm.value.productId).then((ret) => {
|
|
|
+ if (ret && ret.code == 200) {
|
|
|
+ goodsInfo.value = ret.data;
|
|
|
+ imglist.value = ret.data.images;
|
|
|
+ skuTab.value = ret.data.skuTable.map((item) => {
|
|
|
+ if (item.values) {
|
|
|
+ item.values[0].flag = true;
|
|
|
}
|
|
|
+ return item;
|
|
|
});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ shopOrderCommentPage({
|
|
|
+ productId: dataForm.value.productId,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ }).then((ret) => {
|
|
|
+ if (ret && ret.code == 200) {
|
|
|
+ commentList.value = ret.rows;
|
|
|
+ commentListLength.value = ret.total;
|
|
|
+ // console.log(commentListLength.value);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- getTeam();
|
|
|
- }
|
|
|
- });
|
|
|
+ getTeam();
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const goProduct = (id) => {
|
|
|
uni.navigateTo({
|
|
|
- url: "./goods?id=" + id,
|
|
|
+ url: "/pages/shop/goodsDetails?id=" + id,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -830,33 +793,21 @@ const change = (i) => {
|
|
|
};
|
|
|
|
|
|
const buy = (i, id) => {
|
|
|
- btnType.value = i;
|
|
|
selectGroup.value = null;
|
|
|
- checkSku(id);
|
|
|
- if (i == 0) {
|
|
|
- btnName.value = "加入购物车";
|
|
|
- } else {
|
|
|
- btnName.value = "立即购买";
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const resNum = () => {
|
|
|
- if (addNumber.value > 1) {
|
|
|
- addNumber.value--;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const addNum = () => {
|
|
|
- addNumber.value++;
|
|
|
+ chonseSku();
|
|
|
+ btnName.value = "立即购买";
|
|
|
+ specOpenRef.value.open();
|
|
|
};
|
|
|
|
|
|
const chonseSku = (index, id) => {
|
|
|
- skuTab.value[index].values.forEach((res) => {
|
|
|
- res.flag = false;
|
|
|
- if (res.id == id) {
|
|
|
- res.flag = true;
|
|
|
- }
|
|
|
- });
|
|
|
+ if (index != null) {
|
|
|
+ skuTab.value[index].values.forEach((res) => {
|
|
|
+ res.flag = false;
|
|
|
+ if (res.id == id) {
|
|
|
+ res.flag = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
let choseId = [];
|
|
|
skuTab.value.forEach((res) => {
|
|
|
res.values.forEach((Key) => {
|
|
|
@@ -865,116 +816,49 @@ const chonseSku = (index, id) => {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- let totalId = choseId.sort((a, b) => a - b).join("|");
|
|
|
+ let totalId = choseId.sort((a, b) => a - b).join("_");
|
|
|
+ totalId = "_" + totalId + "_";
|
|
|
hasId.value = totalId;
|
|
|
- goodsSkuList.value.forEach((res) => {
|
|
|
- let temp = res.sku_hash_code;
|
|
|
- let sku_hash_code_val = temp
|
|
|
- .split("|")
|
|
|
- .sort((a, b) => a - b)
|
|
|
- .join("|");
|
|
|
- if (sku_hash_code_val == totalId) {
|
|
|
- choseConfig.value = res;
|
|
|
- stock.value = dataForm.value.real_stock_total;
|
|
|
- // able_stock should be defined
|
|
|
- }
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const checkSku = (id) => {
|
|
|
- globalThis.$http
|
|
|
- .get(`/groupbuy/activitygoods/skus/${dataForm.value.id}`)
|
|
|
- .then((res) => {
|
|
|
- loading.value = false;
|
|
|
- if (res && res.code == 200) {
|
|
|
- choseConfig.value = {};
|
|
|
- hasId.value = "";
|
|
|
- goodsTotalStock.value = res.data.goodsTotalStock;
|
|
|
-
|
|
|
- res.data.goods.sku_table.forEach((keys) => {
|
|
|
- keys.values.forEach((val) => {
|
|
|
- val.flag = false;
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- limitBuyNum.value = dataForm.value.limitBuyNum;
|
|
|
- goodsId.value = dataForm.value.goodsId;
|
|
|
- goodsSkuList.value = res.data.goods_sku_list;
|
|
|
- moPrice.value = dataForm.value.min_price;
|
|
|
- moDelPrice.value = dataForm.value.min_sale_price;
|
|
|
- cover.value = imglist.value[0];
|
|
|
- stock.value = dataForm.value.real_stock_total;
|
|
|
-
|
|
|
- if (res.data.goods_auth) {
|
|
|
- if (res.data.goods_auth.added) {
|
|
|
- specOpenRef.value.open();
|
|
|
- } else {
|
|
|
- uni.$uv.toast("该商品已经下架");
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.$uv.toast("没有经营权限");
|
|
|
- }
|
|
|
-
|
|
|
- if (skuTab.value.length == 0) {
|
|
|
- skuTab.value = res.data.goods.sku_table;
|
|
|
- for (let i in skuTab.value) {
|
|
|
- skuTab.value[i].values[0].flag = true;
|
|
|
- }
|
|
|
- }
|
|
|
- chonseSku(0, skuTab.value[0].values[0].id);
|
|
|
+ if (goodsInfo.value.singleSku) {
|
|
|
+ if(dataForm.value.productSkuSetList.length>0) skuObj.value = dataForm.value.productSkuSetList[0];
|
|
|
+ } else {
|
|
|
+ dataForm.value.productSkuSetList.forEach((res) => {
|
|
|
+ if (res.skuHashCode == totalId) {
|
|
|
+ skuObj.value = res;
|
|
|
}
|
|
|
});
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
+
|
|
|
const specOpenClose = () => {
|
|
|
specOpenRef.value.close();
|
|
|
};
|
|
|
|
|
|
const btnBuys = () => {
|
|
|
- if (skuTab.value.length > 0 && hasId.value == "") {
|
|
|
- uni.$uv.toast("请选中sku");
|
|
|
+ if (!skuObj.value.id && hasId.value == "") {
|
|
|
+ uni.$uv.toast("请选中 sku");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (addNumber.value > limitBuyNum.value && limitBuyNum.value != 0) {
|
|
|
- uni.$uv.toast("商品限购" + limitBuyNum.value + "件");
|
|
|
+ if (
|
|
|
+ Number(addNumber.value) > dataForm.value.limitBuyNum &&
|
|
|
+ dataForm.value.limitBuyNum != 0
|
|
|
+ ) {
|
|
|
+ uni.$uv.toast("商品限购" + dataForm.value.limitBuyNum + "件");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//判断库存
|
|
|
- if (goodsSkuList.value.length > 0 && stock.value < addNumber.value) {
|
|
|
- uni.$uv.toast("商品库存只有" + stock.value + "件");
|
|
|
- globalThis.$http
|
|
|
- .post(`/singlegoods/understockrecord/save`, {
|
|
|
- shopId: shopId.value,
|
|
|
- goodsId: goodsId.value,
|
|
|
- single_goodsId: choseConfig.value.single_goodsId,
|
|
|
- sku_set_name: choseConfig.value.sku_set_name,
|
|
|
- buy_num: addNumber.value,
|
|
|
- })
|
|
|
- .then((res) => {});
|
|
|
+ if (
|
|
|
+ dataForm.value.productSkuSetList.length > 0 &&
|
|
|
+ Number(skuObj.value.stock) < Number(addNumber.value)
|
|
|
+ ) {
|
|
|
+ uni.$uv.toast("商品库存只有" + skuObj.value.stock + "件");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (goStatus.value == 0) {
|
|
|
- let data = {
|
|
|
- goodsId: goodsId.value,
|
|
|
- sku_hash_code: choseConfig.value.sku_hash_code,
|
|
|
- addNumber: addNumber.value,
|
|
|
- source_shopId: shopId.value.toString(),
|
|
|
- };
|
|
|
- globalThis.$http.post(`/cart/add`, data).then((res) => {
|
|
|
- if (res && res.code == 200) {
|
|
|
- uni.$uv.toast("添加成功");
|
|
|
- show.value = false;
|
|
|
- choseConfig.value = {};
|
|
|
- addNumber.value = 1;
|
|
|
- // cartList();
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- psotJson();
|
|
|
- }
|
|
|
+ // psotJson();
|
|
|
};
|
|
|
|
|
|
const psotJson = () => {
|
|
|
@@ -983,28 +867,28 @@ const psotJson = () => {
|
|
|
let parendArr = [];
|
|
|
|
|
|
childArr.push({
|
|
|
- user_cart_id: 0,
|
|
|
- activity_goodsId: choseConfig.value.activity_goodsId,
|
|
|
- goodsId: goodsId.value,
|
|
|
+ userCartId: 0,
|
|
|
+ activityGoodsId: skuObj.value.activityGoodsId,
|
|
|
+ productId: dataForm.value.productId,
|
|
|
num: addNumber.value,
|
|
|
- sku_hash_code: choseConfig.value.sku_hash_code,
|
|
|
+ skuHashCode: skuObj.value.skuHashCode,
|
|
|
});
|
|
|
|
|
|
parendArr.push({
|
|
|
- shopId: shop.value.id,
|
|
|
- source_shopId: shop.value.id,
|
|
|
- activity_id: dataForm.value.group_buy_id,
|
|
|
- sponsor_activity_id: selectGroup.value ? selectGroup.value.id : 0,
|
|
|
- user_remark: "",
|
|
|
+ businessId: dataForm.value.businessId,
|
|
|
+ sourceShopId: shop.value.id,
|
|
|
+ activityId: dataForm.value.groupBuyId,
|
|
|
+ sponsorActivityId: selectGroup.value ? selectGroup.value.id : 0,
|
|
|
+ userRemark: "",
|
|
|
items: childArr,
|
|
|
});
|
|
|
|
|
|
dataJson = {
|
|
|
- is_cart: false,
|
|
|
- receipt_id: null,
|
|
|
- shipment_mode: 0,
|
|
|
- shop_orders: parendArr,
|
|
|
- marketing_type: 2,
|
|
|
+ isCart: false,
|
|
|
+ receiptId: null,
|
|
|
+ shipmentMode: 0,
|
|
|
+ shopOrders: parendArr,
|
|
|
+ marketingType: 2,
|
|
|
};
|
|
|
|
|
|
uni.setStorageSync("dataJson", dataJson);
|
|
|
@@ -1014,14 +898,7 @@ const psotJson = () => {
|
|
|
};
|
|
|
|
|
|
const btnBuy = (i) => {
|
|
|
- goStatus.value = i;
|
|
|
- let token = uni.getStorageSync("apiToken");
|
|
|
- if (!token) {
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/login/index",
|
|
|
- });
|
|
|
- } else {
|
|
|
- // $u.throttle(btnBuys, 500);
|
|
|
+ if (!utils.isLoginTo(true)) {
|
|
|
btnBuys();
|
|
|
}
|
|
|
};
|
|
|
@@ -1338,7 +1215,7 @@ page {
|
|
|
.spec {
|
|
|
border-radius: 18rpx 18rpx 0rpx 0rpx;
|
|
|
padding-top: 30rpx;
|
|
|
- max-height: 900rpx;
|
|
|
+ // max-height: 900rpx;
|
|
|
overflow-y: auto;
|
|
|
|
|
|
// position: fixed;
|