Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d404316141 | |||
3bb57fb887 | |||
b8806a4cad | |||
eae6bf36da |
@ -6,50 +6,35 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<view>商品名称</view>
|
<view>商品名称</view>
|
||||||
<view>{{ datas.name || datas.goods_name || datas.store_name }}</view>
|
<view>{{ datas.sku_name}}</view>
|
||||||
</view>
|
|
||||||
<view class="row" v-if="datas.store_info">
|
|
||||||
<view>商品规格</view>
|
|
||||||
<view>{{ datas.store_info}}</view>
|
|
||||||
</view>
|
|
||||||
<view class="row">
|
|
||||||
<view>商品单位</view>
|
|
||||||
<view >{{ datas.unit_name }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="row">
|
|
||||||
<view>商品价格</view>
|
|
||||||
<view>¥ {{priceKey.off_activity==1? datas[priceKey.price]: datas[priceKey.op_price] }} /
|
|
||||||
{{ datas.unit_name }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="row" v-if="datas.batch > 0">
|
|
||||||
<view>起批量</view>
|
|
||||||
<view>{{ datas.batch }}{{ datas.unit_name }}起批 </view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="row">
|
<view style="border-bottom: 1rpx solid #f6f6f6;margin-bottom: 0.625rem;padding-bottom: 0.625rem;">
|
||||||
<view>小计</view>
|
|
||||||
<view style="color: #F55726;" v-if="+datas.cart_num < +datas.batch">
|
<view class="u-page__tag-item" v-for="(item, index) in attr_value" :key="index">
|
||||||
{{ `${datas.batch}${datas.unit_name}起批` }}
|
<up-tag :text="item.sku_name" :plain="checkedProduct!=index" type="success" :name="index"
|
||||||
</view>
|
@click="radioClick" size="large">
|
||||||
<view style="color: #F55726;" v-else>¥ {{ subtotal }}</view>
|
</up-tag>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="row">
|
||||||
|
<view>商品价格</view>
|
||||||
|
<view>¥ {{price}}/
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
<!-- <view class="row" v-if="datas.batch > 0">
|
||||||
|
<view>起批量</view>
|
||||||
|
<view>{{ datas.batch }}{{ datas.unit_name }}起批 </view>
|
||||||
|
</view> -->
|
||||||
<view v-if="datas.is_bulk" class="row" style="height: 100rpx;">
|
<view v-if="datas.is_bulk" class="row" style="height: 100rpx;">
|
||||||
<view>购买重量<text style="color: #F55726;">*</text></view>
|
<view>购买重量<text style="color: #F55726;">*</text></view>
|
||||||
<view style="justify-content: end;">
|
<view style="justify-content: end;">
|
||||||
<up-input
|
<up-input type="digit" placeholder="请输入重量" border="surround" v-model="datas.cart_num"
|
||||||
type="digit"
|
@change="valChange" style="width: 100rpx;">
|
||||||
placeholder="请输入重量"
|
<!-- <template #suffix>
|
||||||
border="surround"
|
<span>{{ datas.unit_name }}</span>
|
||||||
v-model="datas.cart_num"
|
</template> -->
|
||||||
@change="valChange"
|
</up-input>
|
||||||
style="width: 100rpx;"
|
|
||||||
>
|
|
||||||
<template #suffix>
|
|
||||||
<span>{{ datas.unit_name }}</span>
|
|
||||||
</template>
|
|
||||||
</up-input>
|
|
||||||
<!-- <up-number-box :min="0.1" :step="0.1" v-model="datas.cart_num" @change="valChange"></up-number-box> -->
|
<!-- <up-number-box :min="0.1" :step="0.1" v-model="datas.cart_num" @change="valChange"></up-number-box> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -59,6 +44,13 @@
|
|||||||
<up-number-box :min="0" v-model="datas.cart_num" @change="valChange"></up-number-box>
|
<up-number-box :min="0" v-model="datas.cart_num" @change="valChange"></up-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="row">
|
||||||
|
<view>小计</view>
|
||||||
|
<view style="color: #F55726;" v-if="+datas.cart_num < +datas.batch">
|
||||||
|
{{ `${datas.batch}${datas.unit_name}起批` }}
|
||||||
|
</view>
|
||||||
|
<view style="color: #F55726;" v-else>¥ {{ subtotal }}</view>
|
||||||
|
</view>
|
||||||
<view class="row" style="padding-top: 30px;padding-bottom: 30rpx;">
|
<view class="row" style="padding-top: 30px;padding-bottom: 30rpx;">
|
||||||
<view style="width: 30%;margin-right: 30rpx;">
|
<view style="width: 30%;margin-right: 30rpx;">
|
||||||
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
|
<up-button @click="close" color="#f7f7f7"><text style="color: #333;">取消</text></up-button>
|
||||||
@ -79,6 +71,8 @@
|
|||||||
} from "vue"
|
} from "vue"
|
||||||
|
|
||||||
const foucs1 = ref(null)
|
const foucs1 = ref(null)
|
||||||
|
const checkedProduct = ref(0)
|
||||||
|
const price = ref(0)
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: {
|
show: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -98,10 +92,12 @@
|
|||||||
const datas = ref({
|
const datas = ref({
|
||||||
cart_num: ''
|
cart_num: ''
|
||||||
});
|
});
|
||||||
|
const attr_value = ref({});
|
||||||
const setData = (e) => {
|
const setData = (e) => {
|
||||||
datas.value = e;
|
datas.value = e.attr_value[0]
|
||||||
if (Number(e.batch) > 0) {
|
attr_value.value = e.attr_value
|
||||||
datas.value.cart_num = e.batch;
|
if (Number(e.attr_value[0].batch) > 0) {
|
||||||
|
datas.value.cart_num = e.attr_value[0].batch;
|
||||||
} else {
|
} else {
|
||||||
datas.value.cart_num = 1;
|
datas.value.cart_num = 1;
|
||||||
}
|
}
|
||||||
@ -112,7 +108,15 @@
|
|||||||
const close = () => {
|
const close = () => {
|
||||||
emit('close');
|
emit('close');
|
||||||
}
|
}
|
||||||
|
const radioClick = (key) => {
|
||||||
|
checkedProduct.value = key
|
||||||
|
datas.value = attr_value.value[key]
|
||||||
|
if (Number(datas.value.batch) > 0) {
|
||||||
|
datas.value.cart_num = datas.value.batch;
|
||||||
|
} else {
|
||||||
|
datas.value.cart_num = 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
const change = () => {
|
const change = () => {
|
||||||
if (+datas.value.cart_num < +datas.value.batch) return uni.$u.toast(
|
if (+datas.value.cart_num < +datas.value.batch) return uni.$u.toast(
|
||||||
`购买数量不能小于${datas.value.batch}${datas.value.unit_name}`);
|
`购买数量不能小于${datas.value.batch}${datas.value.unit_name}`);
|
||||||
@ -195,4 +199,9 @@
|
|||||||
/* 缩小 */
|
/* 缩小 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.u-page__tag-item {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -33,7 +33,7 @@
|
|||||||
<view class="shop-content">
|
<view class="shop-content">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
<view class="name u-line-2">{{item.goods_name}}</view>
|
<view class="name u-line-2">{{item.goods_name}}</view>
|
||||||
<view class="tip u-line-1">{{item.unit_name}}</view>
|
<view class="tip u-line-1">{{item.sku_name}}</view>
|
||||||
<view v-if="priceKey.off_activity==1" class="tip u-line-1">原价:<text
|
<view v-if="priceKey.off_activity==1" class="tip u-line-1">原价:<text
|
||||||
style="text-decoration: line-through;">¥{{item[priceKey.op_price]}}</text>
|
style="text-decoration: line-through;">¥{{item[priceKey.op_price]}}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
<view class="price-btn">
|
<view class="price-btn">
|
||||||
<view class="price">¥{{item[priceKey.price]}}</view>
|
<view class="price">¥{{item[priceKey.price]}}</view>
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<view class="num">{{item.cart_num}}</view>
|
<view class="num">{{item.cart_num}}/{{item.unit_name}}</view>
|
||||||
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
|
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -447,7 +447,7 @@
|
|||||||
getGoodList();
|
getGoodList();
|
||||||
}
|
}
|
||||||
|
|
||||||
const addCart = (product_id, cart_num) => { //加入购物车
|
const addCart = (product_id, cart_num,attr_value_id) => { //加入购物车
|
||||||
console.log("触发了加入购物车")
|
console.log("触发了加入购物车")
|
||||||
|
|
||||||
cartCreateApi({
|
cartCreateApi({
|
||||||
@ -456,7 +456,8 @@
|
|||||||
is_new: 0, // 是否直接购买0否1是
|
is_new: 0, // 是否直接购买0否1是
|
||||||
// goods_id: id,
|
// goods_id: id,
|
||||||
store_id: STORE_INFO.id,
|
store_id: STORE_INFO.id,
|
||||||
product_id: product_id
|
product_id: product_id,
|
||||||
|
attr_value_id:attr_value_id
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
getCartList();
|
getCartList();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
@ -688,7 +689,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
addCart(data.product_id, data.cart_num);
|
addCart(data.product_id, data.cart_num,data.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
<view>¥{{item.price}}</view>
|
<view>¥{{item.price}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips">
|
<view class="tips">
|
||||||
<view>{{}}</view>
|
<view>{{item.sku_name}}</view>
|
||||||
<view>x{{item.nums}}{{item.unit_name}}</view>
|
<view>x{{item.nums}}{{item.unit_name}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -19,19 +19,19 @@
|
|||||||
<image class="image" :src="item.image"></image>
|
<image class="image" :src="item.image"></image>
|
||||||
<view style="width: 520rpx;">
|
<view style="width: 520rpx;">
|
||||||
<view class="" style="display: flex;justify-content: space-between;">
|
<view class="" style="display: flex;justify-content: space-between;">
|
||||||
<view>
|
<view style="color: black;font-size: 30rpx;">
|
||||||
{{item.store_name}}
|
{{item.store_name}}
|
||||||
</view>
|
</view>
|
||||||
<view style="font-size: 32rpx;">
|
<view style="font-size: 24rpx;">
|
||||||
¥{{item.price}}
|
¥{{item.price}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="display: flex;justify-content: space-between;">
|
<view class="" style="display: flex;justify-content: space-between;">
|
||||||
<view>
|
<view>
|
||||||
{{item.unit_name}}
|
{{item.sku_name}}
|
||||||
</view>
|
</view>
|
||||||
<view style="font-size: 32rpx;">
|
<view style="font-size: 24rpx;">
|
||||||
x{{item.cart_num}}
|
x{{item.cart_num}}/{{item.unit_name}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
<view>¥{{ item.price }}</view>
|
<view>¥{{ item.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips">
|
<view class="tips">
|
||||||
<view>{{ item.unit_name }}</view>
|
<view>{{ item.sku_name }}</view>
|
||||||
<view>x{{ item.cart_num }}</view>
|
<view>x{{ item.cart_num }}/{{ item.unit_name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="time">
|
<view class="time">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user