更新供货采购功能

This commit is contained in:
weipengfei 2023-12-04 15:47:55 +08:00
parent dd5dbea43e
commit e888430b3e
2 changed files with 17 additions and 13 deletions

View File

@ -7,7 +7,7 @@
<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>
<image class="img" :src="item" :lazy-load="true"></image>
</swiper-item>
</block>
<swiper-item v-else>
@ -73,6 +73,7 @@
postCartAdd,
getProductDetail
} from '@/api/store.js';
import { Toast } from '../libs/uniApi';
export default {
name: "shortPopup",
props: {
@ -120,14 +121,6 @@
methods: {
// ,
setDatas(datas, goodsNum) {
getProductDetail(datas.product_id,{
product_type: 98
}).then((res)=>{
this.attr = res.data.attr;
this.attr.forEach((item, index)=>{
this.changeAttr(index, 0);
})
})
this.goodsNum = goodsNum;
this.datas = datas;
this.product = datas.product;
@ -136,6 +129,17 @@
this.cart_num = 1;
this.sku = datas.sku||{};
this.sku_key_list = Object.keys(this.sku);
this.current = 0;
getProductDetail(datas.product_id,{
product_type: 98
}).then((res)=>{
this.attr = res.data.attr;
if(this.attr.length>0){
this.attr.forEach((item, index)=>{
this.changeAttr(index, 0);
})
}else this.changeSkuKey = this.sku_key_list[0] || '';
})
},
//
inputCartNum(e) {
@ -171,7 +175,7 @@
},
//
plusCartNum() {
console.log('加');
console.log('加', this.changeSkuKey);
if(this.sku){
if (this.sku[this.changeSkuKey].stock <= this.cart_num) {
return uni.showToast({
@ -213,6 +217,7 @@
//
addcart() {
// return console.log(this.sku[this.changeSkuKey]);
if(+this.sku[this.changeSkuKey].procure_price * +this.cart_num<=0) return Toast('无法购买价格小于等于0的商品');
if (this.sku[this.changeSkuKey]) {
if (this.cart_num > this.sku[this.changeSkuKey].stock) return uni.showToast({
icon: 'none',

View File

@ -20,7 +20,7 @@
<block v-for="(item,index) in list" :key="index">
<view class="item_list flex" @click="navToGoodsDetails(item)">
<view>
<image class="goods_image" :src="item.image" mode="aspectFit"></image>
<image class="goods_image" :lazy-load="true" :src="item.image" mode="aspectFit"></image>
</view>
<view class="left_goods_msg">
<view class="name">{{ item.store_name }}</view>
@ -51,7 +51,7 @@
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y">
<view class="scroll-view-item" v-for="(item,index) in attrValue" :key="index">
<view class="scroll_item_top">
<image :src="Image" mode=""></image>
<image :src="Image" mode="" :lazy-load="true"></image>
<view class="text">
<view>{{item.sku}}</view>
<view>库存: <text>{{item.stock}}</text> </view>
@ -249,7 +249,6 @@
* 跳转到产品详情
*/
navToGoodsDetails(item){
console.log(item);
this.$refs.shortPopupRef.setDatas(item);
this.$refs.shortPopupRef.open();
// uni.navigateTo({