afa 4 місяців тому
батько
коміт
663357ea39

+ 4 - 3
app/admin/controller/shop/ShopList.php

@@ -68,9 +68,10 @@ class ShopList extends Backend
             if(empty($ids) || empty($type_id)) return resp_json(0, '参数错误');
             $customer_id = $this->model::where('id', $ids)->value('customer_id');
             $rows = CustomerSpec::alias('a')
-                ->leftjoin('product_config b', 'a.product_id=b.id') //品种
-                ->leftjoin('stock_config c', 'a.box_id=c.id') //包装箱
-                ->field('a.*,b.title as type_name,c.title as box_name')
+                ->leftjoin('product_config b', 'a.product_id=b.id') //规格
+                ->leftjoin('stock_config c', 'a.type_id=c.id') //品种
+                ->leftjoin('stock_config d', 'a.box_id=d.id') //包装箱
+                ->field('a.*,b.title,c.title as type_name,d.title as box_name')
                 ->where('a.type_id', $type_id)
                 ->where('a.customer_id', $customer_id)
                 ->where('a.status', CustomerSpec::NORMAL)

+ 3 - 2
app/admin/view/shop/customer_spec/add.html

@@ -11,7 +11,7 @@
                 @select="handleSelectionChange" @select-all="handleAllSelect">
                 <el-table-column type="selection" width="55">
                 </el-table-column>
-                <el-table-column prop="type_name" label="规格" align="center">
+                <el-table-column prop="name" label="规格" align="center">
                 </el-table-column>
                 <el-table-column prop="packet" label="包装箱" align="center">
                     <template #default="{row}">
@@ -117,7 +117,8 @@
                             if (index != -1) {
                                 this.tableData.splice(index, 1)
                             } else {
-                                this.tableData.push({  value: res[key]['id'], price: res[key]['price'], type_id: this.tabValue, fast_mail: res[key]['fast_mail'] });
+                                this.tableData.push({ name: res[key]['name'], value: res[key]['id'], price: res[key]['price'], type_id: this.tabValue, fast_mail: res[key]['fast_mail'] });
+
                             }
                         }
                         this.$nextTick(() => {

+ 5 - 7
app/admin/view/shop/shop_list/specs.html

@@ -7,7 +7,7 @@
                 @select="handleSelectionChange" @select-all="handleAllSelect">
                 <el-table-column type="selection" width="55">
                 </el-table-column>
-                <el-table-column prop="type_name" label="规格" align="center">
+                <el-table-column prop="name" label="规格" align="center">
                 </el-table-column>
                 <el-table-column prop="packet" label="包装箱" align="center">
                     <template #default="{row}">
@@ -89,16 +89,13 @@
                 //获取规格 ;
                 Yunqi.ajax.get('shop/shop_list/get_box', { ids: Yunqi.data.ids, type_id: this.tabValue }, false, false, true).then(res => {
                     //编辑数据
-
-                    console.log(res,"res-----------")
-
                     if (res.length > 0) {
                         for (var key in Object(res)) {
                             let index = this.tableData.findIndex(item => item.value == res[key]['id']);
                             if (index != -1) {
                                 this.tableData.splice(index, 1)
                             } else {
-                                this.tableData.push({  value: res[key]['product_id'], price: res[key]['price'], box_id: res[key]['box_id'], fast_mail: res[key]['fast_mail'],box_name: res[key]['box_name'], type_name: res[key]['type_name'], type_id: this.tabValue });
+                                this.tableData.push({name: res[key]['title'], value: res[key]['product_id'], price: res[key]['price'], box_id: res[key]['box_id'], fast_mail: res[key]['fast_mail'],box_name: res[key]['box_name'], type_name: res[key]['type_name'], type_id: this.tabValue });
                             }
                         }
                         console.log(this.tableData,"获取到的表格数据");
@@ -135,7 +132,10 @@
 
                                     if (matched) {
                                         // this.tableData[index] = { name: 'kam', value: 3, price: '111', type_id: '4', packet: '3' }
+
+                                
                                         if (matched.product_id) {
+                                            this.tableData[index].name = matched.name
                                             this.tableData[index].box_name = matched.box_name
                                             this.tableData[index].type_name = matched.type_name
                                             this.tableData[index].price = matched.price
@@ -167,7 +167,6 @@
         },
         onLoad: function (query) {
             let row = Yunqi.data.row;
-            console.log(row, '===')
             if (row) {
                 this.type = 1
                 const grouped = JSON.parse(row).reduce((acc, item) => {
@@ -175,7 +174,6 @@
                     if (!acc[key]) {
                         acc[key] = [];
                     }
-
                     acc[key].push(item);
                     return acc;
                 }, {});

+ 1 - 2
app/api/controller/Index.php

@@ -90,8 +90,7 @@ class Index extends Base
                   $this->error('参数有误');
             }
             $spec = $shopList->where('id', $shop_id)->value('type_spec');
-            $shopList = [];
-            
+            $shopList = $spec?json_decode($spec, true): [];
             return $this->success('ok', $shopList);  
       }