瀏覽代碼

修改订单

邹景立 4 年之前
父節點
當前提交
27c3b80481

+ 4 - 4
app/data/controller/ShopGoods.php

@@ -80,7 +80,7 @@ class ShopGoods extends Controller
     {
         $this->marks = GoodsService::instance()->getMarkData();
         $this->cates = GoodsService::instance()->getCateData();
-        GoodsService::instance()->buildData($data, false);
+        GoodsService::instance()->bindData($data, false);
     }
 
     /**
@@ -201,7 +201,7 @@ class ShopGoods extends Controller
     protected function _form_result(bool $result)
     {
         if ($result && $this->request->isPost()) {
-            GoodsService::instance()->syncStock(input('code'));
+            GoodsService::instance()->stock(input('code'));
             $this->success('商品编辑成功!', 'javascript:history.back()');
         }
     }
@@ -219,7 +219,7 @@ class ShopGoods extends Controller
         if ($this->request->isGet()) {
             $list = $this->app->db->name('ShopGoods')->where($map)->select()->toArray();
             if (empty($list)) $this->error('无效的商品数据,请稍候再试!');
-            [$this->vo] = GoodsService::instance()->buildData($list);
+            [$this->vo] = GoodsService::instance()->bindData($list);
             $this->fetch();
         } else {
             [$data, $post, $batch] = [[], $this->request->post(), CodeExtend::uniqidDate(12, 'B')];
@@ -234,7 +234,7 @@ class ShopGoods extends Controller
                 }
                 if (!empty($data)) {
                     $this->app->db->name('ShopGoodsStock')->insertAll($data);
-                    GoodsService::instance()->syncStock($map['code']);
+                    GoodsService::instance()->stock($map['code']);
                     $this->success('商品数据入库成功!');
                 }
             }

+ 1 - 1
app/data/controller/api/Goods.php

@@ -47,7 +47,7 @@ class Goods extends Controller
         }
         $query = $this->_query('ShopGoods')->like('name,cateids,marks,payment')->equal('code');
         $result = $query->where(['deleted' => 0, 'status' => 1])->order('sort desc,id desc')->page(true, false, false, 10);
-        if (count($result['list']) > 0) GoodsService::instance()->buildData($result['list']);
+        if (count($result['list']) > 0) GoodsService::instance()->bindData($result['list']);
         $this->success('获取商品数据', $result);
     }
 

+ 1 - 1
app/data/controller/api/auth/Order.php

@@ -177,7 +177,7 @@ class Order extends Auth
             });
             // 同步商品库存销量
             foreach (array_unique(array_column($items, 'goods_code')) as $code) {
-                GoodsService::instance()->syncStock($code);
+                GoodsService::instance()->stock($code);
             }
             // 触发订单创建事件
             $this->app->event->trigger('ShopOrderCreate', $order['order_no']);

+ 11 - 11
app/data/service/GoodsService.php

@@ -14,6 +14,15 @@ class GoodsService extends Service
 {
 
     /**
+     * 最大分类级别
+     * @return integer
+     */
+    public function getCateMax(): int
+    {
+        return 3;
+    }
+
+    /**
      * 获取分类数据
      * @return array
      * @throws \think\db\exception\DataNotFoundException
@@ -66,15 +75,6 @@ class GoodsService extends Service
     }
 
     /**
-     * 最大分类级别
-     * @return integer
-     */
-    public function getCateMax(): int
-    {
-        return 3;
-    }
-
-    /**
      * 更新商品库存数据
      * @param string $code
      * @return boolean
@@ -82,7 +82,7 @@ class GoodsService extends Service
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function syncStock(string $code): bool
+    public function stock(string $code): bool
     {
         // 商品入库统计
         $query = $this->app->db->name('ShopGoodsStock');
@@ -125,7 +125,7 @@ class GoodsService extends Service
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public function buildData(array &$data = [], $simple = true): array
+    public function bindData(array &$data = [], $simple = true): array
     {
         [$cates, $codes] = [$this->getCateData(), array_unique(array_column($data, 'code'))];
         $marks = $this->app->db->name('ShopGoodsMark')->where(['status' => 1])->column('name');

+ 1 - 1
app/data/service/OrderService.php

@@ -32,7 +32,7 @@ class OrderService extends Service
     {
         $map = ['order_no' => $orderNo];
         $codes = $this->app->db->name('ShopOrderItem')->where($map)->column('goods_code');
-        foreach (array_unique($codes) as $code) GoodsService::instance()->syncStock($code);
+        foreach (array_unique($codes) as $code) GoodsService::instance()->stock($code);
         return true;
     }
 

+ 6 - 5
app/data/view/shop_payment/form.html

@@ -6,11 +6,12 @@
 
         <div class="layui-form-item">
             <span class="color-green font-w7 label-required-prev">支付方式图标</span>
-            <span class="color-desc margin-left-5">Payment Cover</span>
-            <div class="margin-top-10">
-                <input type="hidden" required name="cover" value="{$vo.cover|default=''}"/>
-                <script>$('[name=cover]').uploadOneImage()</script>
-            </div>
+            <span class="color-desc margin-left-5">Payment Image</span>
+            <label class="relative block label-required-null">
+                <input required name="cover" value='{$vo.cover|default=""}' placeholder="请上传支付方式图标 &nbsp;&nbsp;&nbsp;&nbsp;" class="layui-input">
+                <a data-file data-type="png,jpg,gif" data-field="cover" class="layui-icon layui-icon-upload input-right-icon"></a>
+                <script>$('[name="cover"]').uploadOneImage()</script>
+            </label>
         </div>
 
         <label class="layui-form-item relative block">