From 1e7c471c39ae4fc45fe0a3c4cdc313252d6fb253 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 17 Jul 2023 11:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E8=B5=B7?= =?UTF-8?q?=E8=B4=AD=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/v1/product/StoreProduct.php | 3 ++- crmeb/app/services/order/StoreCartServices.php | 5 ++++- .../product/product/StoreProductServices.php | 3 --- crmeb/public/install/crmeb.sql | 4 +++- .../src/pages/product/productAdd/index.vue | 12 ++++++++++++ .../uni-app/components/productWindow/index.vue | 10 +++++++--- template/uni-app/pages/goods_details/index.vue | 18 +++++++++--------- 7 files changed, 37 insertions(+), 18 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/product/StoreProduct.php b/crmeb/app/adminapi/controller/v1/product/StoreProduct.php index aaa020ed7..3bcffb82d 100644 --- a/crmeb/app/adminapi/controller/v1/product/StoreProduct.php +++ b/crmeb/app/adminapi/controller/v1/product/StoreProduct.php @@ -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); diff --git a/crmeb/app/services/order/StoreCartServices.php b/crmeb/app/services/order/StoreCartServices.php index 5b0ce37ad..8d61edee4 100644 --- a/crmeb/app/services/order/StoreCartServices.php +++ b/crmeb/app/services/order/StoreCartServices.php @@ -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']]); diff --git a/crmeb/app/services/product/product/StoreProductServices.php b/crmeb/app/services/product/product/StoreProductServices.php index 826afa83b..19e45bf5f 100644 --- a/crmeb/app/services/product/product/StoreProductServices.php +++ b/crmeb/app/services/product/product/StoreProductServices.php @@ -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); diff --git a/crmeb/public/install/crmeb.sql b/crmeb/public/install/crmeb.sql index 540569c75..0b3f14ad4 100755 --- a/crmeb/public/install/crmeb.sql +++ b/crmeb/public/install/crmeb.sql @@ -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 '添加时间', diff --git a/template/admin/src/pages/product/productAdd/index.vue b/template/admin/src/pages/product/productAdd/index.vue index 7884cbab1..7f50c5f88 100644 --- a/template/admin/src/pages/product/productAdd/index.vue +++ b/template/admin/src/pages/product/productAdd/index.vue @@ -1067,6 +1067,17 @@
+ + + + + @@ -1810,6 +1821,7 @@ export default { selectRule: '', coupon_ids: [], command_word: '', + min_qty: 1, }, ruleList: [], templateList: [], diff --git a/template/uni-app/components/productWindow/index.vue b/template/uni-app/components/productWindow/index.vue index 2638d9544..276509ee2 100644 --- a/template/uni-app/components/productWindow/index.vue +++ b/template/uni-app/components/productWindow/index.vue @@ -43,12 +43,12 @@ {{$t(`数量`)}} + :class="attr.productSelect.cart_num <= minQty ? 'on' : ''" + v-if="attr.productSelect.cart_num <= minQty"> + :class="attr.productSelect.cart_num <= minQty ? 'on' : ''" @click="CartNumDes" v-else> @@ -96,6 +96,10 @@ limitNum: { type: Number, value: 0 + }, + minQty: { + type: Number, + value: 0 }, isShow: { type: Number, diff --git a/template/uni-app/pages/goods_details/index.vue b/template/uni-app/pages/goods_details/index.vue index 7591d087e..2c94994c7 100644 --- a/template/uni-app/pages/goods_details/index.vue +++ b/template/uni-app/pages/goods_details/index.vue @@ -346,7 +346,7 @@ @closeChange="closeChange" :showAnimate="showAnimate" @boxStatus="boxStatus"> - @@ -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",