更新功能

This commit is contained in:
weipengfei 2023-11-14 18:37:34 +08:00
parent 871030f037
commit 698c297d77
17 changed files with 621 additions and 110 deletions

View File

@ -21,8 +21,8 @@
<view v-else class="money">
<view class="acea-row row-middle">
<view class="acea-row row-middle">
<text></text><text class="num">{{ attr.productSelect.price }}</text>
<view v-if="attr.productSelect && attr.productSelect.svip_price" class="acea-row row-middle">
<text></text><text class="num">{{ attr.productSelect.procure_price }}</text>
<view v-if="attr.productSelect && attr.productSelect.svip_price>0" class="acea-row row-middle">
<text class='vip-money'>{{attr.productSelect.svip_price}}</text>
<view class="vipImg">
<image src="/static/images/svip.png"></image>
@ -112,6 +112,7 @@
return {};
},
mounted(){
// console.log('sss',this.attr);
},
methods: {
//

464
components/shortPopup.vue Normal file
View File

@ -0,0 +1,464 @@
<template>
<view>
<uni-popup ref="popupRef" type="bottom" @change="changeShow">
<view class="pop">
<scroll-view scroll-y class="scroll">
<view class="image">
<swiper class="swiper" :current="current" autoplay style="width: 100%;height: 100%;" @change="changeCurrent">
<block v-if="product.slider_image && product.slider_image.length>0">
<swiper-item v-for="(item,index) in product.slider_image" :key="index">
<image class="img" :src="item"></image>
</swiper-item>
</block>
<swiper-item v-else>
<image class="img" :src="datas.image||defualtImg"></image>
</swiper-item>
</swiper>
<view class="current">{{current+1}}/{{product.slider_image && product.slider_image.length||1}}</view>
<image class="close" src="@/static/images/icon/close.png" @click="close()"></image>
<view class="border"></view>
</view>
<view class="white_card">
<view class="flex flex_end">
<view class="price"><text class="pro">{{leftPrice}}.</text>{{rightPrice}}
</view>
<view>订货价</view>
</view>
<view class="short_name">{{datas.store_name}}</view>
<view class="flex">
<view class="shop_name">
<image class="icon" src="@/static/images/icon/short.png"></image>
<view>{{datas.merchant.mer_name}}</view>
</view>
</view>
<u-line></u-line>
<view class="m_title">规格选中</view>
<view class="flex">
<view class="attr" :class="{'attr_active': item==sku_key}" v-for="item in sku_key_list" :key="item" @click="sku_key = item">{{item||'默认'}}</view>
</view>
<view class="m_title num">
<view>购买数量</view>
<view class="input">
<view class="input_item sub" @click="subCartNum">-</view>
<input class="input_item input_view" v-model="cart_num" type="number" @input="inputCartNum" />
<view class="input_item plus" @click="plusCartNum">+</view>
</view>
</view>
<view>
商品库存 <text style="margin-left: 20rpx;">{{(sku[sku_key] && sku[sku_key].stock)||change.stock}}</text>
</view>
</view>
</scroll-view>
<view class="button">
<view class="b_icon" @click="navgo('/pages/nongKe/supply_chain/shopping_trolley_a')">
<image src="@/static/images/icon/car.png"></image>
<view>采购车</view>
<view class="badge" v-if="goodsNum">{{goodsNum}}</view>
</view>
<view class="btn" @click.stop="$u.throttle(addcart, 1500)">加入采购清单</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import {
postCartAdd,
} from '@/api/store.js';
export default {
name: "shortPopup",
data() {
return {
isShow: false, //
defualtImg: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/uploads/20230130/00ebcfdf75684f5494c0193075055d1.png',
datas: {
image: '',
store_name: '',
merchant: {
mer_name: ''
},
price: '',
},
product: {},
attrValue: [],
sku: {}, //
sku_key_list: [], //
sku_key: '', //
change: {
stock: ''
},
cart_num: 1, //
goodsNum: 0, //
current: 0, //
};
},
mounted() {},
computed:{
leftPrice(){
return this.sku[this.sku_key]?.procure_price?.split('.')[0]||'0';
},
rightPrice(){
return this.sku[this.sku_key]?.procure_price?.split('.')[1]||'00';
}
},
methods: {
// ,
setDatas(datas, goodsNum) {
this.goodsNum = goodsNum;
this.datas = datas;
this.product = datas.product;
this.attrValue = datas.product?.attrValue;
this.change = this.attrValue[0];
this.cart_num = 1;
this.sku = datas.sku||{};
this.sku_key_list = Object.keys(this.sku);
this.sku_key = this.sku_key_list[0];
},
//
inputCartNum(e) {
if(this.sku){
if (+e.detail.value > this.sku[this.sku_key].stock) {
uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
this.$nextTick(() => {
this.cart_num = this.sku[this.sku_key].stock;
})
}
}else if (this.change.stock <= this.cart_num) {
uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
this.$nextTick(() => {
this.cart_num = this.change.stock;
})
}
},
//
subCartNum() {
if (this.cart_num <= 1) {
return uni.showToast({
icon: 'none',
title: '最少要买一件哦'
})
}
this.cart_num--;
},
//
plusCartNum() {
console.log('加');
if(this.sku){
if (this.sku[this.sku_key].stock <= this.cart_num) {
return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
}
}else if (this.change.stock <= this.cart_num) {
return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
}
this.cart_num++;
},
//
addcart() {
if (this.sku[this.sku_key]) {
if (this.cart_num > this.sku[this.sku_key].stock) return uni.showToast({
icon: 'none',
title: '不能超出库存哦'
})
let data = {
cart_num: this.cart_num,
is_new: 0,
product_attr_unique: this.sku[this.sku_key].unique,
product_id: this.datas.product_id,
product_type: this.datas.product_type,
source: 200, //
spread_id: "",
}
let that = this
let res = postCartAdd({
...data
}).then((res, err) => {
uni.showToast({
title: "加入成功",
duration: 1000,
})
this.$emit('addCart');
this.close();
}).catch(err => {
uni.showToast({
title: err,
icon: "none",
duration: 1000,
})
})
} else {
uni.showToast({
icon: 'none',
title: '商品规格不存在'
})
}
},
//
changeCurrent(e){
this.current = e.detail.current;
},
navgo(url) {
uni.navigateTo({
url
})
},
open() {
this.$refs.popupRef.open();
},
close() {
this.$refs.popupRef.close();
},
changeShow(e) {
this.isShow = e.show;
}
}
}
</script>
<style lang="scss">
.pop {
background-color: #fff;
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
overflow: hidden;
position: relative;
.scroll{
height: calc(90vh - 150rpx);
}
.flex_end {
align-items: flex-end;
}
.image {
height: 750rpx;
width: 750rpx;
position: relative;
.current{
position: absolute;
bottom: 70rpx;
left: 30rpx;
width: 67rpx;
height: 37rpx;
background: rgba(#333, 0.2);
border-radius: 11rpx 11rpx 11rpx 11rpx;
text-align: center;
color: #fff;
font-size: 26rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
}
.img {
width: 100%;
height: 100%;
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
overflow: hidden;
}
.close {
position: absolute;
top: 30rpx;
right: 30rpx;
width: 50.82rpx;
height: 50.82rpx;
}
.border {
position: absolute;
bottom: -1rpx;
left: 0;
background-color: #fff;
height: 40rpx;
width: 100%;
border-radius: 40rpx 40rpx 0 0;
}
}
.white_card {
border-radius: 31.54rpx 31.54rpx 0rpx 0rpx;
background-color: #fff;
margin: 0 28rpx;
padding-bottom: 30rpx;
color: #737373;
font-size: 26.29rpx;
.price {
font-size: 35rpx;
font-family: SF Pro Display-Semibold, SF Pro Display;
font-weight: 600;
color: #F84221;
padding-right: 30rpx;
.pro {
font-size: 49.07rpx;
}
}
.short_name {
font-size: 33rpx;
font-family: PingFang SC-Semibold, PingFang SC;
font-weight: 600;
color: #333333;
}
.shop_name {
display: flex;
background: #FEF5F3;
padding: 0 16rpx;
border-radius: 26rpx 26rpx 26rpx 26rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
align-items: center;
.icon {
width: 31.54rpx;
height: 31.54rpx;
margin-right: 10rpx;
}
}
.m_title {
font-size: 30rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
margin-top: 31rpx;
margin-bottom: 21rpx;
}
.attr {
opacity: 1;
border: 1rpx solid #F84221;
color: #333333;
padding: 15rpx 30rpx;
margin-right: 20rpx;
height: 63rpx;
line-height: 60rpx;
border-radius: 63rpx;
display: flex;
align-items: center;
justify-content: center;
}
.attr_active{
// background-color: #FEF5F3;
// color: #F84221;
background-color: #F84221;
color: #fff;
}
.num {
display: flex;
justify-content: space-between;
align-items: center;
.input {
display: flex;
align-items: center;
height: 48rpx;
.input_item {
width: 44rpx;
height: 44rpx;
text-align: center;
line-height: 40rpx;
border: 2rpx solid #fff;
font-size: 26rpx;
color: #333;
}
.input_view {
width: 60rpx;
}
.sub {
border: 2rpx solid #FCB9AD;
border-radius: 7rpx 0rpx 0rpx 7rpx;
background: #FFFFFF;
font-size: 26rpx;
color: #B3B3B3;
}
.plus {
border: 2rpx solid #FCB9AD;
border-radius: 0rpx 7rpx 7rpx 0rpx;
background: #FFFFFF;
font-size: 26rpx;
color: #B3B3B3;
}
}
}
}
.button {
padding: 28rpx;
margin-bottom: 28rpx;
background-color: #fff;
display: flex;
justify-content: space-around;
padding-bottom: constant(safe-area-inset-bottom); /// IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); /// IOS>11.2/
padding-bottom: constant(safe-area-inset-bottom); /// IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); /// IOS>11.2/
.b_icon {
display: flex;
flex-direction: column;
align-items: center;
font-size: 19rpx;
font-weight: 400;
color: #333333;
position: relative;
image {
width: 50.82rpx;
height: 50.82rpx;
}
.badge {
position: absolute;
top: -5rpx;
right: -10rpx;
color: #fff;
min-width: 28rpx;
height: 28rpx;
text-align: center;
line-height: 24rpx;
background: #F84221;
border-radius: 16rpx 16rpx 16rpx 16rpx;
border: 2rpx solid #FFFFFF;
}
}
.btn {
width: 575rpx;
height: 84rpx;
background: linear-gradient(270deg, #FF6D20 0%, #F84221 100%);
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
}
}
</style>

View File

@ -23,9 +23,17 @@ Vue.component('skeleton', skeleton)
Vue.component('BaseMoney', BaseMoney)
Vue.prototype.$util = util;
Vue.prototype.$Cache = Cache;
Vue.prototype.$procure_price = (item)=>{
if(item.sku){
let key = Object.keys(item.sku)||[''];
return item.sku[key[0]]?.procure_price;
}
else return '无批发价';
}
Vue.prototype.$eventHub = new Vue();
Vue.config.productionTip = false
Vue.prototype.$bus = new Vue();
// #ifdef H5
import {
parseQuery

View File

@ -63,7 +63,7 @@
分享
</view>
</view>
<view v-if="svipData && !svipData.is_svip && svipData.show_svip"
<!-- <view v-if="svipData && !svipData.is_svip && svipData.show_svip"
class="svipCon acea-row row-between-wrapper skeleton-rect" style="margin-top: 20rpx;">
<view class="acea-row row-between-wrapper">
<image src="/static/images/svip_user.png"></image>
@ -73,7 +73,7 @@
立即开通
<text class="iconfont icon-jiantou"></text>
</navigator>
</view>
</view> -->
<view v-if="!storeInfo.atmosphere_pic" class='integral_count skeleton-rect'>
<text v-if="storeInfo.max_integral > 0"
class='integral'>积分最高可抵扣{{storeInfo.max_integral}}</text>

View File

@ -103,9 +103,11 @@
<view class="content-list">
<view class="tools-one">
订单列表
<view class=""></view>
<view style="width: 100%;background-color: #fff;">
<view class="tools-one">
订单列表
<view class=""></view>
</view>
</view>
<view class="content-list-one" v-for="(item,u) in productList" :key="u">
@ -162,15 +164,14 @@
<image src="@/static/images/dz.png" mode="aspectFit"></image>
</view>
<view class="order_id">
订单编号{{item.order_sn}}
订单编号: {{item.order_sn}}
</view>
</view>
<view class="list-three-one">
<view class="title-img">
<image src="@/static/images/zb.png" mode="aspectFit"></image>
</view>
<view class="adress">{{item.real_name}} {{ item.user_phone}} {{item.user_address}}
</view>
<view class="adress">{{item.real_name}} {{ item.user_phone}} <br/> {{item.user_address}} </view>
</view>
</view>
</view>
@ -1898,6 +1899,7 @@
.content-list {
margin-top: 70rpx;
background-color: #f4f7fe;
.tools-one {
width: 133rpx;
@ -1920,11 +1922,14 @@
.content-list-one {
padding: 25rpx 25rpx;
padding-bottom: 80rpx;
padding-bottom: 100rpx;
margin-bottom: 10rpx;
background-color: #fff;
.list-one {
display: flex;
justify-content: space-between;
align-items: center;
.list-one_left {
display: flex;
@ -1962,6 +1967,7 @@
font-size: 26rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
align-items: center;
.list-one_right-a {
@ -2095,9 +2101,9 @@
.list-four {
display: flex;
position: absolute;
right: 25rpx;
padding-top: 20rpx;
}
.list-four .btn {

View File

@ -32,8 +32,8 @@
</view>
<view class="right_goods_msg">
<view class="num">
<text>订货价:</text>
<text>{{' '+item.price}}</text>
<text style="margin-right: 10rpx;">订货价:</text>
<text>{{$procure_price(item)}}</text>
</view>
<!-- <view class="add_goods" @click="getGoodsDetails(item)">加入购物单</view> -->
</view>
@ -44,6 +44,7 @@
<navigator class="bottom_purchase" url="./shopping_trolley_a" open-type="navigate">采购清单</navigator>
<goodsPopup :goodsStatu="isPopupShow" @colses="isPopupShow=false" :goods_info="goodsInfo"></goodsPopup>
<shortPopup ref="shortPopupRef" ></shortPopup>
<u-popup :show="show" @close="close">
<view>
<h3 style=" margin: 15px 5px 5px 24px;">颜色规格</h3>
@ -87,9 +88,11 @@
import {
changeCartNum
} from '@/api/order.js';
import shortPopup from "@/components/shortPopup.vue"
export default {
components: {
goodsPopup
goodsPopup,
shortPopup
},
data() {
return {
@ -247,9 +250,11 @@
*/
navToGoodsDetails(item){
console.log(item);
uni.navigateTo({
url: `pages/goods_details/index?id=${item.product_id}&referer=`
})
this.$refs.shortPopupRef.setDatas(item);
this.$refs.shortPopupRef.open();
// uni.navigateTo({
// url: `/pages/goods_details/index?id=${item.product_id}&referer=`
// })
},
/*
* 加入购物车
@ -366,7 +371,8 @@
// title: res
// });
// });
}
},
},
onReachBottom() {
//nomore
@ -374,12 +380,16 @@
this.infoData.page++
this.getStoreGoodsList()
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
onBackPress() {
if(this.$refs.shortPopupRef.isShow){
this.$refs.shortPopupRef.close();
return true;
}
}
}
</script>
@ -528,7 +538,7 @@
}
.bottom_purchase {
z-index: 999;
z-index: 50;
position: fixed;
left: 50%;
bottom: 52.63rpx;

View File

@ -52,7 +52,7 @@
v-if="goods.product.once_max_count>0">最多{{goods.product.once_max_count}}</text>
</view>
<view class='money acea-row row-middle'>
<text>{{goods.productAttr.price}}</text>
<text>{{goods.productAttr.procure_price}}</text>
<view v-if="goods.productAttr.show_svip_price" class="vipImg">
<image src="/static/images/svip.png"></image>
</view>
@ -229,7 +229,9 @@
attr: {
cartAttr: false,
productAttr: [],
productSelect: {}
productSelect: {
procure_price: ''
}
},
isOpen: false, //
source: '',
@ -237,6 +239,7 @@
isCart: true,
cart_id: '',
attrValue: '', //
attrTxt: '',
uniqueValue: "",
newVal: {},
goods: {},
@ -251,15 +254,7 @@
])),
onReady() {},
mounted: function() {},
onLoad: function(options) {
let userInfo = this.$store.state.app.userInfo;
if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
if (userInfo?.mer_info?.length == 0) {
uni.showModal({
title: '暂无商户信息'
})
}
},
onLoad: function(options) {},
onShow: function() {
let that = this
let routes = getCurrentPages();
@ -393,32 +388,6 @@
this.$set(this.attr, 'cartAttr', false);
this.$set(this, 'isOpen', false);
},
/*
* 更改商品属性
*/
changeCart: function(goods, id) {
let that = this;
if (that.goods == goods) {
that.isOpen = that.attr.cartAttr = true;
return
} else {
that.goods = JSON.parse((JSON.stringify(goods)));
that.currSku = goods.productAttr.sku.split(",");
that.$set(that.attr, 'productAttr', goods.attr);
// console.log(this.attr)
const sku = {}
that.attrValue = goods.productAttr.sku
that.attrImage = goods.product.image
goods.attrValue.forEach((itemn) => {
sku[itemn.sku] = itemn;
})
that.$set(that, 'productValue', sku);
let productSelect = sku[that.attrValue];
that.isOpen = that.attr.cartAttr = true;
//
that.DefaultSelect(goods)
}
},
/**
* 默认选中属性
*
@ -441,7 +410,6 @@
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], "index", value[i]);
}
let productSelect = this.productValue[value.join(",")];
if (productSelect && productAttr.length) {
this.$set(
@ -452,6 +420,7 @@
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : goods.product
.image);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
@ -471,6 +440,7 @@
);
this.$set(this.attr.productSelect, "image", goods.product.image);
this.$set(this.attr.productSelect, "price", goods.product.price);
this.$set(this.attr.productSelect, "procure_price", goods.product.price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
@ -486,6 +456,7 @@
);
this.$set(this.attr.productSelect, "image", goods.product.image);
this.$set(this.attr.productSelect, "price", goods.product.price);
this.$set(this.attr.productSelect, "procure_price", goods.product.price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", goods.product.stock);
this.$set(this.attr.productSelect, "unique", goods.product.unique || "");
@ -497,6 +468,7 @@
this.$set(this.attr.productSelect, "store_name", goods.product.store_name);
this.$set(this.attr.productSelect, "image", productSelect.image);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
@ -511,6 +483,33 @@
}
this.goCart(productSelect);
},
/*
* 更改商品属性
*/
changeCart: function(goods, id) {
let that = this;
if (that.goods == goods) {
that.isOpen = that.attr.cartAttr = true;
return
} else {
that.goods = JSON.parse((JSON.stringify(goods)));
that.currSku = goods.productAttr.sku.split(",");
that.$set(that.attr, 'productAttr', goods.attr);
// console.log(this.attr)
const sku = {}
that.attrValue = goods.productAttr.sku
that.attrImage = goods.product.image
goods.attrValue.forEach((itemn) => {
sku[itemn.sku] = itemn;
})
that.$set(that, 'productValue', sku);
let productSelect = sku[that.attrValue];
that.isOpen = that.attr.cartAttr = true;
//
that.DefaultSelect(goods)
}
},
goCart(productSelect) {
let that = this;
//,,
@ -544,6 +543,7 @@
if (productSelect && productSelect.stock > 0) {
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : this.attrImage);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this, "uniqueValue", productSelect.unique);
@ -552,6 +552,7 @@
} else {
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : this.attrImage);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
@ -768,7 +769,7 @@
// //
el.list.forEach(e => {
if (e.check) {
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.price, e.cart_num))
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.procure_price, e.cart_num))
totalNum += e.cart_num
}
})
@ -1232,6 +1233,8 @@
background-color: #fafafa;
position: fixed;
padding: 0 30rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
border-top: 1px solid #eee;
bottom: var(--window-bottom, 0);

View File

@ -52,7 +52,7 @@
v-if="goods.product.once_max_count>0">最多{{goods.product.once_max_count}}</text>
</view>
<view class='money acea-row row-middle'>
<text>{{goods.productAttr.price}}</text>
<text>{{goods.productAttr.procure_price}}</text>
<view v-if="goods.productAttr.show_svip_price" class="vipImg">
<image src="/static/images/svip.png"></image>
</view>
@ -229,7 +229,9 @@
attr: {
cartAttr: false,
productAttr: [],
productSelect: {}
productSelect: {
procure_price: ''
}
},
isOpen: false, //
source: '',
@ -237,6 +239,7 @@
isCart: true,
cart_id: '',
attrValue: '', //
attrTxt: '',
uniqueValue: "",
newVal: {},
goods: {},
@ -385,32 +388,6 @@
this.$set(this.attr, 'cartAttr', false);
this.$set(this, 'isOpen', false);
},
/*
* 更改商品属性
*/
changeCart: function(goods, id) {
let that = this;
if (that.goods == goods) {
that.isOpen = that.attr.cartAttr = true;
return
} else {
that.goods = JSON.parse((JSON.stringify(goods)));
that.currSku = goods.productAttr.sku.split(",");
that.$set(that.attr, 'productAttr', goods.attr);
// console.log(this.attr)
const sku = {}
that.attrValue = goods.productAttr.sku
that.attrImage = goods.product.image
goods.attrValue.forEach((itemn) => {
sku[itemn.sku] = itemn;
})
that.$set(that, 'productValue', sku);
let productSelect = sku[that.attrValue];
that.isOpen = that.attr.cartAttr = true;
//
that.DefaultSelect(goods)
}
},
/**
* 默认选中属性
*
@ -433,7 +410,6 @@
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], "index", value[i]);
}
let productSelect = this.productValue[value.join(",")];
if (productSelect && productAttr.length) {
this.$set(
@ -444,6 +420,7 @@
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : goods.product
.image);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
@ -463,6 +440,7 @@
);
this.$set(this.attr.productSelect, "image", goods.product.image);
this.$set(this.attr.productSelect, "price", goods.product.price);
this.$set(this.attr.productSelect, "procure_price", goods.product.price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
@ -478,6 +456,7 @@
);
this.$set(this.attr.productSelect, "image", goods.product.image);
this.$set(this.attr.productSelect, "price", goods.product.price);
this.$set(this.attr.productSelect, "procure_price", goods.product.price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", goods.product.stock);
this.$set(this.attr.productSelect, "unique", goods.product.unique || "");
@ -489,6 +468,7 @@
this.$set(this.attr.productSelect, "store_name", goods.product.store_name);
this.$set(this.attr.productSelect, "image", productSelect.image);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "svip_price", productSelect.svip_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
@ -503,6 +483,33 @@
}
this.goCart(productSelect);
},
/*
* 更改商品属性
*/
changeCart: function(goods, id) {
let that = this;
if (that.goods == goods) {
that.isOpen = that.attr.cartAttr = true;
return
} else {
that.goods = JSON.parse((JSON.stringify(goods)));
that.currSku = goods.productAttr.sku.split(",");
that.$set(that.attr, 'productAttr', goods.attr);
// console.log(this.attr)
const sku = {}
that.attrValue = goods.productAttr.sku
that.attrImage = goods.product.image
goods.attrValue.forEach((itemn) => {
sku[itemn.sku] = itemn;
})
that.$set(that, 'productValue', sku);
let productSelect = sku[that.attrValue];
that.isOpen = that.attr.cartAttr = true;
//
that.DefaultSelect(goods)
}
},
goCart(productSelect) {
let that = this;
//,,
@ -536,6 +543,7 @@
if (productSelect && productSelect.stock > 0) {
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : this.attrImage);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this, "uniqueValue", productSelect.unique);
@ -544,6 +552,7 @@
} else {
this.$set(this.attr.productSelect, "image", productSelect.image ? productSelect.image : this.attrImage);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "procure_price", productSelect.procure_price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
@ -760,7 +769,7 @@
// //
el.list.forEach(e => {
if (e.check) {
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.price, e.cart_num))
totalMoney = this.$util.$h.Add(totalMoney, this.$util.$h.Mul(e.productAttr.procure_price, e.cart_num))
totalNum += e.cart_num
}
})

View File

@ -76,8 +76,6 @@
<u--image :showLoading="true" src="/static/images/GXSC/DH.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text> {{item.service_phone}}</text>
</view>
<view class="li" style="align-items: center;">
<u--image :showLoading="true" src="/static/images/GXSC/SJ.png" width="33.85rpx"
height="33.85rpx"></u--image>
<text>{{item.mer_take_time[0]}}-{{item.mer_take_time[1]}}</text>

View File

@ -40,10 +40,10 @@
moreThanFlag: true,
formList: [{
id: 1,
label: '售价',
label: '售价',
type: 'digit',
model: 'price',
holder: '请填写售价',
holder: '请填写售价',
require: true,
}, {
id: 10,
@ -61,14 +61,6 @@
model: 'cost',
require: true,
},
{
id: 3,
label: '批发价',
type: 'digit',
holder: '请填写批发价',
model: 'ot_price',
require: true,
}
],
moreThanList: [{
id: 6,
@ -157,6 +149,20 @@
})
}
this.singleSpecification.bar_code = this.$props.bar_code + '';
let userInfo = this.$store.state.app.userInfo;
if(typeof userInfo == 'string') userInfo = JSON.parse(userInfo);
//
if(userInfo.mer_info?.type_code=="TypeSupplyChain"){
this.formList.unshift({
id: 3,
label: '批发价',
type: 'digit',
holder: '请填写批发价',
model: 'procure_price',
require: true,
})
}
// if (!this.$props.product_id) {
// this.formList.push({
// id: 10,
@ -179,7 +185,9 @@
spliceMoreThan() {
this.moreThanFlag = true;
// this.formList.splice(!this.$props.product_id ? 2 : 1, this.formList.length);
this.formList.splice(4, this.formList.length);
if(this.$store.state.app?.userInfo?.mer_info?.type_code=="TypeSupplyChain")
this.formList.splice(4, this.formList.length);
else this.formList.splice(3, this.formList.length);
},
input(val) {
this.singleSpecification = val

View File

@ -263,16 +263,18 @@
Object.keys(info).forEach(key=>{
postData[key]=info[key];
})
postData.stock = postData.attrValue[0]?.stock;
postData.stock = postData?.attrValue[0]?.stock||0;
// console.log(postData);
if(!postData.store_name||postData.store_name?.trim().length<=0)return Toast('请输入商品名称');
if(!postData.imageList||postData.imageList?.length<2)return Toast('请上传2张以上商品图片');
if(!postData.cate_name||postData.cate_name?.trim().length<=0)return Toast('请选择平台分类');
if(!postData.unit_name||postData.unit_name?.trim().length<=0)return Toast('请输入商品单位');
if(!postData.attrValue[0]?.price||postData.attrValue[0]?.price<0)return Toast('价格不能小于0');
let userInfo = this.$store.state.app.userInfo;
if(typeof userInfo == 'string')userInfo= JSON.parse(userInfo);
if(userInfo?.mer_info?.type_code=="TypeSupplyChain" && (!postData.attrValue[0]?.procure_price||postData.attrValue[0]?.procure_price<=0) )return Toast('批发价不能小于0');
if(!postData.attrValue[0]?.price||postData.attrValue[0]?.price<=0)return Toast('零售价不能小于0');
if(!postData.stock||postData.stock<0)return Toast('库存不能小于0');
if(!postData.attrValue[0]?.cost||postData.attrValue[0]?.cost<0)return Toast('成本价不能小于0');
if(!postData.attrValue[0]?.ot_price||postData.attrValue[0]?.ot_price<0)return Toast('批发价不能小于0');
if(!postData.attrValue[0]?.cost||postData.attrValue[0]?.cost<=0)return Toast('成本价不能小于0');
// if(!postData.content.title||postData.content.title?.trim().length<=0)return Toast('');
// if(!postData.content.image||postData.content.image?.length<=0)return Toast('');
// return Toast('');

View File

@ -1027,7 +1027,8 @@
address_id: address_id,
takes: that.take,
use_coupon: that.subCoupon,
use_integral: that.use_integral
use_integral: that.use_integral,
// source: 0
}).then(res => {
//
that.product_type=res.data.order_type
@ -1043,7 +1044,7 @@
})
})
that.subCoupon['0'] = []
if (res.data.platformCoupon.length > 0) {
if (res.data?.platformCoupon?.length > 0) {
res.data.platformCoupon.forEach(el => {
if (el.checked) {
that.subCoupon[el.mer_id] = []
@ -1103,6 +1104,7 @@
})
uni.hideLoading();
}).catch(err => {
console.log('err', err);
return this.$util.Tips({
title: err
}, {

BIN
static/images/icon/all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

BIN
static/images/icon/car.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
static/images/icon/plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB