|
|
@@ -656,7 +656,39 @@ class ProductController extends BaseController
|
|
|
util::success(['py' => $py]);
|
|
|
}
|
|
|
|
|
|
- //复制花材
|
|
|
+ //(客户端-批发商)复制花材
|
|
|
+ public function actionClone()
|
|
|
+ {
|
|
|
+ $post = Yii::$app->request->post();
|
|
|
+
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('管理员才能添加花材');
|
|
|
+ }
|
|
|
+
|
|
|
+ $shop = $this->shop;
|
|
|
+ $default = $shop->default ?? 0;
|
|
|
+ if ($default != 1) {
|
|
|
+ util::fail('请在总店添加');
|
|
|
+ }
|
|
|
+
|
|
|
+ $post['sjId'] = $this->sjId;
|
|
|
+ $post['adminId'] = $this->adminId;
|
|
|
+ $post['mainId'] = $this->mainId;
|
|
|
+
|
|
|
+ $price = $post['price'] ?? 0;
|
|
|
+ $addPrice = $post['addPrice'] ?? 0;
|
|
|
+ if ($addPrice > $price) {
|
|
|
+ util::fail('加价不能大于售价');
|
|
|
+ }
|
|
|
+ $cost = bcsub($price, $addPrice, 2);
|
|
|
+ $post['cost'] = $cost;
|
|
|
+ $post['copy'] = 1; //复制标识
|
|
|
+ ProductClass::addProduct($post);
|
|
|
+ util::complete('复制成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ //(管理后台)复制花材
|
|
|
public function actionCopy()
|
|
|
{
|
|
|
$shopAdmin = $this->shopAdmin;
|