afa 4 ヶ月 前
コミット
85833207f3

+ 0 - 1
app/admin/controller/shop/CustomerSpec.php

@@ -31,7 +31,6 @@ class CustomerSpec extends Backend
         $this->model = new CustomerSpecModel();
         $this->assign('typeList',  StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title','id'));
         $this->assign('packingList', StockConfig::where('type_id', 'packing_box')->column('title','id'));
-        $this->assign('fastmailList', explode("\n", site_config('addonsd.fast_mail')));
         $this->relationField=['customer'];
     }
 

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

@@ -30,7 +30,8 @@ class ShopList extends Backend
         $this->assign('customerList', Customer::where('status', 1)->column('name','id'));
         $this->assign('platformList', site_config('addonsd.platform_list'));
         $this->assign('userList', User::where('status',Customer::STATUS_NORMAL)->column('nickname','id'));
-        $this->assign('fastmailList', explode("\n", site_config('addonsd.fast_mail')));
+        $this->assign('fieldList', StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title','id'));
+
         $this->assign('typeList',  StockConfig::where('type_id', 'variety_name')->order('sort desc')->column('title','id'));
         $this->assign('packingList', StockConfig::where('type_id', 'packing_box')->column('title','id'));
         $this->relationField=['customer','staff'];
@@ -72,6 +73,7 @@ class ShopList extends Backend
                 ->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')
+                ->field('a.*,b.title')
                 ->where('a.type_id', $type_id)
                 ->where('a.customer_id', $customer_id)
                 ->where('a.status', CustomerSpec::NORMAL)

+ 9 - 51
app/admin/view/shop/customer_spec/add.html

@@ -8,31 +8,23 @@
             </el-tab-pane>
 
             <el-table :data="tableData" style="width: 100%" border :ref="'multipleTable_' + tabValue" stripe
-                @select="handleSelectionChange" @select-all="handleAllSelect">
+                @select="handleSelectionChange">
                 <el-table-column type="selection" width="55">
                 </el-table-column>
                 <el-table-column prop="name" label="规格" align="center">
                 </el-table-column>
                 <el-table-column prop="packet" label="包装箱" align="center">
                     <template #default="{row}">
-                        <el-select v-model="row.packet" placeholder="请选择" @change="changePacket($event, row)">
+                        <el-select v-model="row.packet" placeholder="请选择">
                             <el-option v-for="item in options" :key="item.value" :label="item.label"
                                 :value="item.value">
                             </el-option>
                         </el-select>
                     </template>
                 </el-table-column>
-                <el-table-column prop="fast_mail" label="快递" align="center">
-                    <template #default="{row}">
-                        <el-select v-model="row.fast_mail" placeholder="请选择" @change="changeLogi($event, row)">
-                            <el-option v-for="item in logiOptions" :key="item" :label="item" :value="item">
-                            </el-option>
-                        </el-select>
-                    </template>
-                </el-table-column>
                 <el-table-column prop="price" label="发货价" align="center">
                     <template #default="{row}">
-                        <el-input v-model="row.price" @input="changePrice($event, row)"></el-input>
+                        <el-input v-model="row.price"></el-input>
                     </template>
                 </el-table-column>
             </el-table>
@@ -61,7 +53,7 @@
             },
             options: Object.entries(Yunqi.data.packingList).map(([value, label]) => ({ label, value: value.toString() })),//品种
             tabValue: Object.entries(Yunqi.data.typeList).map(([value, label]) => ({ label, value }))[0].value, //选中的品种 获取到品种数据后要给他默认赋值第一个
-            logiOptions: Yunqi.data.fastmailList,
+
             chooseSpec: [], // 当前分类选中的规格  
 
             allData: {},
@@ -92,9 +84,6 @@
                 this.allData[this.tabValue] = e || []
                 // }
             },
-            handleAllSelect(e){
-                this.allData[this.tabValue] = e || []
-            },
             handleClick(data, row) {
                 // 品种切换事件 可以在这里请求规格接口
 
@@ -117,14 +106,12 @@
                             if (index != -1) {
                                 this.tableData.splice(index, 1)
                             } else {
-                                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.tableData.push({ name: res[key]['title'], value: res[key]['id'], price: res[key]['price'], type_id: this.tabValue });
                             }
                         }
                         this.$nextTick(() => {
                             const tableRef = this.$refs['multipleTable_' + this.tabValue];
                             if (this.type == 0 && this.allData[this.tabValue]?.length > 0 && tableRef) {
-                                console.log(this.allData[Number(this.tabValue)], this.tableData, "===")
                                 this.tableData.forEach((item, index) => {
                                     const matched = this.allData[this.tabValue].find(row => {
                                         return row.value == item.value
@@ -142,7 +129,6 @@
                                 });
                             }
                             else if (this.type == 1 && this.allData[Number(this.tabValue)]) {
-                                console.log(this.allData[Number(this.tabValue)], this.tableData)
                                 this.tableData.forEach((item, index) => {
                                     const matched = this.allData[Number(this.tabValue)].find(row => {
                                         if (row.product_id) {
@@ -150,13 +136,13 @@
                                         } else {
                                             return row.value == item.value
                                         }
+
                                     });
                                     if (matched) {
                                         // this.tableData[index] = { name: 'kam', value: 3, price: '111', type_id: '4', packet: '3' }
                                         if (matched.product_id) {
                                             this.tableData[index].price = matched.price
                                             this.tableData[index].packet = matched.box_id != 0 ? matched?.box_id.toString() : ""
-                                            this.tableData[index].fast_mail = matched.fast_mail
                                         } else {
                                             this.tableData[index] = matched
                                         }
@@ -179,34 +165,8 @@
                         });
                     }
                 });
-            },
-            changeLogi(value, row) {
-                if (this.allData[this.tabValue].length > 0) {
-                   this.allData[this.tabValue].forEach((item, index) => {
-                        if (item.product_id == row.value) {
-                            this.allData[this.tabValue][index].fast_mail = value
-                        }
-                    }) 
-                }
-                
-            },
-            changePacket(value, row) {
-                if (this.allData[this.tabValue].length > 0) {
-                    this.allData[this.tabValue].forEach((item, index) => {
-                        if (item.product_id == row.value) {
-                            this.allData[this.tabValue][index].packet = value
-                            this.allData[this.tabValue][index].box_id = value
-                        }
-                    })
-                }
-            },
-            changePrice(value, row) {
-                this.allData[this.tabValue].forEach((item, index) => {
-                    if (item.product_id == row.value) {
-                        this.allData[this.tabValue][index].price = value
-                    }
-                })
-            },
+            }
+
         },
         onLoad: function (query) {
             let row = Yunqi.data.row;
@@ -215,9 +175,7 @@
             } else {
                 this.type = 0
             }
