更新供货采购功能
This commit is contained in:
parent
dd5dbea43e
commit
e888430b3e
|
@ -7,7 +7,7 @@
|
||||||
<swiper class="swiper" :current="current" autoplay style="width: 100%;height: 100%;" @change="changeCurrent">
|
<swiper class="swiper" :current="current" autoplay style="width: 100%;height: 100%;" @change="changeCurrent">
|
||||||
<block v-if="product.slider_image && product.slider_image.length>0">
|
<block v-if="product.slider_image && product.slider_image.length>0">
|
||||||
<swiper-item v-for="(item,index) in product.slider_image" :key="index">
|
<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>
|
</swiper-item>
|
||||||
</block>
|
</block>
|
||||||
<swiper-item v-else>
|
<swiper-item v-else>
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
postCartAdd,
|
postCartAdd,
|
||||||
getProductDetail
|
getProductDetail
|
||||||
} from '@/api/store.js';
|
} from '@/api/store.js';
|
||||||
|
import { Toast } from '../libs/uniApi';
|
||||||
export default {
|
export default {
|
||||||
name: "shortPopup",
|
name: "shortPopup",
|
||||||
props: {
|
props: {
|
||||||
|
@ -120,14 +121,6 @@
|
||||||
methods: {
|
methods: {
|
||||||
// 注入参数,
|
// 注入参数,
|
||||||
setDatas(datas, goodsNum) {
|
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.goodsNum = goodsNum;
|
||||||
this.datas = datas;
|
this.datas = datas;
|
||||||
this.product = datas.product;
|
this.product = datas.product;
|
||||||
|
@ -136,6 +129,17 @@
|
||||||
this.cart_num = 1;
|
this.cart_num = 1;
|
||||||
this.sku = datas.sku||{};
|
this.sku = datas.sku||{};
|
||||||
this.sku_key_list = Object.keys(this.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) {
|
inputCartNum(e) {
|
||||||
|
@ -171,7 +175,7 @@
|
||||||
},
|
},
|
||||||
// 增加购买数量
|
// 增加购买数量
|
||||||
plusCartNum() {
|
plusCartNum() {
|
||||||
console.log('加');
|
console.log('加', this.changeSkuKey);
|
||||||
if(this.sku){
|
if(this.sku){
|
||||||
if (this.sku[this.changeSkuKey].stock <= this.cart_num) {
|
if (this.sku[this.changeSkuKey].stock <= this.cart_num) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
|
@ -213,6 +217,7 @@
|
||||||
// 加入购物车
|
// 加入购物车
|
||||||
addcart() {
|
addcart() {
|
||||||
// return console.log(this.sku[this.changeSkuKey]);
|
// 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.sku[this.changeSkuKey]) {
|
||||||
if (this.cart_num > this.sku[this.changeSkuKey].stock) return uni.showToast({
|
if (this.cart_num > this.sku[this.changeSkuKey].stock) return uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<block v-for="(item,index) in list" :key="index">
|
<block v-for="(item,index) in list" :key="index">
|
||||||
<view class="item_list flex" @click="navToGoodsDetails(item)">
|
<view class="item_list flex" @click="navToGoodsDetails(item)">
|
||||||
<view>
|
<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>
|
||||||
<view class="left_goods_msg">
|
<view class="left_goods_msg">
|
||||||
<view class="name">{{ item.store_name }}</view>
|
<view class="name">{{ item.store_name }}</view>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y">
|
<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-view-item" v-for="(item,index) in attrValue" :key="index">
|
||||||
<view class="scroll_item_top">
|
<view class="scroll_item_top">
|
||||||
<image :src="Image" mode=""></image>
|
<image :src="Image" mode="" :lazy-load="true"></image>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view>{{item.sku}}</view>
|
<view>{{item.sku}}</view>
|
||||||
<view>库存: <text>{{item.stock}}</text> </view>
|
<view>库存: <text>{{item.stock}}</text> </view>
|
||||||
|
@ -249,7 +249,6 @@
|
||||||
* 跳转到产品详情
|
* 跳转到产品详情
|
||||||
*/
|
*/
|
||||||
navToGoodsDetails(item){
|
navToGoodsDetails(item){
|
||||||
console.log(item);
|
|
||||||
this.$refs.shortPopupRef.setDatas(item);
|
this.$refs.shortPopupRef.setDatas(item);
|
||||||
this.$refs.shortPopupRef.open();
|
this.$refs.shortPopupRef.open();
|
||||||
// uni.navigateTo({
|
// uni.navigateTo({
|
||||||
|
|
Loading…
Reference in New Issue