Browse Source

Merge branch 'moss_dev' into develop

* moss_dev:
  feat: 1. 调整线下销售单的旧机回收逻辑 2. 销售退货单增加旧机信息(列表、新增、编辑、详情、审核)
  feat:线下销售单增加旧机信息(列表、新增、编辑、详情)
  feat:订单详情-新增以旧换新信息展示
  feat: 1. 商品列表增加“是否支持以旧换新”字段,以及筛选条件 2. 商品列表增加“开启/关闭以旧换新”按钮 3. 商品新增编辑时增加以旧换新模块
Moss 1 year ago
parent
commit
4ccf746c0e

+ 9 - 0
src/api/goods.js

@@ -189,6 +189,15 @@ export function checkSeckill(params) {
   })
   })
 }
 }
 
 
+// 商品批量开启关闭以旧换新
+export function batchTrade(params) {
+  return request({
+    url: '/goods/batchUp',
+    method: 'post',
+    params
+  })
+}
+
 // 获取模块列表
 // 获取模块列表
 export function getModuleList(params) {
 export function getModuleList(params) {
   return request({
   return request({

+ 18 - 0
src/api/order.js

@@ -415,4 +415,22 @@ export function getOrderCodeList(params) {
     method: 'post',
     method: 'post',
     params
     params
   })
   })
+}
+
+// 获取类别列表
+export function getCategoryList(params) {
+  return request({
+    url: '/trade/list',
+    method: 'get',
+    params
+  })
+}
+
+// 获取规格/属性列表
+export function getAttrList(data) {
+  return request({
+    url: `/trade/list/page`,
+    method: 'post',
+    data
+  })
 }
 }

+ 27 - 4
src/views/mallManagement/goods/goods_add/index.vue

@@ -11,8 +11,25 @@
 
 
     <!-- 第一步 -->
     <!-- 第一步 -->
     <div class="form-container" v-show="step == 0">
     <div class="form-container" v-show="step == 0">
-      <div class="title">基础信息</div>
       <el-form ref="step1Form" :model="step1Form" :rules="step1FormRules" label-width="120px">
       <el-form ref="step1Form" :model="step1Form" :rules="step1FormRules" label-width="120px">
+        <div class="title">以旧换新设置</div>
+        <el-row :gutter="20">
+          <el-col :span="6">
+            <el-form-item label="商品以旧换新:" prop="isTrade">
+              <el-radio-group v-model="step1Form.isTrade">
+                <el-radio :label="'YES'">支持</el-radio>
+                <el-radio :label="'NO'">不支持</el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+          <el-col :span="18">
+            <el-form-item label="以旧换新描述:" prop="tradeRemark">
+              <el-input v-model="step1Form.tradeRemark" placeholder="请输入以旧换新描述"></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      
+        <div class="title">基础信息</div>
         <el-row :gutter="20">
         <el-row :gutter="20">
           <el-col :span="6">
           <el-col :span="6">
             <el-form-item label="品牌:" prop="brand">
             <el-form-item label="品牌:" prop="brand">
@@ -430,6 +447,8 @@ export default {
 
 
       step: 0,
       step: 0,
       step1Form: {
       step1Form: {
+        isTrade: 'NO', // 是否以旧换新
+        tradeRemark: '', // 以旧换新描述
         brand: {}, // 品牌
         brand: {}, // 品牌
         orderSmallType: '', // 工单类型
         orderSmallType: '', // 工单类型
         isVr: false, // 是否虚拟商品
         isVr: false, // 是否虚拟商品
@@ -527,12 +546,12 @@ export default {
 
 
       editSpecImageIdx: null,
       editSpecImageIdx: null,
 
 
-      attrList: [],
-      tagList: [],
+      mainList: [], // 大类列表
+      attrList: [], // 属性列表
+      tagList: [], // 标签列表
 
 
       showImageListUpload2: false,
       showImageListUpload2: false,
 
 
-      mainList: [],
     }
     }
   },
   },
 
 
@@ -673,6 +692,8 @@ export default {
 
 
         // 第一步
         // 第一步
         this.step1Form = {
         this.step1Form = {
+          isTrade: data.isTrade,
+          tradeRemark: data.tradeRemark,
           brand: { id: data.brandId, brandName: data.brandName },
           brand: { id: data.brandId, brandName: data.brandName },
           orderSmallType: data.orderSmallType,
           orderSmallType: data.orderSmallType,
           isVr: data.isVr,
           isVr: data.isVr,
@@ -831,6 +852,8 @@ export default {
 
 
       let params = {
       let params = {
         // 第一步
         // 第一步
+        isTrade: this.step1Form.isTrade,
+        tradeRemark: this.step1Form.tradeRemark,
         brandId: this.step1Form.brand.id,
         brandId: this.step1Form.brand.id,
         brandName: this.step1Form.brand.brandName,
         brandName: this.step1Form.brand.brandName,
         orderSmallType: this.step1Form.orderSmallType,
         orderSmallType: this.step1Form.orderSmallType,

+ 56 - 22
src/views/mallManagement/goods/goods_index/index.vue

@@ -24,7 +24,7 @@
             </div>
             </div>
             <div class="screen clearfix">
             <div class="screen clearfix">
               <el-row :gutter="20">
               <el-row :gutter="20">
-                <el-col :xs="12" :sm="12" :lg="4">
+                <el-col :xs="8" :sm="8" :lg="4">
                   <el-form-item label-width="0">
                   <el-form-item label-width="0">
                     <el-cascader
                     <el-cascader
                       v-model="screenForm.classify"
                       v-model="screenForm.classify"
@@ -39,23 +39,30 @@
                     </el-select> -->
                     </el-select> -->
                   </el-form-item>
                   </el-form-item>
                 </el-col>
                 </el-col>
-                <el-col :xs="12" :sm="12" :lg="4">
+                <el-col :xs="8" :sm="8" :lg="4">
                   <el-form-item label-width="0">
                   <el-form-item label-width="0">
-                    <el-select v-model="screenForm.status" placeholder="全部" size="small" @change="getListByScreen">
-                      <el-option label="上下架状态" value=""></el-option>
+                    <el-select v-model="screenForm.status" placeholder="上下架状态" size="small" clearable @change="getListByScreen">
                       <el-option :label="item.label" :value="item.value" v-for="(item, index) in select_status" :key="index"></el-option>
                       <el-option :label="item.label" :value="item.value" v-for="(item, index) in select_status" :key="index"></el-option>
                     </el-select>
                     </el-select>
                   </el-form-item>
                   </el-form-item>
                 </el-col>
                 </el-col>
-                <el-col :xs="12" :sm="12" :lg="8">
-                  <el-form-item label="销售价格:" label-width="90px">
+                <el-col :xs="8" :sm="8" :lg="4">
+                  <el-form-item label-width="0">
+                    <el-select v-model="screenForm.isTrade" placeholder="是否支持以旧换新" size="small" clearable @change="getListByScreen">
+                      <el-option label="支持以旧换新" value="YES"></el-option>
+                      <el-option label="不支持以旧换新" value="NO"></el-option>
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+                <el-col :xs="12" :sm="12" :lg="6">
+                  <el-form-item label="销售价格" label-width="80px">
                     <el-input v-model="screenForm.price1" size="small" @change="getListByScreen" clearable ></el-input>
                     <el-input v-model="screenForm.price1" size="small" @change="getListByScreen" clearable ></el-input>
                     <span>至</span>
                     <span>至</span>
                     <el-input v-model="screenForm.price2" size="small" @change="getListByScreen" clearable ></el-input>
                     <el-input v-model="screenForm.price2" size="small" @change="getListByScreen" clearable ></el-input>
                   </el-form-item>
                   </el-form-item>
                 </el-col>
                 </el-col>
-                <el-col :xs="12" :sm="12" :lg="8">
-                  <el-form-item label="分销金额:" label-width="90px">
+                <el-col :xs="12" :sm="12" :lg="6">
+                  <el-form-item label="分销金额" label-width="80px">
                     <el-input v-model="screenForm.amount1" size="small" @change="getListByScreen" clearable ></el-input>
                     <el-input v-model="screenForm.amount1" size="small" @change="getListByScreen" clearable ></el-input>
                     <span>至</span>
                     <span>至</span>
                     <el-input v-model="screenForm.amount2" size="small" @change="getListByScreen" clearable ></el-input>
                     <el-input v-model="screenForm.amount2" size="small" @change="getListByScreen" clearable ></el-input>
@@ -74,10 +81,14 @@
       <div class="btn-group clearfix">
       <div class="btn-group clearfix">
         <div class="fl">
         <div class="fl">
           <el-button v-if="$restrict('add')" type="primary" icon="el-icon-plus" size="small" @click="addOrEdit('add')">添加商品</el-button>
           <el-button v-if="$restrict('add')" type="primary" icon="el-icon-plus" size="small" @click="addOrEdit('add')">添加商品</el-button>
-          <el-button v-if="$restrict('batchLaunch')" size="small" @click="batchOperation('on')">批量上架</el-button>
-          <el-button v-if="$restrict('batchRemova')" size="small" @click="batchOperation('off')">批量下架</el-button>
           <el-button v-if="$restrict('batchSet')" size="small" @click="batchOperation('module')">批量设置模块</el-button>
           <el-button v-if="$restrict('batchSet')" size="small" @click="batchOperation('module')">批量设置模块</el-button>
           <el-button v-if="$restrict('batchSetfreight')" size="small" @click="batchOperation('freight')">批量设置运费</el-button>
           <el-button v-if="$restrict('batchSetfreight')" size="small" @click="batchOperation('freight')">批量设置运费</el-button>
+          <el-divider direction="vertical"></el-divider>
+          <el-button v-if="$restrict('batchLaunch')" size="small" @click="batchOperation('status', 'on')">批量上架</el-button>
+          <el-button v-if="$restrict('batchRemova')" size="small" @click="batchOperation('status', 'off')">批量下架</el-button>
+          <el-divider direction="vertical"></el-divider>
+          <el-button v-if="$restrict('batchTrade')" size="small" @click="batchOperation('isTrade', 'YES')">开启以旧换新</el-button>
+          <el-button v-if="$restrict('batchTrade')" size="small" @click="batchOperation('isTrade', 'NO')">关闭以旧换新</el-button>
         </div>
         </div>
       </div>
       </div>
 
 
@@ -153,6 +164,11 @@
 			  </template>
 			  </template>
 		  </el-table-column>
 		  </el-table-column>
           <el-table-column align="center" label="销量" prop="soldNum" min-width="110" sortable></el-table-column>
           <el-table-column align="center" label="销量" prop="soldNum" min-width="110" sortable></el-table-column>
+          <el-table-column align="center" label="是否支持以旧换新" prop="isTrade" min-width="130">
+            <template slot-scope="scope">
+              {{ {YES: '支持', NO: '不支持'}[scope.row.isTrade] }}
+            </template>
+          </el-table-column>
           <el-table-column align="center" label="排序" prop="sortNum" min-width="110" sortable>
           <el-table-column align="center" label="排序" prop="sortNum" min-width="110" sortable>
             <template slot-scope="scope">
             <template slot-scope="scope">
               <!-- {{ scope.row.sortNum }} -->
               <!-- {{ scope.row.sortNum }} -->
@@ -298,7 +314,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getGoodsList, deleteGoods, getClassifyList, getGoodsStateCount, cloneGoods, editGoods, goodsPutOn, goodsPutOff, checkSeckill, getGoodsDetail, getModuleList, setCommomModule, setFreight, getFreightList } from '@/api/goods'
+import { getGoodsList, deleteGoods, getClassifyList, getGoodsStateCount, cloneGoods, editGoods, goodsPutOn, goodsPutOff, checkSeckill, getGoodsDetail, getModuleList, setCommomModule, setFreight, getFreightList, batchTrade } from '@/api/goods'
 import Clipboard from 'clipboard'
 import Clipboard from 'clipboard'
 import { EventBus } from '@/utils/eventBus'
 import { EventBus } from '@/utils/eventBus'
 export default {
 export default {
@@ -315,6 +331,7 @@ export default {
         keyword: '',
         keyword: '',
         classify: '',
         classify: '',
         status: '',
         status: '',
+        isTrade: '',
         price1: '',
         price1: '',
         price2: '',
         price2: '',
         amount1: '',
         amount1: '',
@@ -401,6 +418,7 @@ export default {
         keyword: this.screenForm.keyword,
         keyword: this.screenForm.keyword,
         categoryId: categoryId,
         categoryId: categoryId,
         status: this.screenForm.status,
         status: this.screenForm.status,
+        isTrade: this.screenForm.isTrade,
         startPrice: this.screenForm.price1,
         startPrice: this.screenForm.price1,
         endPrice: this.screenForm.price2,
         endPrice: this.screenForm.price2,
         startShare: this.screenForm.amount1,
         startShare: this.screenForm.amount1,
@@ -605,20 +623,14 @@ export default {
     },
     },
 
 
     // 批量操作
     // 批量操作
-    batchOperation(type) {
+    batchOperation(type, status) {
       if(this.tableSelection.length < 1) {
       if(this.tableSelection.length < 1) {
         return this.$errorMsg('至少选择一个商品');
         return this.$errorMsg('至少选择一个商品');
       }
       }
-      const typeMap = {
-        on: '上架',
-        off: '下架',
-        module: '设置模块',
-        freight: '设置运费'
-      };
 
 
       // 批量上架/批量下架
       // 批量上架/批量下架
-      if(['on', 'off'].includes(type)) {
-        this.$confirm('您确定要批量'+typeMap[type]+'选中商品吗?', '提示', {
+      if(type == 'status') {
+        this.$confirm(`您确定要批量${{on: '上架', off: '下架'}[status]}选中商品吗?`, '提示', {
           confirmButtonText: '确定',
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           cancelButtonText: '取消',
           type: 'warning'
           type: 'warning'
@@ -628,14 +640,14 @@ export default {
             goodsIds.push(item.goodsId);
             goodsIds.push(item.goodsId);
           });
           });
           // 批量上架
           // 批量上架
-          if(type == 'on') {
+          if(status == 'on') {
             goodsPutOn(goodsIds).then(res => {
             goodsPutOn(goodsIds).then(res => {
               this.$successMsg();
               this.$successMsg();
               this.getList();
               this.getList();
             })
             })
           }
           }
           // 批量下架
           // 批量下架
-          else if(type == 'off') {
+          else if(status == 'off') {
             checkSeckill(goodsIds).then(res => {
             checkSeckill(goodsIds).then(res => {
               if(res.data && res.data.length > 0) {
               if(res.data && res.data.length > 0) {
                 let goodsNames = [];
                 let goodsNames = [];
@@ -664,6 +676,28 @@ export default {
 
 
         }).catch(() => {});
         }).catch(() => {});
       }
       }
+
+      // 批量开启关闭以旧换新
+      else if(type == 'isTrade') {
+        this.$confirm(`您确定要批量${{YES: '开启', NO: '关闭'}[status]}以旧换新吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          let goodsIds = [];
+          this.tableSelection.forEach(item => {
+            goodsIds.push(item.goodsId);
+          });
+          batchTrade({
+            goodsIds: goodsIds.join(','),
+            isTrade: status
+          }).then(res => {
+            this.$successMsg();
+            this.getList();
+          })
+        }).catch(() => {});
+      }
+
       // 批量设置模块
       // 批量设置模块
       else if(type == 'module') {
       else if(type == 'module') {
         this.getModuleList();
         this.getModuleList();

+ 322 - 49
src/views/mallManagement/order/offline_order_list/index.vue

@@ -16,7 +16,7 @@
 			</template-page>
 			</template-page>
 			<div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
 			<div v-if="~['add', 'edit'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
 
 
-				<el-form ref="formRef" :model="formData" :rules="formRules" label-position="left" label-width="90px">
+				<el-form ref="formRef" :model="formData" :rules="formRules" label-position="left" label-width="100px">
 
 
           <div style="font-weight: 500;">客户信息</div>
           <div style="font-weight: 500;">客户信息</div>
           <el-divider></el-divider>
           <el-divider></el-divider>
@@ -61,7 +61,7 @@
                 <el-input v-model="formData.recePhone" autocomplete="off" placeholder="请输入客户电话"></el-input>
                 <el-input v-model="formData.recePhone" autocomplete="off" placeholder="请输入客户电话"></el-input>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
-            <el-col :span="12">
+            <el-col :span="6">
               <el-form-item label="支付方式" prop="payType">
               <el-form-item label="支付方式" prop="payType">
                 <el-radio-group v-model="formData.payType">
                 <el-radio-group v-model="formData.payType">
                   <el-radio label="WECHAT">微信支付</el-radio>
                   <el-radio label="WECHAT">微信支付</el-radio>
@@ -70,6 +70,14 @@
                 </el-radio-group>
                 </el-radio-group>
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
+            <el-col :span="6">
+              <el-form-item label="是否以旧换新" prop="isOld">
+                <el-radio-group v-model="formData.isOld" @change="() => {formTabs = 'a'}">
+                  <el-radio label="YES">是</el-radio>
+                  <el-radio label="NO">否</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
             <el-col :span="24">
             <el-col :span="24">
               <el-form-item label="客户地址" prop="province" :required="true">
               <el-form-item label="客户地址" prop="province" :required="true">
                 <el-row>
                 <el-row>
@@ -143,13 +151,17 @@
               </el-form-item>
               </el-form-item>
             </el-col>
             </el-col>
           </el-row>
           </el-row>
+        </el-form>
 
 
-          <div style="font-weight: 500;">商品信息</div>
-          <el-divider></el-divider>
+        <el-tabs v-model="formTabs">
+          <el-tab-pane label="商品信息" name="a"></el-tab-pane>
+          <el-tab-pane label="旧机信息" name="b" v-if="formData.isOld == 'YES'"></el-tab-pane>
+        </el-tabs>
 
 
-          <div>
-            <el-button type="primary" size="small" @click="addGoods(1)">添加商品</el-button>
-            <el-button type="primary" size="small" @click="addGoods(2)">添加物料</el-button>
+        <div v-show="formTabs == 'a'">
+          <div style="margin-top: 30px;">
+            <el-button type="primary" size="small" @click="addGoods(1)" :disabled="formData.isOld == 'YES' && goodsList.length > 0">添加商品</el-button>
+            <el-button type="primary" size="small" @click="addGoods(2)" :disabled="formData.isOld == 'YES' && goodsList.length > 0">添加物料</el-button>
           </div>
           </div>
           <el-table
           <el-table
             class="specTable"
             class="specTable"
@@ -281,17 +293,122 @@
               </template>
               </template>
             </el-table-column>
             </el-table-column>
 
 
-            <el-table-column align="center" label="操作" min-width="120">
+            <el-table-column align="center" label="操作" min-width="120" fixed="right">
               <template slot-scope="scope">
               <template slot-scope="scope">
                 <!-- <el-button type="text" @click="edit('theory', scope.$index)">编辑</el-button> -->
                 <!-- <el-button type="text" @click="edit('theory', scope.$index)">编辑</el-button> -->
-                <el-popconfirm title="确定删除吗?" @confirm="deleteGoods(scope.$index)" style="margin-left: 10px;">
+                <el-popconfirm title="确定删除吗?" @confirm="deleteGoods(scope.$index)">
                   <el-button slot="reference" type="text">删除</el-button>
                   <el-button slot="reference" type="text">删除</el-button>
                 </el-popconfirm>
                 </el-popconfirm>
               </template>
               </template>
             </el-table-column>
             </el-table-column>
           </el-table>
           </el-table>
-          
-        </el-form>
+        </div>
+
+        <div v-show="formTabs == 'b'">
+          <div style="margin-top: 30px;">
+            <el-button type="primary" size="small" :disabled="oldList.length > 0" @click="addOld()">添加旧机</el-button>
+          </div>
+
+          <el-table
+            class="specTable"
+            :data="oldList"
+            element-loading-text="Loading"
+            border
+            highlight-current-row
+            stripe
+            style="margin-top: 20px">
+            <el-table-column align="center" label="大类" prop="mainId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.mainId"
+                  filterable
+                  placeholder="请选择"
+                  @change="changeMain(scope.$index, scope.row)">
+                  <el-option
+                    v-for="item in categoryList"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="小类" prop="smallId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.smallId"
+                  filterable
+                  placeholder="请选择"
+                  @change="changeSmall(scope.$index, scope.row)">
+                  <el-option
+                    v-for="item in scope.row.mainId ? categoryList.find(o => o.categoryId == scope.row.mainId).children : []"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="规格型号" prop="specId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.specId"
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in specList"
+                    :key="item.id"
+                    :label="item.dictName"
+                    :value="item.id">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="属性" prop="attrId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.attrId"
+                  multiple
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in attrList"
+                    :key="item.id"
+                    :label="item.dictName"
+                    :value="item.id"
+                    :disabled="panduanduoxuandanxuan(attrList, item, scope.row.attrId) && !~scope.row.attrId.indexOf(item.id)">
+                    {{ `${item.categoryName} - ${item.dictName}` }}
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="单位" min-width="120">
+              <template>台</template>
+            </el-table-column>
+            <el-table-column align="center" label="数量" prop="num" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" v-model="scope.row.num"></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="金额" prop="price" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" v-model="scope.row.price"></el-input>
+              </template>
+            </el-table-column>
+
+            <el-table-column align="center" label="操作" min-width="120" fixed="right">
+              <template slot-scope="scope">
+                <!-- <el-button type="text" @click="edit('theory', scope.$index)">编辑</el-button> -->
+                <el-popconfirm title="确定删除吗?" @confirm="deleteOld(scope.$index)">
+                  <el-button slot="reference" type="text">删除</el-button>
+                </el-popconfirm>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
 				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
 				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
 				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
 				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
@@ -381,43 +498,72 @@
           </el-descriptions-item>
           </el-descriptions-item>
         </el-descriptions>
         </el-descriptions>
 
 
-        <div style="font-weight: 500; margin-top: 20px;">商品信息</div>
-        <el-divider></el-divider>
+        <el-tabs v-model="detailTabs" style="margin-top: 30px;">
+          <el-tab-pane label="商品信息" name="a"></el-tab-pane>
+          <el-tab-pane label="旧机信息" name="b"></el-tab-pane>
+        </el-tabs>
 
 
-        <el-table
-          class="specTable"
-          :data="detailData.orderDetails"
-          element-loading-text="Loading"
-          border
-          highlight-current-row
-          stripe
-          style="margin-top: 20px">
-          <el-table-column align="center" label="品牌" prop="brandName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="大类" prop="mainName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="小类" prop="smallName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="商品名称" prop="goodsName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="规格型号" prop="goodsSpecName" min-width="120"></el-table-column>
-          <el-table-column align="center" label="单位" prop="goodsMaterialUnit" min-width="120">
-            <template slot-scope="scope">
-              {{scope.row.goodsMaterialUnit | unitFilter}}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="采购数量" prop="num" min-width="120"></el-table-column>
-          <el-table-column align="center" label="内机数量" prop="insideNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="外机数量" prop="outNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="配件数量" prop="partNum" min-width="120"></el-table-column>
-          <el-table-column align="center" label="单价" prop="price" min-width="120"></el-table-column>
-          <el-table-column align="center" label="金额" min-width="120">
-            <template slot-scope="scope">
-              {{scope.row.num * scope.row.price * 100 / 100}}
-            </template>
-          </el-table-column>
-          <el-table-column align="center" label="库存数量" prop="goodsMaterialStock" min-width="120">
-            <template slot-scope="scope">
-              {{scope.row.flag == 1 ? scope.row.stockQty : scope.row.goodsMaterialStock}}
-            </template>
-          </el-table-column>
-        </el-table>
+        <div v-show="detailTabs == 'a'">
+          <el-table
+            class="specTable"
+            :data="detailData.orderDetails"
+            element-loading-text="Loading"
+            border
+            highlight-current-row
+            stripe
+            style="margin-top: 20px">
+            <el-table-column align="center" label="品牌" prop="brandName" min-width="120"></el-table-column>
+            <el-table-column align="center" label="大类" prop="mainName" min-width="120"></el-table-column>
+            <el-table-column align="center" label="小类" prop="smallName" min-width="120"></el-table-column>
+            <el-table-column align="center" label="商品名称" prop="goodsName" min-width="120"></el-table-column>
+            <el-table-column align="center" label="规格型号" prop="goodsSpecName" min-width="120"></el-table-column>
+            <el-table-column align="center" label="单位" prop="goodsMaterialUnit" min-width="120">
+              <template slot-scope="scope">
+                {{scope.row.goodsMaterialUnit | unitFilter}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="采购数量" prop="num" min-width="120"></el-table-column>
+            <el-table-column align="center" label="内机数量" prop="insideNum" min-width="120"></el-table-column>
+            <el-table-column align="center" label="外机数量" prop="outNum" min-width="120"></el-table-column>
+            <el-table-column align="center" label="配件数量" prop="partNum" min-width="120"></el-table-column>
+            <el-table-column align="center" label="单价" prop="price" min-width="120"></el-table-column>
+            <el-table-column align="center" label="金额" min-width="120">
+              <template slot-scope="scope">
+                {{scope.row.num * scope.row.price * 100 / 100}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="库存数量" prop="goodsMaterialStock" min-width="120">
+              <template slot-scope="scope">
+                {{scope.row.flag == 1 ? scope.row.stockQty : scope.row.goodsMaterialStock}}
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+
+        <div v-show="detailTabs == 'b'">
+          <el-table
+            class="specTable"
+            :data="detailData.orderOldProductDTOList"
+            element-loading-text="Loading"
+            border
+            highlight-current-row
+            stripe
+            style="margin-top: 20px">
+            <el-table-column align="center" label="大类" prop="mainName" min-width="160"></el-table-column>
+            <el-table-column align="center" label="小类" prop="smallName" min-width="160"></el-table-column>
+            <el-table-column align="center" label="规格型号" prop="specName" min-width="160"></el-table-column>
+            <el-table-column align="center" label="属性" prop="attrId" min-width="160">
+              <template slot-scope="scope">
+                {{scope.row.itemList.map(o => o.dictName).join('、')}}
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="单位" min-width="120">
+              <template>台</template>
+            </el-table-column>
+            <el-table-column align="center" label="数量" prop="num" min-width="120"></el-table-column>
+            <el-table-column align="center" label="金额" prop="payAmount" min-width="120"></el-table-column>
+          </el-table>
+        </div>
 
 
         <div v-if="activeKey == 'examine'">
         <div v-if="activeKey == 'examine'">
           <div style="font-weight: 500; margin-top: 20px;">审批信息</div>
           <div style="font-weight: 500; margin-top: 20px;">审批信息</div>
@@ -470,7 +616,15 @@ import { lbsAmapRegion } from '@/api/common.js'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import import_mixin from '@/components/template/import_mixin.js'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { getOfflineOrderList, offlineOrderListExport, offlineOrderSave, getOfflineOrderDetail, offlineOrderExamine, getOrderTypeList } from "@/api/order";
+import {getOfflineOrderList,
+        offlineOrderListExport,
+        offlineOrderSave,
+        getOfflineOrderDetail,
+        offlineOrderExamine,
+        getOrderTypeList,
+        getCategoryList,
+        getAttrList,
+      } from "@/api/order";
 import { getGoodsSpecList, getGoodsList } from '@/api/goods'
 import { getGoodsSpecList, getGoodsList } from '@/api/goods'
 import operation_mixin from '@/components/template/operation_mixin.js'
 import operation_mixin from '@/components/template/operation_mixin.js'
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
@@ -547,6 +701,7 @@ export default {
         receUserName: '', // 客户名称
         receUserName: '', // 客户名称
         recePhone: '', // 客户电话
         recePhone: '', // 客户电话
         payType: 'WECHAT', // 支付方式
         payType: 'WECHAT', // 支付方式
+        isOld: 'NO',
         lng: '',
         lng: '',
         lat: '',
         lat: '',
         province: '',
         province: '',
@@ -595,6 +750,15 @@ export default {
 			timer: '',
 			timer: '',
 
 
       pageType: '',
       pageType: '',
+
+      formTabs: 'a',
+      detailTabs: 'a',
+
+      oldList: [], // 旧机列表
+      categoryList: [],
+      specList: [],
+      attrList: [],
+
     }
     }
   },
   },
   computed: {
   computed: {
@@ -708,6 +872,7 @@ export default {
             this.getOrderTypeList();
             this.getOrderTypeList();
             this.getGoodsSpecList();
             this.getGoodsSpecList();
             this.getGoodsList();
             this.getGoodsList();
+            this.getCategoryList();
       			this.formType = type
       			this.formType = type
       			this.formVisible = true
       			this.formVisible = true
             if (type == 'add') {
             if (type == 'add') {
@@ -722,6 +887,21 @@ export default {
                   item.unit = item.goodsMaterialUnit;
                   item.unit = item.goodsMaterialUnit;
                 })
                 })
                 this.goodsList = res.data.orderDetails;
                 this.goodsList = res.data.orderDetails;
+
+                if(res.data.orderOldProductDTOList?.length > 0) {
+                  this.oldList = res.data.orderOldProductDTOList.map(item => {
+                    return {
+                      mainId: item.mainId,
+                      smallId: item.smallId,
+                      specId: item.specId,
+                      attrId: item.itemList.map(o => o.id),
+                      num: item.num,
+                      price: item.payAmount,
+                    }
+                  })
+                  this.getAttrList(res.data.orderOldProductDTOList[0].smallId);
+                }
+                
       				  Object.assign(this.formData, res.data)
       				  Object.assign(this.formData, res.data)
                 this.getinitlbslist();
                 this.getinitlbslist();
       				})
       				})
@@ -735,6 +915,7 @@ export default {
       	}
       	}
       })
       })
     },
     },
+
     formCancel() {
     formCancel() {
       this.formVisible = false
       this.formVisible = false
       this.$refs?.formRef?.resetFields()
       this.$refs?.formRef?.resetFields()
@@ -749,13 +930,35 @@ export default {
       this.formData.orderId = '';
       this.formData.orderId = '';
       this.formData.fileUrl = '';
       this.formData.fileUrl = '';
       this.goodsList = [];
       this.goodsList = [];
+      this.oldList = [];
       this.$data.formRef = this.$options.data().formRef
       this.$data.formRef = this.$options.data().formRef
     },
     },
+
     formConfirm(cancel) {
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
         if (valid) {
+          if(this.goodsList.length < 1) return this.$errorMsg('请添加商品信息');
+          if(this.formData.isOld == 'YES') {
+            if(this.goodsList.length > 1) return this.$errorMsg('以旧换新只可添加一个商品信息');
+            if(this.oldList.length < 1) return this.$errorMsg('以旧换新需要添加旧机信息');
+          }
+
           let orderSmallTypeText = this.orderTypeList.find(o => o.id == this.formData.orderSmallType).orderSmallTypeText;
           let orderSmallTypeText = this.orderTypeList.find(o => o.id == this.formData.orderSmallType).orderSmallTypeText;
-          offlineOrderSave({...this.formData, orderSmallTypeText, orderDetails: this.goodsList}).then(res => {
+          let oldList = this.oldList.map(item => {
+            return {
+              id: item.specId,
+              itemIds: item.attrId,
+              num: item.num,
+              payAmount: item.price
+            }
+          })
+
+          offlineOrderSave({
+            ...this.formData,
+            orderSmallTypeText,
+            orderDetails: this.goodsList,
+            orderOldProductAdds: this.formData.isOld == 'YES' ? oldList : []
+          }).then(res => {
             if(this.formData.payType == 'WECHAT' && this.formDialogType == 0) {
             if(this.formData.payType == 'WECHAT' && this.formDialogType == 0) {
               offlineOrderExamine({
               offlineOrderExamine({
                 orderId: res.data,
                 orderId: res.data,
@@ -1168,6 +1371,7 @@ export default {
       }else{
       }else{
         this.clear()
         this.clear()
         this.$refs.tabPage.removeTab(this.pageType);
         this.$refs.tabPage.removeTab(this.pageType);
+        this.$refs.pageRef.refreshList()
         return 
         return 
       }
       }
       getOfflineOrderDetail({orderId}).then(res => {
       getOfflineOrderDetail({orderId}).then(res => {
@@ -1192,6 +1396,75 @@ export default {
       clearTimeout(this.timer)
       clearTimeout(this.timer)
     },
     },
 
 
+
+
+    // 获取类目列表
+    getCategoryList() {
+      getCategoryList().then(res => {
+        this.categoryList = res.data;
+      })
+    },
+
+    // 获取规格/属性列表
+    getAttrList(smallId) {
+      getAttrList({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          {param: 'small_id', compare: '=', value: smallId},
+          // {param: 'type_attribute', compare: '=', value: 'SPEC'}
+        ]
+      }).then(res => {
+        this.specList = res.data.records.filter(o => o.typeAttribute == 'SPEC');
+        this.attrList = res.data.records.filter(o => o.typeAttribute == 'OTHER');
+      })
+    },
+
+    panduanduoxuandanxuan(list, data, vals) {
+      if (data.typeOption === "SINGLE") {
+        return !!list.filter(item => !!~vals.indexOf(item.id) && item.serviceCategoryId === data.serviceCategoryId).length
+      } else {
+        return false
+      }
+    },
+
+    // 添加旧机
+    addOld() {
+      let obj = {
+        mainId: '',
+        smallId: '',
+        specId: '',
+        attrId: [],
+        num: '',
+        price: '',
+      }
+      let item = JSON.parse(JSON.stringify(obj));
+      this.oldList.push(item);
+    },
+
+    // 删除旧机
+    deleteOld(index) {
+      this.oldList.splice(index, 1);
+    },
+
+    // 切换大类
+    changeMain(index, row) {
+      this.oldList[index].smallId = '';
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+    },
+
+    // 切换小类
+    changeSmall(index, row) {
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+      this.getAttrList(row.smallId);
+    },
+
   }
   }
 }
 }
 </script>
 </script>

+ 26 - 4
src/views/mallManagement/order/order_detail/index.vue

@@ -129,8 +129,30 @@
           </div>
           </div>
         </el-col>
         </el-col>
       </el-row>
       </el-row>
+    </div>
 
 
-
+    <div class="order-detail" v-if="orderDetail.orderOldProductDTOList && orderDetail.orderOldProductDTOList.length > 0" style="margin-bottom: 20px;">
+      <!-- 回收 -->
+      <el-table :data="orderDetail.orderOldProductDTOList" style="width: 100%;" size="small" border>
+        <el-table-column prop="mainName" label="大类" align="center"></el-table-column>
+        <el-table-column prop="smallName" label="小类" align="center"></el-table-column>
+        <el-table-column prop="specName" label="型号" align="center"></el-table-column>
+        <el-table-column prop="itemList" label="属性" align="center">
+          <template slot-scope="scope">
+            {{scope.row.itemList.map(o => o.dictName).join('、')}}
+          </template>
+        </el-table-column>
+        <el-table-column prop="unit" label="单位" align="center">
+          <template>台</template>
+        </el-table-column>
+        <el-table-column prop="num" label="数量" align="center"></el-table-column>
+        <el-table-column prop="payAmount" label="旧机金额" align="center"></el-table-column>
+        <el-table-column prop="yjhxDkFlag" label="支付方式" align="center">
+          <template slot-scope="scope">
+            {{ {1: '线上支付抵扣订单货款', 2: '仅线上展示旧机价值'}[scope.row.yjhxDkFlag] }}
+          </template>
+        </el-table-column>
+      </el-table>
     </div>
     </div>
 
 
     <div class="order-detail" v-if="compensateList.length > 0" style="margin-bottom: 20px;">
     <div class="order-detail" v-if="compensateList.length > 0" style="margin-bottom: 20px;">
@@ -176,15 +198,15 @@
         <el-table-column prop="discountAmount" label="优惠金额" align="center"></el-table-column>
         <el-table-column prop="discountAmount" label="优惠金额" align="center"></el-table-column>
         <!-- <el-table-column prop="zkAmount" label="折扣优惠" align="center"></el-table-column> -->
         <!-- <el-table-column prop="zkAmount" label="折扣优惠" align="center"></el-table-column> -->
         <el-table-column prop="applyAmount" label="优惠价格申请" align="center" min-width="110"></el-table-column>
         <el-table-column prop="applyAmount" label="优惠价格申请" align="center" min-width="110"></el-table-column>
-        <el-table-column prop="profitAmount" label="实际销售金额" align="center">
+        <el-table-column prop="profitAmount" label="实际销售金额" align="center" min-width="110">
           <template slot-scope="scope">
           <template slot-scope="scope">
             {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.profitAmount : scope.row.payAmount }}
             {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.profitAmount : scope.row.payAmount }}
           </template>
           </template>
         </el-table-column>
         </el-table-column>
         <el-table-column prop="payAmount" label="商品总金额" align="center" min-width="100"></el-table-column>
         <el-table-column prop="payAmount" label="商品总金额" align="center" min-width="100"></el-table-column>
         <el-table-column prop="freight" label="运费" align="center"></el-table-column>
         <el-table-column prop="freight" label="运费" align="center"></el-table-column>
-        <el-table-column prop="userRefundNum" label="用户维权数量" align="center"></el-table-column>
-        <el-table-column prop="userRefundAmount" label="用户维权金额" align="center"></el-table-column>
+        <el-table-column prop="userRefundNum" label="用户维权数量" align="center" min-width="110"></el-table-column>
+        <el-table-column prop="userRefundAmount" label="用户维权金额" align="center" min-width="110"></el-table-column>
         <el-table-column prop="refundNum" label="退款数量" align="center"></el-table-column>
         <el-table-column prop="refundNum" label="退款数量" align="center"></el-table-column>
         <el-table-column prop="refundAmount" label="退款金额" align="center"></el-table-column>
         <el-table-column prop="refundAmount" label="退款金额" align="center"></el-table-column>
         <el-table-column label="操作" align="center" width="160" v-if="orderDetail.orderStatus != 'CLOSE' && orderDetail.payTypeId == 'WECHAT'">
         <el-table-column label="操作" align="center" width="160" v-if="orderDetail.orderStatus != 'CLOSE' && orderDetail.payTypeId == 'WECHAT'">

+ 110 - 28
src/views/mallManagement/order/sales_return_order_list/index.vue

@@ -109,12 +109,21 @@
             </el-col>
             </el-col>
           </el-row>
           </el-row>
 
 
-          <el-tabs v-model="curTabs">
+          <el-tabs v-model="formTabs">
             <el-tab-pane label="商品信息" name="a"></el-tab-pane>
             <el-tab-pane label="商品信息" name="a"></el-tab-pane>
             <el-tab-pane label="条码信息" name="b" v-if="joinCode"></el-tab-pane>
             <el-tab-pane label="条码信息" name="b" v-if="joinCode"></el-tab-pane>
+            <el-tab-pane label="旧机信息" name="c" v-if="formData.isReturnOld === 'YES'"></el-tab-pane>
           </el-tabs>
           </el-tabs>
 
 
-          <div v-show="curTabs == 'a'">
+          <div v-show="formTabs == 'a'">
+            <div style="margin-top: 10px;" v-if="formData.isOld == 'YES'">
+              <el-form-item label="是否退旧机" label-width="100px" prop="isReturnOld">
+                <el-radio-group v-model="formData.isReturnOld">
+                  <el-radio label="YES">是</el-radio>
+                  <el-radio label="NO">否</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </div>
             <el-table
             <el-table
               class="specTable"
               class="specTable"
               :data="goodsList"
               :data="goodsList"
@@ -168,7 +177,7 @@
               </el-table-column>
               </el-table-column>
             </el-table>
             </el-table>
           </div>
           </div>
-          <div v-show="curTabs == 'b'">
+          <div v-show="formTabs == 'b'">
             <el-table
             <el-table
               class="specTable"
               class="specTable"
               :data="codeList"
               :data="codeList"
@@ -201,7 +210,30 @@
 
 
             </el-table>
             </el-table>
           </div>
           </div>
-          
+          <div v-show="formTabs == 'c'">
+            <el-table
+              class="specTable"
+              :data="oldList"
+              element-loading-text="Loading"
+              border
+              highlight-current-row
+              stripe
+              style="margin-top: 20px">
+              <el-table-column align="center" label="大类" prop="mainName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="小类" prop="smallName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="规格型号" prop="specName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="属性" prop="attrId" min-width="160">
+                <template slot-scope="scope">
+                  {{scope.row.itemList.map(o => o.dictName).join('、')}}
+                </template>
+              </el-table-column>
+              <el-table-column align="center" label="单位" min-width="120">
+                <template>台</template>
+              </el-table-column>
+              <el-table-column align="center" label="数量" prop="num" min-width="120"></el-table-column>
+              <el-table-column align="center" label="金额" prop="payAmount" min-width="120"></el-table-column>
+            </el-table>
+          </div>
           
           
         </el-form>
         </el-form>
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
@@ -262,12 +294,13 @@
           </el-descriptions-item>
           </el-descriptions-item>
         </el-descriptions>
         </el-descriptions>
 
 
-        <el-tabs v-model="curTabs">
+        <el-tabs v-model="detailTabs">
           <el-tab-pane label="商品信息" name="a"></el-tab-pane>
           <el-tab-pane label="商品信息" name="a"></el-tab-pane>
           <el-tab-pane label="条码信息" name="b" v-if="joinCode"></el-tab-pane>
           <el-tab-pane label="条码信息" name="b" v-if="joinCode"></el-tab-pane>
+          <el-tab-pane label="旧机信息" name="c" v-if="detailData.isOld == 'YES'"></el-tab-pane>
         </el-tabs>
         </el-tabs>
 
 
-        <div v-show="curTabs == 'a'">
+        <div v-show="detailTabs == 'a'">
           <el-table
           <el-table
             class="specTable"
             class="specTable"
             :data="detailData.orderOfflineRefundItems"
             :data="detailData.orderOfflineRefundItems"
@@ -305,7 +338,7 @@
             <el-table-column align="center" label="订单金额" prop="payAmount" min-width="120"></el-table-column>
             <el-table-column align="center" label="订单金额" prop="payAmount" min-width="120"></el-table-column>
           </el-table>
           </el-table>
         </div>
         </div>
-        <div v-show="curTabs == 'b'">
+        <div v-show="detailTabs == 'b'">
           <el-table
           <el-table
             class="specTable"
             class="specTable"
             :data="detailData.orderOfflineItemCodes"
             :data="detailData.orderOfflineItemCodes"
@@ -331,6 +364,30 @@
 
 
           </el-table>
           </el-table>
         </div>
         </div>
+        <div v-show="detailTabs == 'c'">
+          <el-table
+              class="specTable"
+              :data="detailData.orderOldProductDTOList"
+              element-loading-text="Loading"
+              border
+              highlight-current-row
+              stripe
+              style="margin-top: 20px">
+              <el-table-column align="center" label="大类" prop="mainName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="小类" prop="smallName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="规格型号" prop="specName" min-width="160"></el-table-column>
+              <el-table-column align="center" label="属性" prop="attrId" min-width="160">
+                <template slot-scope="scope">
+                  {{scope.row.itemList.map(o => o.dictName).join('、')}}
+                </template>
+              </el-table-column>
+              <el-table-column align="center" label="单位" min-width="120">
+                <template>台</template>
+              </el-table-column>
+              <el-table-column align="center" label="数量" prop="num" min-width="120"></el-table-column>
+              <el-table-column align="center" label="金额" prop="payAmount" min-width="120"></el-table-column>
+            </el-table>
+        </div>
 
 
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
 				  <el-button size="mini" @click="data.removeTab()">关 闭</el-button>
 				  <el-button size="mini" @click="data.removeTab()">关 闭</el-button>
@@ -535,8 +592,13 @@ export default {
 
 
         remark: '', // 备注
         remark: '', // 备注
         fileUrl: '', // 附件
         fileUrl: '', // 附件
+
+        isOld: 'NO',
+        isReturnOld: '',
+      },
+      formRules: {
+        isReturnOld: [{ required: true, message: '请选择是否退旧机', trigger: 'change' }],
       },
       },
-      formRules: {},
       formType: 'add',
       formType: 'add',
       formVisible: false,
       formVisible: false,
 
 
@@ -544,7 +606,9 @@ export default {
       orderTypeList: [],
       orderTypeList: [],
       goodsList: [],
       goodsList: [],
       codeList: [],
       codeList: [],
-      curTabs: 'a',
+      oldList: [],
+      formTabs: 'a',
+      detailTabs: 'a',
 
 
       detailData: {},
       detailData: {},
 
 
@@ -598,6 +662,7 @@ export default {
         getOrderDetail({ orderId: this.$route.query.orderId }).then((res) => {
         getOrderDetail({ orderId: this.$route.query.orderId }).then((res) => {
           const data = res.data;
           const data = res.data;
           this.formData.orderId = data.orderId;
           this.formData.orderId = data.orderId;
+          this.formData.isOld = data.isOld;
           this.formData.saleType = data.saleType;
           this.formData.saleType = data.saleType;
           this.formData.saleName = data.saleName;
           this.formData.saleName = data.saleName;
           this.formData.saleMobile = data.saleMobile;
           this.formData.saleMobile = data.saleMobile;
@@ -610,6 +675,7 @@ export default {
             item.waitRefundPrice = item.price;
             item.waitRefundPrice = item.price;
           })
           })
           this.goodsList = data.orderDetails;
           this.goodsList = data.orderDetails;
+          this.oldList = data.orderOldProductDTOList;
         })
         })
         getOrderCodeList({orderId: this.$route.query.orderId}).then(res => {
         getOrderCodeList({orderId: this.$route.query.orderId}).then(res => {
           this.codeList = res.data;
           this.codeList = res.data;
@@ -692,6 +758,7 @@ export default {
             // this.getOrderTypeList();
             // this.getOrderTypeList();
       			this.formType = type
       			this.formType = type
       			this.formVisible = true
       			this.formVisible = true
+            this.formTabs = 'a';
             if (type == 'add') {
             if (type == 'add') {
       				this.formDialogType = 0
       				this.formDialogType = 0
               this.formData.companyWechatName = this.name;
               this.formData.companyWechatName = this.name;
@@ -723,6 +790,9 @@ export default {
                 this.goodsList = data.orderOfflineRefundItems;
                 this.goodsList = data.orderOfflineRefundItems;
                 this.codeList = data.orderOfflineItemCodes;
                 this.codeList = data.orderOfflineItemCodes;
       				  // Object.assign(this.formData, res.data)
       				  // Object.assign(this.formData, res.data)
+
+                this.formData.isReturnOld = data.isOld;
+                this.oldList = data.orderOldProductDTOList;
       				})
       				})
       			}
       			}
       		})
       		})
@@ -758,7 +828,9 @@ export default {
                 refundAmount: item.waitRefundPrice,
                 refundAmount: item.waitRefundPrice,
               }
               }
             }),
             }),
-            orderOfflineItemCodes: this.joinCode ? this.codeList : []
+            orderOfflineItemCodes: this.joinCode ? this.codeList : [],
+            isOld: this.formData.isReturnOld,
+            ids: this.oldList.map(o => o.id),
           }).then(res => {
           }).then(res => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             cancel('list')
             cancel('list')
@@ -781,6 +853,7 @@ export default {
           this.pageType = type;
           this.pageType = type;
       		this.formCancel()
       		this.formCancel()
       		this.$nextTick(()=>{
       		this.$nextTick(()=>{
+            this.detailTabs = 'a';
             if (type == 'detail') {
             if (type == 'detail') {
       				this.formDialogType = 0
       				this.formDialogType = 0
       			} else if(type == 'examine'){
       			} else if(type == 'examine'){
@@ -884,26 +957,30 @@ export default {
       if(this.waitChooseOrder.length > 1) {
       if(this.waitChooseOrder.length > 1) {
         return this.$errorMsg('最多选择一个订单');
         return this.$errorMsg('最多选择一个订单');
       }
       }
-      const data = this.waitChooseOrder[0];
-      this.formData.orderId = data.orderId;
-      this.formData.saleType = data.saleType;
-      this.formData.saleName = data.saleName;
-      this.formData.saleMobile = data.saleMobile;
-      this.formData.createTime = data.createTime;
-      this.formData.receUserName = data.receUserName;
-      this.formData.recePhone = data.recePhone;
-      this.formData.receAddress = data.receAddress;
-      data.orderDetails.forEach(item => {
-        item.waitRefundNum = item.num;
-        item.waitRefundPrice = item.price;
-      })
-      this.goodsList = data.orderDetails;
+      getOrderDetail({ orderId: this.waitChooseOrder[0].orderId }).then((res) => {
+        const data = res.data;
+        this.formData.orderId = data.orderId;
+        this.formData.isOld = data.isOld;
+        this.formData.saleType = data.saleType;
+        this.formData.saleName = data.saleName;
+        this.formData.saleMobile = data.saleMobile;
+        this.formData.createTime = data.createTime;
+        this.formData.receUserName = data.receUserName;
+        this.formData.recePhone = data.recePhone;
+        this.formData.receAddress = data.receAddress;
+        data.orderDetails.forEach(item => {
+          item.waitRefundNum = item.num;
+          item.waitRefundPrice = item.price;
+        })
+        this.goodsList = data.orderDetails;
+        this.oldList = data.orderOldProductDTOList;
 
 
-      getOrderCodeList({orderId: data.orderId}).then(res => {
-        this.codeList = res.data;
-      })
+        getOrderCodeList({orderId: data.orderId}).then(res => {
+          this.codeList = res.data;
+        })
 
 
-      this.isShowOrderDialog = false;
+        this.isShowOrderDialog = false;
+      })
     },
     },
 
 
     // 删除商品
     // 删除商品
@@ -916,6 +993,11 @@ export default {
       this.codeList.splice(index, 1);
       this.codeList.splice(index, 1);
     },
     },
 
 
+    // 删除旧机
+    deleteOld(index) {
+      this.oldList.splice(index, 1);
+    },
+
     // 获取工单类型列表
     // 获取工单类型列表
     getOrderTypeList() {
     getOrderTypeList() {
       getOrderTypeList({
       getOrderTypeList({