|
|
@@ -588,6 +588,9 @@ class OrderController extends BaseController
|
|
|
$post['flowerNum'] = isset($post['flowerNum']) && $post['flowerNum'] > 0 ? $post['flowerNum'] : 0;
|
|
|
|
|
|
$version = $post['version'] ?? 0; //验证已移至 CreateOrderForm
|
|
|
+ if ($version < 3) {
|
|
|
+ util::fail('请升级版本,或用小程序');
|
|
|
+ }
|
|
|
|
|
|
//默认情况开单员工和收款员工是同个人
|
|
|
$staffId = $this->shopAdminId ?? 0;
|
|
|
@@ -603,7 +606,12 @@ class OrderController extends BaseController
|
|
|
|
|
|
$groupId = !empty($post['groupId']) ? $post['groupId'] : 0;
|
|
|
$post['fromType'] = $post['fromType'] ?? 1;
|
|
|
- $customId = $post['customId'];
|
|
|
+ if ($post['fromType'] == dict::getDict('fromType', 'friend')) {
|
|
|
+ if (empty($post['bookName'])) {
|
|
|
+ util::fail('请填写订花人姓名');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $customId = $post['customId'] ?? 0;
|
|
|
$custom = CustomClass::getById($customId, true);
|
|
|
if (empty($custom)) {
|
|
|
util::fail('没有找到客户哦');
|
|
|
@@ -619,12 +627,30 @@ class OrderController extends BaseController
|
|
|
$customName = $custom->name ?? '';
|
|
|
$post['customName'] = $customName;
|
|
|
$post['customNamePy'] = stringUtil::py($customName);
|
|
|
+ if (!empty($post['receiveMobile'])) {
|
|
|
+ if (!stringUtil::isMobile($post['receiveMobile'])) {
|
|
|
+ util::fail('请填写正确的收花人手机号');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($post['bookMobile'])) {
|
|
|
+ if (!stringUtil::isMobile($post['bookMobile'])) {
|
|
|
+ util::fail('请填写正确的订花人手机号');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$hasPay = $post['hasPay'] ?? dict::getDict('hasPay', 'unPay');
|
|
|
$post['sendType'] = $post['sendType'] ?? 1;
|
|
|
$forward = $post['forward'] ?? 0;
|
|
|
if ($forward == 1) {
|
|
|
- // 售后付款单验证已移至 CreateOrderForm
|
|
|
+ if ($hasPay != 1) {
|
|
|
+ util::fail('售后付款单只能走线下转账');
|
|
|
+ }
|
|
|
+ $historyDate = $post['historyDate'] ?? '';
|
|
|
+ if (!empty($historyDate)) {
|
|
|
+ if ($historyDate != date("Y-m-d")) {
|
|
|
+ util::fail('售后付款单不能修改账单日期,只能今天');
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
//如果不是售后付款单,并且选的不是余额支付,余额又够付当前订单,则自动切到余额支付
|
|
|
$balance = $custom->balance ?? 0;
|
|
|
@@ -643,7 +669,11 @@ class OrderController extends BaseController
|
|
|
if (empty($productList) && empty($groupId)) {
|
|
|
//商家手机上开单并生成制作单
|
|
|
if (!empty($post['unitGoodsPrice'])) {
|
|
|
- // 此功能停用,验证已移至 CreateOrderForm
|
|
|
+ util::fail('此功能停用,有需要请联系管理员');
|
|
|
+ $unitGoodsPrice = $post['unitGoodsPrice'];
|
|
|
+ if (!is_numeric($unitGoodsPrice)) {
|
|
|
+ util::fail('请输入正确的单价');
|
|
|
+ }
|
|
|
$productList = GoodsClass::orderCreateGoods($post);
|
|
|
}
|
|
|
}
|
|
|
@@ -652,7 +682,9 @@ class OrderController extends BaseController
|
|
|
$zjGathering = $post['zjGathering'] ?? 0;
|
|
|
if ($zjGathering == 1) {
|
|
|
$lsGoodsPrice = $post['lsGoodsPrice'] ?? 0;
|
|
|
- // 验证已移至 CreateOrderForm
|
|
|
+ if (!is_numeric($lsGoodsPrice) || $lsGoodsPrice <= 0) {
|
|
|
+ util::fail('请填写价格');
|
|
|
+ }
|
|
|
//直接收款不需要打印小票
|
|
|
$post['needPrint'] = dict::getDict('needPrint', 'noNeed');
|
|
|
$shopId = $this->shopId;
|