-            // Yunqi.data.fastmailList 快递 1111
-            console.log(Yunqi.data.fastmailList, "快递")
-            console.log(row, "-----")
+            console.log(this.type)
             const grouped = row.reduce((acc, item) => {
                 const key = item.type_id;
                 if (!acc[key]) {

+ 2 - 6
app/admin/view/shop/shop_list/specs.html

@@ -14,7 +14,6 @@
                         <span>{{options[row.box_id]}}</span>
                     </template>
                 </el-table-column>
-                <el-table-column prop="fast_mail" label="快递" align="center" ></el-table-column>
                 <el-table-column prop="price" label="发货价" align="center" ></el-table-column>
                     
             </el-table>
@@ -95,11 +94,9 @@
                             if (index != -1) {
                                 this.tableData.splice(index, 1)
                             } else {
-                                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 });
+                                this.tableData.push({name: res[key]['title'], value: res[key]['product_id'], price: res[key]['price'], box_id: res[key]['box_id'],box_name: res[key]['box_name'], type_name: res[key]['type_name'], type_id: this.tabValue });
                             }
                         }
-                        console.log(this.tableData,"获取到的表格数据");
-                        
                         this.$nextTick(() => {
                             const tableRef = this.$refs['multipleTable_' + this.tabValue];
                             if (this.type == 0 && this.allData[this.tabValue]?.length > 0 && tableRef) {
@@ -132,8 +129,6 @@
 
                                     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
@@ -174,6 +169,7 @@
                     if (!acc[key]) {
                         acc[key] = [];
                     }
+
                     acc[key].push(item);
                     return acc;
                 }, {});

+ 1 - 1
app/api/controller/Shops.php

@@ -44,7 +44,7 @@ class Shops extends Base
                 ->leftjoin('stock_config c', 'a.variety_id = c.id') //品种
                 ->leftjoin('product_config d', 'a.spec_id = d.id') //规格
                 ->leftjoin('customer u', 'a.customer_id = u.id') //客户
-                ->field('a.id,a.plat_id,a.shop_id,a.box_id,a.fast_mail,a.ship_date,a.settlement_data,a.createtime,a.num, b.name shop_name,c.title variety_name,d.title spec_name,u.name customer_name')
+                ->field('a.id,a.plat_id,a.shop_id,a.box_id,a.box_name,a.ship_date,a.settlement_data,a.createtime,a.num, b.name shop_name,c.title variety_name,d.title spec_name,u.name customer_name')
                 ->where($where)
                 ->order('a.ship_date desc')
                 ->paginate($limit);

+ 5 - 3
app/api/service/SpecService.php

@@ -42,7 +42,7 @@ class SpecService{
       
        //录入规格列表
       public static function getDeliveryList(int $uid, array $data): array
-      {     
+      {      
             $result = [];
             $stockData = [];
             //获取店铺客户信息
@@ -51,7 +51,7 @@ class SpecService{
             //结算周期
             $settlement_data = SpecService::getDeliverySettlement($customer, $data['ship_date']);
             foreach ($data['variety'] as $item) {
-                  if(count($item) != 9 || empty(floatval($item['num'])))  throw new \Exception('参数有误!');
+                  if(count($item) != 8 || empty(floatval($item['num'])))  throw new \Exception('参数有误!');
                   $specsWeight = ProductConfig::where('id', $item['spec_id'])->value('weight');
                   $weight = bcmul((string)$specsWeight, $item['num'], 2);
                   $result[] = [
@@ -60,9 +60,11 @@ class SpecService{
                         'shop_id'         => $data['shop_id'],
                         'plat_id'         => $data['plat_id'],
                         'variety_id'      => $item['variety_id'],
+                        'variety_name'    => $item['variety_name'],
                         'spec_id'         => $item['spec_id'],
                         'box_id'          => $item['box_id'],
-                        'fast_mail'       => $item['fast_mail'],
+                        'box_name'        => $item['box_name'],
+                        'spec_name'       => $item['spec_name'],
                         'num'             => $item['num'],
                         'weigh'           => $weight,
                         'price'           => $item['price'],