Browse Source

2024-01-10 拆带导出满箱标红,修改红色贺岁款库存表格、导出

zhiquz 1 year ago
parent
commit
bfc725e730
3 changed files with 74 additions and 35 deletions
  1. BIN
      dist.zip
  2. 2 2
      src/pages/order/list.vue
  3. 72 33
      src/pages/stock/red.vue

BIN
dist.zip


+ 2 - 2
src/pages/order/list.vue

@@ -2377,7 +2377,7 @@ export default {
         const cell_position = XLSX.utils.decode_cell(cell)
         const colName = getColumnName(cell_position.c + 1)
 
-        if (colName === 'AM' && ws[cell].v) {
+        if (colName === 'AP' && ws[cell].v) {
           rowsToColor[cell_position.r] = true // 保存需要上色的行
         }
       }
@@ -2796,7 +2796,7 @@ export default {
           obj['订单状态'] = info.status
           obj['支付状态'] = info.pay_status
           obj['体验店或专车'] = info.store
-          obj['是否满箱'] = `${item['普通'][b].main_attr === '高' ? '高腰' : '青春'}满箱`
+          obj['是否满箱'] = `${item['普通'][b].main_attr === '高' ? '高腰' : item['普通'][b].main_attr === '青春' ? '青春' : '简约'}满箱`
           // obj['赠品'] = info.gift.map(item => `${item.name}${item.num}`).join(';')
           let num_all = 0
           if (item['普通'][b].sec_attr === '男女款') {

+ 72 - 33
src/pages/stock/red.vue

@@ -2,7 +2,7 @@
  * @Author: zhiquz zhiquz@163.com
  * @Date: 2024-01-10 10:46:18
  * @LastEditors: zhiquz zhiquz@163.com
- * @LastEditTime: 2024-01-10 11:42:15
+ * @LastEditTime: 2024-01-10 13:15:32
  * @FilePath: \appadmin-new\src\pages\stock\red.vue
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -12,6 +12,7 @@
     <div>
       <el-input v-model="mobile" placeholder="请输入客户手机号" style="width:300px" clearable @keyup.enter.native="getGoodStock" />
       <el-button type="primary" @click="getGoodStock">搜索</el-button>
+      <el-button type="primary" @click="exportStock">导出</el-button>
     </div>
     <el-table
       ref="listTable"
@@ -21,33 +22,24 @@
       border
       stripe
     >
-      <el-table-column prop="nickname" label="客户昵称" align="center" />
-      <el-table-column prop="realname" label="真实姓名" align="center" />
-      <el-table-column prop="name" label="商品名称" align="center">
-        <template>
-          <span>红色贺岁款</span>
-        </template>
-      </el-table-column>
-      <el-table-column prop="size" label="款式" align="center">
-        <template slot-scope="{ row }">
-          <span>{{ row.size }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column prop="storage" label="限制数量" align="center">
-        <template slot-scope="{ row }">
-          <span>{{ row.limit_num }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column prop="order_num" label="记录的数量" align="center">
-        <template slot-scope="{ row }">
-          <span>{{ row.num }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column prop="order_num" label="实际订单数量" align="center">
-        <template slot-scope="{ row }">
-          <span>{{ row.real_num }}</span>
-        </template>
-      </el-table-column>
+      <el-table-column prop="nickname" label="批发商昵称" align="center" />
+      <el-table-column prop="realname" label="批发商姓名" align="center" />
+      <el-table-column prop="mobile" label="批发商授权手机号" align="center" />
+      <el-table-column prop="status" label="状态" align="center" />
+      <el-table-column prop="男款-L" label="男L" align="center" />
+      <el-table-column prop="男款-XL" label="男XL" align="center" />
+      <el-table-column prop="男款-XXL" label="男2XL" align="center" />
+      <el-table-column prop="男款-3XL" label="男3XL" align="center" />
+      <el-table-column prop="男款-4XL" label="男4XL" align="center" />
+      <el-table-column prop="男款-5XL" label="男5XL" align="center" />
+      <el-table-column prop="男款-6XL" label="男6XL" align="center" />
+      <el-table-column prop="女款-M" label="女M" align="center" />
+      <el-table-column prop="女款-L" label="女L" align="center" />
+      <el-table-column prop="女款-XL" label="女XL" align="center" />
+      <el-table-column prop="女款-XXL" label="女2XL" align="center" />
+      <el-table-column prop="女款-3XL" label="女3XL" align="center" />
+      <el-table-column prop="女款-4XL" label="女4XL" align="center" />
+      <el-table-column prop="女款-5XL" label="女5XL" align="center" />
     </el-table>
     <div style="margin-top: 20px">
       <el-pagination
@@ -74,18 +66,65 @@ export default {
       loadingFull: false,
       numPage: {
         currentPage: 1,
-        pageSize: 15,
+        pageSize: 10,
         total: 0
       }
     }
   },
+  created() {
+    this.getGoodStock()
+  },
   methods: {
+    async exportStock() {
+      this.loadingFull = true
+      try {
+        const res = await GetRight({
+          mobile: this.mobile
+        })
+        if (res.code === 200) {
+          if (!res.data || res.data.length < 0) {
+            this.$message.error('没有可导出数据')
+          } else {
+            const list = res.data.map((item) => ({
+              批发商昵称: item.nickname,
+              批发商姓名: item.realname,
+              批发商授权手机号: item.mobile,
+              状态: item.status,
+              男L: item['男款-L'],
+              男XL: item['男款-XL'],
+              男2XL: item['男款-XXL'],
+              男3XL: item['男款-3XL'],
+              男4XL: item['男款-4XL'],
+              男5XL: item['男款-5XL'],
+              男6XL: item['男款-6XL'],
+              女M: item['女款-M'],
+              女L: item['女款-L'],
+              女XL: item['女款-XL'],
+              女2XL: item['女款-XXL'],
+              女3XL: item['女款-3XL'],
+              女4XL: item['女款-4XL'],
+              女5XL: item['女款-5XL']
+            }))
+            import('@/vendor/Export2Excel').then((excel) => {
+              excel.export_json_to_excel({
+                header: Object.keys(list[0]),
+                data: list.map((listItem) =>
+                  Object.keys(list[0]).map((j) => listItem[j])
+                ),
+                filename: `${new Date().toLocaleDateString() + '红色贺岁版库存' + this.mobile}`,
+                bookType: 'xlsx'
+              })
+            })
+          }
+        }
+      } catch (e) {
+        this.$message.error('导出失败')
+      } finally {
+        this.loadingFull = false
+      }
+    },
     // 获取列表
     async getGoodStock() {
-      if (!this.mobile) {
-        this.$message.error('请输入客户手机号!')
-        return
-      }
       this.loadingFull = true
       GetRight({ mobile: this.mobile }).then(res => {
         this.loadingFull = false