mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 05:50:50 +00:00
增加商品起购数量
This commit is contained in:
parent
fcc7e1e92c
commit
1e7c471c39
@ -238,7 +238,8 @@ class StoreProduct extends AuthController
|
||||
['is_copy', 0],//是否是复制商品
|
||||
['is_limit', 0],//是否限购
|
||||
['limit_type', 0],//限购类型
|
||||
['limit_num', 0]//限购数量
|
||||
['limit_num', 0],//限购数量
|
||||
['min_qty', 1],//起购数量
|
||||
]);
|
||||
$this->service->save((int)$id, $data);
|
||||
return app('json')->success(100000);
|
||||
|
||||
@ -321,7 +321,10 @@ class StoreCartServices extends BaseServices
|
||||
//购物车修改数量检查限购
|
||||
/** @var StoreProductServices $productServices */
|
||||
$productServices = app()->make(StoreProductServices::class);
|
||||
$limitInfo = $productServices->get($carInfo->product_id, ['is_limit', 'limit_type', 'limit_num']);
|
||||
$limitInfo = $productServices->get($carInfo->product_id, ['is_limit', 'limit_type', 'limit_num', 'min_qty']);
|
||||
if ($number < $limitInfo['min_qty']) {
|
||||
throw new ApiException('不能小于起购数量');
|
||||
}
|
||||
if ($limitInfo['is_limit']) {
|
||||
if ($limitInfo['limit_type'] == 1 && $number > $limitInfo['limit_num']) {
|
||||
throw new ApiException(410239, ['limit' => $limitInfo['limit_num']]);
|
||||
|
||||
@ -261,9 +261,6 @@ class StoreProductServices extends BaseServices
|
||||
$label_id = explode(',', $productInfo['label_id']);
|
||||
$productInfo['label_id'] = $userLabelServices->getLabelList(['ids' => $label_id], ['id', 'label_name']);
|
||||
$productInfo['give_integral'] = floatval($productInfo['give_integral']);
|
||||
$productInfo['presale'] = boolval($productInfo['presale'] ?? 0);
|
||||
$productInfo['is_limit'] = boolval($productInfo['is_limit'] ?? 0);
|
||||
$productInfo['vip_product'] = boolval($productInfo['vip_product'] ?? 0);
|
||||
$productInfo['presale_time'] = $productInfo['presale_start_time'] == 0 ? [] : [date('Y-m-d H:i:s', $productInfo['presale_start_time']), date('Y-m-d H:i:s', $productInfo['presale_end_time'])];
|
||||
$productInfo['description'] = $storeDescriptionServices->getDescription(['product_id' => $id, 'type' => 0]);
|
||||
$productInfo['custom_form'] = json_decode($productInfo['custom_form'], true);
|
||||
|
||||
@ -28738,6 +28738,7 @@ CREATE TABLE IF NOT EXISTS `eb_store_product` (
|
||||
`is_limit` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开启限购',
|
||||
`limit_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '限购类型1单次限购2永久限购',
|
||||
`limit_num` int(11) NOT NULL DEFAULT '0' COMMENT '限购数量',
|
||||
`min_qty` int(11) NOT NULL DEFAULT '1' COMMENT '起购数量',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `cate_id` (`cate_id`) USING BTREE,
|
||||
KEY `is_hot` (`is_hot`) USING BTREE,
|
||||
@ -50450,8 +50451,9 @@ CREATE TABLE IF NOT EXISTS `eb_user_extract` (
|
||||
`bank_address` varchar(256) NOT NULL DEFAULT '' COMMENT '开户地址',
|
||||
`alipay_code` varchar(64) NOT NULL DEFAULT '' COMMENT '支付宝账号',
|
||||
`extract_price` decimal(8,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '提现金额',
|
||||
`extract_fee` decimal(10,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '提现手续费',
|
||||
`mark` varchar(512) NOT NULL DEFAULT '' COMMENT '备注',
|
||||
`balance` decimal(8,2) UNSIGNED NOT NULL DEFAULT '0.00',
|
||||
`balance` decimal(8,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '提现前佣金',
|
||||
`fail_msg` varchar(128) NOT NULL DEFAULT '' COMMENT '无效原因',
|
||||
`fail_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '无效时间',
|
||||
`add_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '添加时间',
|
||||
|
||||
@ -1067,6 +1067,17 @@
|
||||
<el-col :span="24">
|
||||
<div class="line"></div>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="起购数量:">
|
||||
<el-input-number
|
||||
controls-position="right"
|
||||
:min="0"
|
||||
:max="999999"
|
||||
v-model="formValidate.min_qty"
|
||||
placeholder="请输入起购数量"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否限购:">
|
||||
<el-switch :active-value="1" :inactive-value="0" v-model="formValidate.is_limit" size="large">
|
||||
@ -1810,6 +1821,7 @@ export default {
|
||||
selectRule: '',
|
||||
coupon_ids: [],
|
||||
command_word: '',
|
||||
min_qty: 1,
|
||||
},
|
||||
ruleList: [],
|
||||
templateList: [],
|
||||
|
||||
@ -43,12 +43,12 @@
|
||||
<view class="title">{{$t(`数量`)}}</view>
|
||||
<view class="carnum acea-row row-left">
|
||||
<view class="item reduce acea-row row-center-wrapper"
|
||||
:class="attr.productSelect.cart_num <= 1 ? 'on' : ''"
|
||||
v-if="attr.productSelect.cart_num <= 1">
|
||||
:class="attr.productSelect.cart_num <= minQty ? 'on' : ''"
|
||||
v-if="attr.productSelect.cart_num <= minQty">
|
||||
<text class="iconfont icon-shangpinshuliang-jian"></text>
|
||||
</view>
|
||||
<view class="item reduce acea-row row-center-wrapper"
|
||||
:class="attr.productSelect.cart_num <= 1 ? 'on' : ''" @click="CartNumDes" v-else>
|
||||
:class="attr.productSelect.cart_num <= minQty ? 'on' : ''" @click="CartNumDes" v-else>
|
||||
<text class="iconfont icon-shangpinshuliang-jian"></text>
|
||||
</view>
|
||||
<view class='item num acea-row row-middle'>
|
||||
@ -96,6 +96,10 @@
|
||||
limitNum: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
minQty: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
isShow: {
|
||||
type: Number,
|
||||
|
||||
@ -346,7 +346,7 @@
|
||||
@closeChange="closeChange" :showAnimate="showAnimate" @boxStatus="boxStatus">
|
||||
</shareRedPackets>
|
||||
<!-- 组件 -->
|
||||
<productWindow :attr="attr" :isShow="1" :iSplus="1" :limitNum="storeInfo.limit_num"
|
||||
<productWindow :attr="attr" :isShow="1" :iSplus="1" :limitNum="storeInfo.limit_num" :minQty="storeInfo.min_qty"
|
||||
:unitName="storeInfo.unit_name" @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
|
||||
@ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" id="product-window"
|
||||
:is_vip="is_vip" @getImg="showImg" :is_virtual="storeInfo.is_virtual">
|
||||
@ -807,12 +807,12 @@
|
||||
*/
|
||||
iptCartNum: function(e) {
|
||||
if (e) {
|
||||
let number = 1
|
||||
if (Number.isInteger(parseInt(e)) && parseInt(e) > 0) {
|
||||
let number = this.storeInfo.min_qty;
|
||||
if (Number.isInteger(parseInt(e)) && parseInt(e) >= this.storeInfo.min_qty) {
|
||||
number = parseInt(e);
|
||||
}
|
||||
this.$nextTick(e => {
|
||||
this.$set(this.attr.productSelect, "cart_num", e < 0 ? 1 : number);
|
||||
this.$set(this.attr.productSelect, "cart_num", e < 0 ? this.storeInfo.min_qty : number);
|
||||
})
|
||||
}
|
||||
},
|
||||
@ -939,13 +939,13 @@
|
||||
if (changeValue) {
|
||||
num.cart_num++;
|
||||
if (num.cart_num > stock) {
|
||||
this.$set(this.attr.productSelect, "cart_num", stock ? stock : 1);
|
||||
this.$set(this.attr.productSelect, "cart_num", stock ? stock : this.storeInfo.min_qty);
|
||||
this.$set(this, "cart_num", stock ? stock : 1);
|
||||
}
|
||||
} else {
|
||||
num.cart_num--;
|
||||
if (num.cart_num < 1) {
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this.attr.productSelect, "cart_num", this.storeInfo.min_qty);
|
||||
this.$set(this, "cart_num", 1);
|
||||
}
|
||||
}
|
||||
@ -982,7 +982,7 @@
|
||||
this.$set(this.attr.productSelect, "price", productSelect.price);
|
||||
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this.attr.productSelect, "cart_num", this.storeInfo.min_qty);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"vip_price",
|
||||
@ -1261,7 +1261,7 @@
|
||||
this.$set(this.attr.productSelect, "price", productSelect.price);
|
||||
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this.attr.productSelect, "cart_num", this.storeInfo.min_qty);
|
||||
this.$set(this, "attrValue", value.join(","));
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
@ -1301,7 +1301,7 @@
|
||||
"unique",
|
||||
this.storeInfo.unique || ""
|
||||
);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this.attr.productSelect, "cart_num", this.storeInfo.min_qty);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"vip_price",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user