Merge branch 'develop' into dongjian

# Conflicts:
#	pages/other_package/productInfo/productInfo.vue
This commit is contained in:
2025-09-09 12:45:04 +08:00
4 changed files with 1275 additions and 1279 deletions
+2 -2
View File
@@ -3,10 +3,10 @@
<view class="mine_header"> <view class="mine_header">
<view class="mine_login_data" v-if="currentUserData && Object.keys(currentUserData).length !== 0"> <view class="mine_login_data" v-if="currentUserData && Object.keys(currentUserData).length !== 0">
<view class="mine_data"> <view class="mine_data">
<up-image src="/static/mine/avatar.png" shape="circle" width="54" height="54" bgColor="#f1f6ff00"></up-image> <up-image :src="currentUserData.avatarUrl ? currentUserData.avatarUrl : '/static/mine/avatar.png'" shape="circle" width="54" height="54" bgColor="#f1f6ff00"></up-image>
<view class="mine_info"> <view class="mine_info">
<view class="mine_info_name"> <view class="mine_info_name">
<text style="margin-right: 20rpx">{{ currentUserData.name || '信任桥用户' }}</text> <text style="margin-right: 20rpx">{{ currentUserData.nickname || '信任桥用户' }}</text>
<view class="level"> <view class="level">
<up-image <up-image
src="/static/mine/rz.png" src="/static/mine/rz.png"
@@ -3,18 +3,20 @@
<!-- 导航栏 --> <!-- 导航栏 -->
<view class="header_"> <view class="header_">
<view style="margin-top: 10rpx;"> <view style="margin-top: 10rpx;">
<up-image src="/static/common/left_b.png" width="18" height="20" bgColor="#f1f6ff00" @click="jumpMine" /> <up-image src="/static/common/left_b.png" width="18" height="20" bgColor="#f1f6ff00"
@click="jumpMine" />
</view> </view>
<view class="title_">我的推广</view> <view class="title_">我的推广</view>
</view> </view>
<!-- 我的信息 --> <!-- 我的信息 -->
<view class="my_info"> <view class="my_info">
<view class="left_"> <view class="left_">
<up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/logo_y.png" width="50" height="50" <up-image
bgColor="#f1f6ff00" shape="circle" /> :src="userData.avatarUrl ? userData.avatarUrl: 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/logo_y.png'"
width="50" height="50" bgColor="#f1f6ff00" shape="circle" />
<view class="left_msg"> <view class="left_msg">
<view> <view>
<text>{{ userData.name || '信任桥用户' }}</text> <text>{{ userData.nickname || '信任桥用户' }}</text>
<text style="margin-left: 20rpx;">{{ userData.gradeName }}</text> <text style="margin-left: 20rpx;">{{ userData.gradeName }}</text>
</view> </view>
<view class="left_msg_title">ID:{{ userData.id || 0 }}</view> <view class="left_msg_title">ID:{{ userData.id || 0 }}</view>
@@ -113,7 +115,8 @@
<view class="card_item_comm"> <view class="card_item_comm">
<view class="card_title_comm">提成来源</view> <view class="card_title_comm">提成来源</view>
<view class="royalty_list"> <view class="royalty_list">
<scroll-view scroll-y="true" @scrolltolower="loadMore" :style="{ 'height': 'calc(100vh - 1220rpx)' }"> <scroll-view scroll-y="true" @scrolltolower="loadMore"
:style="{ 'height': 'calc(100vh - 1220rpx)' }">
<view class="royalty_item" v-for="(item, index) in royaltyList" :key="index" <view class="royalty_item" v-for="(item, index) in royaltyList" :key="index"
v-if="royaltyList && royaltyList.length !== 0"> v-if="royaltyList && royaltyList.length !== 0">
<view> <view>
@@ -126,8 +129,8 @@
</view> </view>
</view> </view>
<view v-else class="not_order_warp"> <view v-else class="not_order_warp">
<up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_order.png" width="80" <up-image src="https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_order.png"
height="80" bgColor="#f1f6ff00"></up-image> width="80" height="80" bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">暂无相关数据</view> <view class="not_order_msg_warp">暂无相关数据</view>
</view> </view>
<view v-if="royaltyLoading" style="text-align: center;">加载中...</view> <view v-if="royaltyLoading" style="text-align: center;">加载中...</view>
@@ -187,12 +190,27 @@
</template> </template>
<script> <script>
import {
import { getPerformance, getAcctCategory, getRewardSummaryRecord, getRewardSummary } from '@/api/team.js'; getPerformance,
import { formatDate } from '@/utils/index.js'; getAcctCategory,
import { BALANCE_TYPE, getValue } from '@/utils/enumUtils.js'; getRewardSummaryRecord,
import { getStorageFun, USER_DATA } from '@/utils/auth.js'; getRewardSummary
import { getUserInfo, bindInvitationCode } from '@/api/auth.js' } from '@/api/team.js';
import {
formatDate
} from '@/utils/index.js';
import {
BALANCE_TYPE,
getValue
} from '@/utils/enumUtils.js';
import {
getStorageFun,
USER_DATA
} from '@/utils/auth.js';
import {
getUserInfo,
bindInvitationCode
} from '@/api/auth.js'
export default { export default {
computed: { computed: {
+134 -156
View File
@@ -2,9 +2,7 @@
<view class="product_info_warp"> <view class="product_info_warp">
<!-- 头部产品描述图 --> <!-- 头部产品描述图 -->
<view class="product_info_header_warp"> <view class="product_info_header_warp">
<up-swiper :list="swiperList" class="product_info_header_swiper" @click="onSwiper" <up-swiper :list="swiperList" class="product_info_header_swiper" @click="onSwiper" @change="(e) => (currentNum = e.current)">
@change="e => currentNum = e.current">
<template #indicator> <template #indicator>
<view class="indicator-num"> <view class="indicator-num">
<text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length }}</text> <text class="indicator-num__text">{{ currentNum + 1 }}/{{ swiperList.length }}</text>
@@ -12,12 +10,10 @@
</template> </template>
</up-swiper> </up-swiper>
<view class="img_comm left_warp"> <view class="img_comm left_warp">
<up-image src="/static/common/left_b_st.png" width="30" height="30" bgColor="#f1f6ff00" <up-image src="/static/common/left_b_st.png" width="30" height="30" bgColor="#f1f6ff00" @click="jumpLeft"></up-image>
@click="jumpLeft"></up-image>
</view> </view>
<view class="img_comm right_warp"> <view class="img_comm right_warp">
<up-image src="/static/common/share_st.png" width="30" height="30" bgColor="#f1f6ff00" <up-image src="/static/common/share_st.png" width="30" height="30" bgColor="#f1f6ff00" @click="jumpShare"></up-image>
@click="jumpShare"></up-image>
</view> </view>
</view> </view>
<!-- 数据详情 --> <!-- 数据详情 -->
@@ -26,10 +22,8 @@
<view class="content_data"> <view class="content_data">
<view class="content_data_price"> <view class="content_data_price">
<text>¥</text> <text>¥</text>
<text style="font-size: 60rpx;" v-if="orderInfo.minPrice && orderInfo.maxPrice"> <text style="font-size: 60rpx" v-if="orderInfo.minPrice && orderInfo.maxPrice">{{ orderInfo.minPrice }} - {{ orderInfo.maxPrice }}</text>
{{ orderInfo.minPrice }} - {{ orderInfo.maxPrice }} <text style="font-size: 60rpx" v-else>{{ orderInfo.minPrice }}</text>
</text>
<text style="font-size: 60rpx;" v-else>{{ orderInfo.minPrice }}</text>
<text class="price_o">¥{{ orderInfo.adPrice }}</text> <text class="price_o">¥{{ orderInfo.adPrice }}</text>
</view> </view>
<view class="content_data_title"> <view class="content_data_title">
@@ -37,8 +31,7 @@
</view> </view>
<view class="content_data_series"> <view class="content_data_series">
<!-- 暂时隐藏 --> <!-- 暂时隐藏 -->
<view> <view></view>
</view>
<!-- 销量还需要改 --> <!-- 销量还需要改 -->
<view>销量{{ orderInfo.sales }}件</view> <view>销量{{ orderInfo.sales }}件</view>
</view> </view>
@@ -61,7 +54,7 @@
<view class="concrete_item_value"> <view class="concrete_item_value">
<view class="address_warp"> <view class="address_warp">
<up-image src="/static/common/address2.png" width="10" height="10" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/address2.png" width="10" height="10" bgColor="#f1f6ff00"></up-image>
<view style="margin-left: 10rpx;">请填写地址</view> <view style="margin-left: 10rpx">请填写地址</view>
</view> </view>
<view class="address_72_warp">现货{{ getValue(PRODUCT_DELIVERY_TIME, orderInfo.deliveryTime) }}</view> <view class="address_72_warp">现货{{ getValue(PRODUCT_DELIVERY_TIME, orderInfo.deliveryTime) }}</view>
</view> </view>
@@ -97,30 +90,25 @@
<view class="product_but_warp"> <view class="product_but_warp">
<view class="product_but_left"> <view class="product_but_left">
<view class="left_item"> <view class="left_item">
<up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" <up-image src="/static/product/home.png" width="20" height="20" bgColor="#f1f6ff00" @click="jumpOther('home')"></up-image>
@click="jumpOther('home')"></up-image>
<view>首页</view> <view>首页</view>
</view> </view>
<view class="left_item"> <view class="left_item">
<up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" <up-image src="/static/product/kefu.png" width="20" height="20" bgColor="#f1f6ff00" @click="onZiXun"></up-image>
@click="onZiXun"></up-image>
<view>咨询</view> <view>咨询</view>
</view> </view>
<view class="left_item" v-if="!ji"> <view class="left_item" v-if="!ji">
<up-image src="/static/product/cart.png" width="24" height="20" bgColor="#f1f6ff00" <up-image src="/static/product/cart.png" width="24" height="20" bgColor="#f1f6ff00" @click="jumpOther('cart')"></up-image>
@click="jumpOther('cart')"></up-image>
<view>购物车</view> <view>购物车</view>
</view> </view>
</view> </view>
<view class="product_but_right"> <view class="product_but_right">
<view v-if="!ji" class="but_comm join_warp" @click="checkSpecification(true, 'addCart')">加入购物车</view> <view v-if="!ji" class="but_comm join_warp" @click="checkSpecification(true, 'addCart')">加入购物车</view>
<view class="but_comm buy_warp" :class="{ 'border-16': ji }" @click="checkSpecification(true, 'buy')">立即购买 <view class="but_comm buy_warp" :class="{ 'border-16': ji }" @click="checkSpecification(true, 'buy')">立即购买</view>
</view>
</view> </view>
</view> </view>
<!-- 选择规格的弹框 --> <!-- 选择规格的弹框 -->
<up-popup :show="specificationShow" :round="10" :closeOnClickOverlay="false" :closeable="true" <up-popup :show="specificationShow" :round="10" :closeOnClickOverlay="false" :closeable="true" @close="specificationShow = false" mode="bottom">
@close="specificationShow = false" mode="bottom">
<view class="specification_warp"> <view class="specification_warp">
<!-- 选择地址 --> <!-- 选择地址 -->
<view class="specification_adress_warp"> <view class="specification_adress_warp">
@@ -142,20 +130,17 @@
<view class="price_warp"> <view class="price_warp">
<view class="price_content_warp"> <view class="price_content_warp">
<view>¥</view> <view>¥</view>
<text style="font-size: 50rpx;" <text style="font-size: 50rpx" v-if="selectSpecificationTempl && Object.keys(selectSpecificationTempl).length !== 0">
v-if="selectSpecificationTempl && Object.keys(selectSpecificationTempl).length !== 0">
{{ selectSpecificationTempl.price }} {{ selectSpecificationTempl.price }}
</text> </text>
<view style="font-size: 50rpx" v-else> <view style="font-size: 50rpx" v-else>
{{ orderInfo.minPrice }} {{ orderInfo.minPrice }}
<text v-if="orderInfo.maxPrice">- {{ orderInfo.maxPrice }}</text> <text v-if="orderInfo.maxPrice">- {{ orderInfo.maxPrice }}</text>
</view> </view>
<view class="price_content_coupon_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0"> <view class="price_content_coupon_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0">优惠卷{{ orderInfo.couponPrice }}</view>
优惠卷{{ orderInfo.couponPrice }}</view>
</view> </view>
<view class="oOrice_content_warp">¥{{ orderInfo.adPrice }}</view> <view class="oOrice_content_warp">¥{{ orderInfo.adPrice }}</view>
<view class="coupon_content_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0"> <view class="coupon_content_warp" v-if="orderInfo.couponPrice && orderInfo.couponPrice !== 0">优惠卷已优惠¥{{ orderInfo.couponPrice }}</view>
优惠卷已优惠¥{{ orderInfo.couponPrice }}</view>
</view> </view>
<view class="inventory_warp"> <view class="inventory_warp">
<view>库存</view> <view>库存</view>
@@ -171,7 +156,10 @@
<view class="specification_item_warp"> <view class="specification_item_warp">
<view <view
:class="oItem.inventory === 0 ? 'item_Warp item_Warp_no_warp' : item.selectVal === oItem.n ? 'item_Warp item_Warp_yes_warp' : 'item_Warp'" :class="oItem.inventory === 0 ? 'item_Warp item_Warp_no_warp' : item.selectVal === oItem.n ? 'item_Warp item_Warp_yes_warp' : 'item_Warp'"
v-for="(oItem, oIndex) in item.items" :key="oItem.n" @click="clickSpecification(index, oItem)"> v-for="(oItem, oIndex) in item.items"
:key="oItem.n"
@click="clickSpecification(index, oItem)"
>
{{ oItem.n }} {{ oItem.n }}
</view> </view>
</view> </view>
@@ -188,11 +176,9 @@
</view> </view>
</view> </view>
<view v-if="specificationShowType === 'buy'" class="specification_buy_but" @click="addCart(true)">去支付</view> <view v-if="specificationShowType === 'buy'" class="specification_buy_but" @click="addCart(true)">去支付</view>
<view v-else-if="specificationShowType === 'addCart'" class="specification_buy_but" @click="addCart(false)"> <view v-else-if="specificationShowType === 'addCart'" class="specification_buy_but" @click="addCart(false)">加入购物车</view>
加入购物车
</view>
<view v-else class="product_but_right popup_but"> <view v-else class="product_but_right popup_but">
<view class='but_comm join_warp' @click="addCart(false)">加入购物车</view> <view class="but_comm join_warp" @click="addCart(false)">加入购物车</view>
<view class="but_comm buy_warp" @click="addCart(true)">立即购买</view> <view class="but_comm buy_warp" @click="addCart(true)">立即购买</view>
</view> </view>
</view> </view>
@@ -201,21 +187,16 @@
<!-- 我的客服 --> <!-- 我的客服 -->
<up-modal :show="serviceShow" :showConfirmButton="false"> <up-modal :show="serviceShow" :showConfirmButton="false">
<view class="slot-content"> <view class="slot-content">
<view class="close_warp" @click="serviceShow = false;"> <view class="close_warp" @click="serviceShow = false">
<up-image src="/static/common/close.png" width="20" height="20" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/close.png" width="20" height="20" bgColor="#f1f6ff00"></up-image>
</view> </view>
<view class="content_"> <view class="content_">
<view class="content_1">{{ source === "supply_chain" ? '云仓客服' : '平台客服' }}</view> <view class="content_1">{{ source === 'supply_chain' ? '云仓客服' : '平台客服' }}</view>
<view class="content_3">{{ source === "supply_chain" <view class="content_3">{{ source === 'supply_chain' ? CLOUD_SERVICE_PHONE_NUMBER : CUSTOMER_SERVICE_PHONE_NUMBER }}</view>
? CLOUD_SERVICE_PHONE_NUMBER : CUSTOMER_SERVICE_PHONE_NUMBER }}
</view>
</view> </view>
<view class="but_"> <view class="but_">
<view class="but_copy" <view class="but_copy" @click="copyMobile(source === 'supply_chain' ? CLOUD_SERVICE_PHONE_NUMBER : CUSTOMER_SERVICE_PHONE_NUMBER)">复制号码</view>
@click="copyMobile(source === 'supply_chain' ? CLOUD_SERVICE_PHONE_NUMBER : CUSTOMER_SERVICE_PHONE_NUMBER)"> <view class="but_close" @click="serviceShow = false">取消</view>
复制号码
</view>
<view class="but_close" @click="serviceShow = false;">取消</view>
</view> </view>
</view> </view>
</up-modal> </up-modal>
@@ -225,9 +206,7 @@
<view class="uni-banner"> <view class="uni-banner">
<view class="banner_box"> <view class="banner_box">
<view class="title_">温馨提示</view> <view class="title_">温馨提示</view>
<view class="msg_"> <view class="msg_">该商家暂未开通供应链权限,请联系供应链客服开通授权。</view>
该商家暂未开通供应链权限,请联系供应链客服开通授权。
</view>
<view class="phone_">{{ CLOUD_SERVICE_PHONE_NUMBER }}</view> <view class="phone_">{{ CLOUD_SERVICE_PHONE_NUMBER }}</view>
<view class="but_"> <view class="but_">
<view class="but_b" @click="copyMobile(CLOUD_SERVICE_PHONE_NUMBER)">立即联系</view> <view class="but_b" @click="copyMobile(CLOUD_SERVICE_PHONE_NUMBER)">立即联系</view>
@@ -242,7 +221,7 @@
<script> <script>
import { getGoodsDetail, addGoods, getGoodsSpecs } from '@/api/product.js'; import { getGoodsDetail, addGoods, getGoodsSpecs } from '@/api/product.js';
import { getValue, PRODUCT_DELIVERY_TIME } from '@/utils/enumUtils.js'; import { getValue, PRODUCT_DELIVERY_TIME } from '@/utils/enumUtils.js';
import { copyData } from '@/utils/index.js' import { copyData } from '@/utils/index.js';
import { CUSTOMER_SERVICE_PHONE_NUMBER, CLOUD_SERVICE_PHONE_NUMBER } from '@/utils/config.js'; import { CUSTOMER_SERVICE_PHONE_NUMBER, CLOUD_SERVICE_PHONE_NUMBER } from '@/utils/config.js';
export default { export default {
@@ -255,7 +234,7 @@ export default {
}, },
CLOUD_SERVICE_PHONE_NUMBER() { CLOUD_SERVICE_PHONE_NUMBER() {
return CLOUD_SERVICE_PHONE_NUMBER; return CLOUD_SERVICE_PHONE_NUMBER;
}, }
}, },
data() { data() {
return { return {
@@ -273,7 +252,7 @@ export default {
openShow: false, openShow: false,
source: null, // 来源:供应链,自营 source: null, // 来源:供应链,自营
ji: 0 ji: 0
} };
}, },
onLoad(options) { onLoad(options) {
const id = options.id; const id = options.id;
@@ -288,13 +267,12 @@ export default {
this.getById(); this.getById();
} }
} }
}, },
methods: { methods: {
onZiXun() { onZiXun() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/rwa_package/setting/kefu?type=5260' url: '/pages/rwa_package/setting/kefu?type=5260'
}) });
}, },
getValue, getValue,
onSwiper(index) { onSwiper(index) {
@@ -316,17 +294,20 @@ export default {
}, },
jumpOther(type) { jumpOther(type) {
if (type === 'home') { if (type === 'home') {
uni.switchTab({// 首页
url: '/pages/home/home',
})
} else if (type === "share") {// 分享
uni.navigateTo({
url: '/pages/other_package/invite_friends/invite_friends',
})
} else if (type === "cart") {// 购物车
uni.switchTab({ uni.switchTab({
url: '/pages/shopping_cart/shopping_cart', // 首页
}) url: '/pages/home/home'
});
} else if (type === 'share') {
// 分享
uni.navigateTo({
url: '/pages/other_package/invite_friends/invite_friends'
});
} else if (type === 'cart') {
// 购物车
uni.switchTab({
url: '/pages/shopping_cart/shopping_cart'
});
} }
}, },
/** /**
@@ -334,21 +315,20 @@ export default {
*/ */
async getById() { async getById() {
const params = { const params = {
id: this.id, id: this.id
} };
const resp = await getGoodsDetail(params); const resp = await getGoodsDetail(params);
if (resp && resp.bizcode === 100) { if (resp && resp.bizcode === 100) {
const data = resp.data; const data = resp.data;
this.ji = data.type == 3 ? 1 : 0; this.ji = data.type == 3 ? 1 : 0;
// 商品图 // 商品图
if (data.goodsGraph) { if (data.goodsGraph) {
this.swiperList = data.goodsGraph.split(","); this.swiperList = data.goodsGraph.split(',');
} }
data.addressObj = {}// 收件人地址 data.addressObj = {}; // 收件人地址
data.quantity = 1// 数量 data.quantity = 1; // 数量
data.inventory = 0// 库存 data.inventory = 0; // 库存
this.orderInfo = data; this.orderInfo = data;
} }
}, },
/** /**
@@ -357,45 +337,45 @@ export default {
getSupplyChainById() { getSupplyChainById() {
const params = { const params = {
goods_id: this.id, goods_id: this.id,
app_id: "2024111300164927", app_id: '2024111300164927',
sign_type: "MD5", sign_type: 'MD5',
sign: "d04be0cedd49608e758458325faecf90", sign: 'd04be0cedd49608e758458325faecf90'
} };
uni.request({ uni.request({
url: "https://cyysc.gscm.top/outside/1/atm/goods/detail", url: 'https://cyysc.gscm.top/outside/1/atm/goods/detail',
method: "get", method: 'get',
data: params, data: params,
header: { header: {},
},
success: (res) => { success: (res) => {
const data = res.data; const data = res.data;
if (data && data.result === 1) { if (data && data.result === 1) {
const objData = data.data; const objData = data.data;
const content = objData.content.replace(/&amp;/g, '&') const content = objData.content
.replace(/&lt;/g, "<") .replace(/&amp;/g, '&')
.replace(/&gt;/g, ">") .replace(/&lt;/g, '<')
.replace(/&quot;/g, "\'") .replace(/&gt;/g, '>')
.replace(/&#39;/g, '\"') .replace(/&quot;/g, "'")
.replace(/\n/g, "<br>"); .replace(/&#39;/g, '"')
.replace(/\n/g, '<br>');
const orderInfo = { const orderInfo = {
detailInfo: content, detailInfo: content,
minPrice: objData.min_price, minPrice: objData.min_price,
// maxPrice:objData.max_price, // maxPrice:objData.max_price,
adPrice: objData.price, adPrice: objData.price,
sales: objData.virtual_sales, sales: objData.virtual_sales
} };
const domain = "https://cyysc.gscm.top"; const domain = 'https://cyysc.gscm.top';
let currentThumb = objData.thumb; let currentThumb = objData.thumb;
if (objData.thumb.indexOf('https://') === -1 && objData.thumb.indexOf('http://') === -1) { if (objData.thumb.indexOf('https://') === -1 && objData.thumb.indexOf('http://') === -1) {
currentThumb = domain + "/static/upload/" + objData.thumb; currentThumb = domain + '/static/upload/' + objData.thumb;
} }
this.swiperList = [currentThumb]; // 封面图 this.swiperList = [currentThumb]; // 封面图
this.orderInfo = orderInfo; this.orderInfo = orderInfo;
} }
}, },
fail: (error) => { fail: (error) => {
console.log("error", error); console.log('error', error);
}, }
}); });
}, },
async checkSpecification(val, type) { async checkSpecification(val, type) {
@@ -403,14 +383,14 @@ export default {
if (type == 'n' && this.ji == 1) { if (type == 'n' && this.ji == 1) {
type = 'buy'; type = 'buy';
} }
console.log('afsdfsd', source, type) console.log('afsdfsd', source, type);
if (source && source === "supply_chain") { if (source && source === 'supply_chain') {
this.openShow = true; this.openShow = true;
return; return;
} }
// 需要查询一下最新的规格 // 需要查询一下最新的规格
if (val) { if (val) {
await this.querySpecification() await this.querySpecification();
const data = this.orderInfo; const data = this.orderInfo;
this.getSpecification(data.specs); this.getSpecification(data.specs);
} else { } else {
@@ -426,28 +406,28 @@ export default {
const optionArr = []; const optionArr = [];
if (specs) { if (specs) {
const arr = JSON.parse(specs); const arr = JSON.parse(specs);
arr.map(item => { arr.map((item) => {
optionArr.push({ optionArr.push({
type: item.type, type: item.type,
items: item.items, items: item.items,
selectVal: null, selectVal: null
}) });
}) });
} }
this.specificationList = optionArr; this.specificationList = optionArr;
}, },
// 获取规格模版数据 // 获取规格模版数据
async querySpecification() { async querySpecification() {
const params = { const params = {
id: this.id, id: this.id
} };
const resp = await getGoodsSpecs(params); const resp = await getGoodsSpecs(params);
if (resp && resp.bizcode === 100) { if (resp && resp.bizcode === 100) {
const data = resp.data; const data = resp.data;
let stock = 0; let stock = 0;
data.map(item => { data.map((item) => {
stock = stock + item.stock; stock = stock + item.stock;
}) });
this.specificationTempl = data; this.specificationTempl = data;
this.orderInfo.inventory = stock; // 库存 this.orderInfo.inventory = stock; // 库存
} }
@@ -468,25 +448,17 @@ export default {
this.selectSpecification = currentSelectSpecification; this.selectSpecification = currentSelectSpecification;
const oldLength = this.specificationList.length; const oldLength = this.specificationList.length;
const newLength = this.selectSpecification.length; const newLength = this.selectSpecification.length;
console.log('selectSpecificationFun',oldLength,newLength)
// 开始做校验 // 开始做校验
if (oldLength === newLength) { if (oldLength === newLength) {
const newLengthStr = this.selectSpecification.join("♧"); const newLengthStr = this.selectSpecification.join('♧');
const specificationTempl = this.specificationTempl; const specificationTempl = this.specificationTempl;
let selectTempl = {}; let selectTempl = {};
specificationTempl.map((item) => {
console.log('selectSpecificationFun1',specificationTempl,this.selectSpecification)
specificationTempl.map(item => {
console.log('selectSpecificationFun11',item.combNames,newLengthStr)
if (item.combNames === newLengthStr) { if (item.combNames === newLengthStr) {
selectTempl = item selectTempl = item;
return; return;
} }
}); });
console.log('selectSpecificationFun11',selectTempl)
this.selectSpecificationTempl = selectTempl; this.selectSpecificationTempl = selectTempl;
this.orderInfo.inventory = selectTempl.stock; // 库存 this.orderInfo.inventory = selectTempl.stock; // 库存
} }
@@ -494,26 +466,31 @@ export default {
// 改变数量 // 改变数量
quantityFun(type) { quantityFun(type) {
let currentQuantity = this.orderInfo.quantity; // 当前数量 let currentQuantity = this.orderInfo.quantity; // 当前数量
if (type === "minus") { const minBuyNum = this.selectSpecificationTempl.minBuyNum || 1; // 当前起订量,默认为1
if (currentQuantity === 1) {
// 确保起订量至少为1
const step = Math.max(minBuyNum, 1);
if (type === 'minus') {
// 计算减少后的数量,确保不低于最小起订量且是其倍数
const newQuantity = currentQuantity - step;
if (newQuantity < minBuyNum) {
this.$refs.uToastRef.show({ this.$refs.uToastRef.show({
type: 'error', type: 'error',
message: "不能低于最低购买数量", message: `不能低于最低购买数量${minBuyNum}`
}); });
} else { } else {
currentQuantity = currentQuantity - 1; currentQuantity = newQuantity;
} }
} else if (type === "add") { } else if (type === 'add') {
// 需要判断一下库存 currentQuantity = currentQuantity + step;
currentQuantity = currentQuantity + 1;
} }
this.orderInfo.quantity = currentQuantity; this.orderInfo.quantity = currentQuantity;
}, },
// 加入购入车 // 加入购入车
async addCart(isBy = false) { async addCart(isBy = false) {
const selectTempl = this.selectSpecificationTempl; const selectTempl = this.selectSpecificationTempl;
console.log('aaaaaaaaaaaa',selectTempl)
if (!selectTempl || Object.keys(selectTempl).length === 0) { if (!selectTempl || Object.keys(selectTempl).length === 0) {
uni.showToast({ uni.showToast({
title: '请先选择规格', title: '请先选择规格',
@@ -522,26 +499,33 @@ export default {
}); });
return; return;
} }
if (!(selectTempl.minBuyNum > 0 && this.orderInfo.quantity >= selectTempl.minBuyNum && this.orderInfo.quantity % selectTempl.minBuyNum === 0)) {
uni.showToast({
title: `购买数量需要大于等于起订量${selectTempl.minBuyNum}`,
icon: 'none', // 可选 success/loading/none
duration: 2000 // 持续时长,单位ms
});
return;
}
const params = { const params = {
id: this.id, id: this.id,
specsId: selectTempl.id, // 规格ID specsId: selectTempl.id, // 规格ID
goodsNum: this.orderInfo.quantity,// 商品数量 goodsNum: this.orderInfo.quantity // 商品数量
} };
console.log('selectTempl', selectTempl) console.log('selectTempl', selectTempl);
if (this.ji == 1) { if (this.ji == 1) {
params['specsId'] = selectTempl; params['specsId'] = selectTempl;
uni.navigateTo({ uni.navigateTo({
url: `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(params)}`, url: `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(params)}`
}) });
return; return;
} }
const resp = await addGoods(params); const resp = await addGoods(params);
if (resp && resp.bizcode === 100) { if (resp && resp.bizcode === 100) {
if (isBy) { if (isBy) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/order_package/order_submit/order_submit?ids=${resp.data}`, url: `/pages/order_package/order_submit/order_submit?ids=${resp.data}`
}) });
} else { } else {
this.specificationShow = false; this.specificationShow = false;
uni.showToast({ uni.showToast({
@@ -556,12 +540,9 @@ export default {
} }
}, },
// 跳转到分享页面 // 跳转到分享页面
jumpShare() { jumpShare() {}
}
}
} }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -665,7 +646,7 @@ export default {
.content_concrete { .content_concrete {
padding: 20rpx; padding: 20rpx;
background: #FFFFFF; background: #ffffff;
border-radius: 30rpx; border-radius: 30rpx;
margin-top: 20rpx; margin-top: 20rpx;
@@ -682,7 +663,7 @@ export default {
} }
.concrete_item_but { .concrete_item_but {
border-bottom: 1rpx solid #EEEEEEFF; border-bottom: 1rpx solid #eeeeeeff;
} }
.concrete_item_title { .concrete_item_title {
@@ -692,7 +673,7 @@ export default {
.concrete_item_value { .concrete_item_value {
font-weight: 500; font-weight: 500;
color: #1A1A1A; color: #1a1a1a;
width: calc(100% - 140rpx); width: calc(100% - 140rpx);
.address_warp { .address_warp {
@@ -721,7 +702,7 @@ export default {
} }
.content_details { .content_details {
background: #FFFFFF; background: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
padding: 10rpx 10rpx 30rpx; padding: 10rpx 10rpx 30rpx;
margin-top: 30rpx; margin-top: 30rpx;
@@ -737,14 +718,13 @@ export default {
} }
} }
.product_but_warp { .product_but_warp {
padding: 20rpx; padding: 20rpx;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
height: 160rpx; height: 160rpx;
width: calc(100% - 40rpx); width: calc(100% - 40rpx);
background-color: #FFFFFF; background-color: #ffffff;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -762,7 +742,6 @@ export default {
color: #666666; color: #666666;
} }
} }
} }
.product_but_right { .product_but_right {
@@ -772,12 +751,12 @@ export default {
.but_comm { .but_comm {
text-align: center; text-align: center;
padding: 20rpx 40rpx; padding: 20rpx 40rpx;
color: #FFFFFF; color: #ffffff;
height: 46rpx; height: 46rpx;
} }
.join_warp { .join_warp {
background: #E4D6FD; background: #e4d6fd;
border-radius: 16rpx 0rpx 0rpx 16rpx; border-radius: 16rpx 0rpx 0rpx 16rpx;
color: $app-zt-color; color: $app-zt-color;
} }
@@ -793,7 +772,7 @@ export default {
.specification_adress_warp { .specification_adress_warp {
padding: 30rpx; padding: 30rpx;
background: #FFFFFF; background: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
} }
@@ -814,7 +793,7 @@ export default {
.address_title { .address_title {
font-weight: 500; font-weight: 500;
font-size: 26rpx; font-size: 26rpx;
color: #BBBBBB; color: #bbbbbb;
margin-bottom: 10rpx; margin-bottom: 10rpx;
margin-right: 20rpx; margin-right: 20rpx;
width: 592rpx; width: 592rpx;
@@ -832,7 +811,7 @@ export default {
.specification_product_warp { .specification_product_warp {
display: flex; display: flex;
background: #FFFFFF; background: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
padding: 30rpx; padding: 30rpx;
margin-top: 20rpx; margin-top: 20rpx;
@@ -885,7 +864,7 @@ export default {
} }
.specification_list_warp { .specification_list_warp {
background: #FFFFFF; background: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
padding: 30rpx; padding: 30rpx;
margin-top: 20rpx; margin-top: 20rpx;
@@ -897,7 +876,7 @@ export default {
.list_title_warp { .list_title_warp {
font-weight: 500; font-weight: 500;
font-size: 30rpx; font-size: 30rpx;
color: #1A1A1A; color: #1a1a1a;
line-height: 48rpx; line-height: 48rpx;
} }
@@ -922,7 +901,7 @@ export default {
} }
.item_Warp_no_warp { .item_Warp_no_warp {
background: #F5F5F5; background: #f5f5f5;
color: #999999; color: #999999;
text-decoration-line: line-through; text-decoration-line: line-through;
} }
@@ -930,12 +909,12 @@ export default {
.item_Warp_yes_warp { .item_Warp_yes_warp {
border: 1px solid $app-bt-bj; border: 1px solid $app-bt-bj;
color: $app-bt-bj; color: $app-bt-bj;
background: #FFFFFF; background: #ffffff;
} }
} }
.specification_but { .specification_but {
background: #FFFFFF; background: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
padding: 30rpx; padding: 30rpx;
margin-top: 30rpx; margin-top: 30rpx;
@@ -952,18 +931,18 @@ export default {
padding: 20rpx 0; padding: 20rpx 0;
text-align: center; text-align: center;
background-color: $app-bt-bj; background-color: $app-bt-bj;
color: #FFFFFF; color: #ffffff;
margin-top: 20rpx; margin-top: 20rpx;
font-weight: 500; font-weight: 500;
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
} }
} }
} }
.popup_but { .popup_but {
background-color: #FFFFFF; background-color: #ffffff;
.but_comm { .but_comm {
width: 40%; width: 40%;
@@ -971,7 +950,6 @@ export default {
} }
.open_Show { .open_Show {
/* 弹出层形式的广告 */ /* 弹出层形式的广告 */
.uni-banner { .uni-banner {
display: flex; display: flex;
@@ -1025,10 +1003,10 @@ export default {
margin-top: 50rpx; margin-top: 50rpx;
.but_b { .but_b {
background: #03AD27; background: #03ad27;
border-radius: 41rpx; border-radius: 41rpx;
font-size: 32rpx; font-size: 32rpx;
color: #FFFFFF; color: #ffffff;
width: 70%; width: 70%;
text-align: center; text-align: center;
padding: 20rpx 0; padding: 20rpx 0;
+2 -2
View File
@@ -2,8 +2,8 @@
// export const BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境 // export const BASE_URL="http://cl55un59859.vicp.fun:24346"; // 测试环境
// export const BASE_URL = "https://api.tbmall.xin"; //生产 // export const BASE_URL = "https://api.tbmall.xin"; //生产
// export const BASE_URL ='http://api.hm.a-d.work:6880/api' // 测试 // export const BASE_URL ='http://api.hm.a-d.work:6880' // 测试
export const BASE_URL ='http://api.outer.tbmall.xin:6880' // 测试 export const BASE_URL ='http://api.outer.tbmall.xin:6880' // 本地测试