Quellcode durchsuchen

Merge branch 'moss_dev'

pengyh vor 1 Jahr
Ursprung
Commit
0d27ec68e1

+ 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) {
   return request({

+ 82 - 0
src/api/old_machine.js

@@ -0,0 +1,82 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+// 获取列表
+export function getList(data) {
+  return request({
+    url: `/oldManager/list/page?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+// 导出列表
+export function listExport(data, name) {
+  return postBlob({
+    url: '/oldManager/pageExport',
+    data,
+    name
+  })
+}
+
+// 详情
+export function getDetail(params) {
+  return request({
+    url: '/oldManager/detail',
+    method: 'post',
+    params
+  })
+}
+
+// 保存
+export function addData(params) {
+  return request({
+    url: '/oldManager/add',
+    method: 'post',
+    data: params
+  })
+}
+
+// 保存
+export function editData(params) {
+  return request({
+    url: '/oldManager/update',
+    method: 'post',
+    data: params
+  })
+}
+
+// 出库
+export function outData(params) {
+  return request({
+    url: '/oldManager/out',
+    method: 'post',
+    params
+  })
+}
+
+// 工单类型列表
+export function getOrderTypeList(data) {
+  return request({
+    url: `/order/smalltype/list`,
+    method: 'post',
+    data
+  })
+}
+
+// 获取类别列表
+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
+  })
+}

+ 18 - 0
src/api/order.js

@@ -415,4 +415,22 @@ export function getOrderCodeList(params) {
     method: 'post',
     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="title">基础信息</div>
       <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-col :span="6">
             <el-form-item label="品牌:" prop="brand">
@@ -427,6 +444,8 @@ export default {
 
       step: 0,
       step1Form: {
+        isTrade: 'NO', // 是否以旧换新
+        tradeRemark: '', // 以旧换新描述
         brand: {}, // 品牌
         orderSmallType: '', // 工单类型
         isVr: false, // 是否虚拟商品
@@ -524,12 +543,12 @@ export default {
 
       editSpecImageIdx: null,
 
-      attrList: [],
-      tagList: [],
+      mainList: [], // 大类列表
+      attrList: [], // 属性列表
+      tagList: [], // 标签列表
 
       showImageListUpload2: false,
 
-      mainList: [],
     }
   },
 
@@ -670,6 +689,8 @@ export default {
 
         // 第一步
         this.step1Form = {
+          isTrade: data.isTrade,
+          tradeRemark: data.tradeRemark,
           brand: { id: data.brandId, brandName: data.brandName },
           orderSmallType: data.orderSmallType,
           isVr: data.isVr,
@@ -828,6 +849,8 @@ export default {
 
       let params = {
         // 第一步
+        isTrade: this.step1Form.isTrade,
+        tradeRemark: this.step1Form.tradeRemark,
         brandId: this.step1Form.brand.id,
         brandName: this.step1Form.brand.brandName,
         orderSmallType: this.step1Form.orderSmallType,

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

@@ -24,7 +24,7 @@
             </div>
             <div class="screen clearfix">
               <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-cascader
                       v-model="screenForm.classify"
@@ -39,23 +39,30 @@
                     </el-select> -->
                   </el-form-item>
                 </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-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-select>
                   </el-form-item>
                 </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>
                     <span>至</span>
                     <el-input v-model="screenForm.price2" size="small" @change="getListByScreen" clearable ></el-input>
                   </el-form-item>
                 </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>
                     <span>至</span>
                     <el-input v-model="screenForm.amount2" size="small" @change="getListByScreen" clearable ></el-input>
@@ -74,10 +81,14 @@
       <div class="btn-group clearfix">
         <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('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('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>
 
@@ -153,6 +164,11 @@
 			  </template>
 		  </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>
             <template slot-scope="scope">
               <!-- {{ scope.row.sortNum }} -->
@@ -298,7 +314,7 @@
 </template>
 
 <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 { EventBus } from '@/utils/eventBus'
 export default {
@@ -315,6 +331,7 @@ export default {
         keyword: '',
         classify: '',
         status: '',
+        isTrade: '',
         price1: '',
         price2: '',
         amount1: '',
@@ -401,6 +418,7 @@ export default {
         keyword: this.screenForm.keyword,
         categoryId: categoryId,
         status: this.screenForm.status,
+        isTrade: this.screenForm.isTrade,
         startPrice: this.screenForm.price1,
         endPrice: this.screenForm.price2,
         startShare: this.screenForm.amount1,
@@ -605,20 +623,14 @@ export default {
     },
 
     // 批量操作
-    batchOperation(type) {
+    batchOperation(type, status) {
       if(this.tableSelection.length < 1) {
         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: '确定',
           cancelButtonText: '取消',
           type: 'warning'
@@ -628,14 +640,14 @@ export default {
             goodsIds.push(item.goodsId);
           });
           // 批量上架
-          if(type == 'on') {
+          if(status == 'on') {
             goodsPutOn(goodsIds).then(res => {
               this.$successMsg();
               this.getList();
             })
           }
           // 批量下架
-          else if(type == 'off') {
+          else if(status == 'off') {
             checkSeckill(goodsIds).then(res => {
               if(res.data && res.data.length > 0) {
                 let goodsNames = [];
@@ -664,6 +676,28 @@ export default {
 
         }).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') {
         this.getModuleList();

+ 1128 - 0
src/views/mallManagement/old_machine/index.vue

@@ -0,0 +1,1128 @@
+<template>
+  <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
+		<template slot-scope="{activeKey, data}">
+			<template-page v-if="activeKey == 'list'" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
+			  :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
+			  :operation="operation()" :exportList="exportList" :operationColumnWidth="160">
+        <div slot="moreSearch">
+          <el-radio-group v-model="examineStatus" size="mini" @change="changeType">
+            <el-radio-button label="">全部</el-radio-button>
+            <el-radio-button label="IN">未出库</el-radio-button>
+            <el-radio-button label="OUT">已出库</el-radio-button>
+          </el-radio-group>
+          <br><br>
+        </div>
+			</template-page>
+
+      <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="80px">
+
+          <div style="font-weight: 500;">客户信息</div>
+          <el-divider></el-divider>
+
+          <el-row :gutter="20">
+            <el-col :span="6">
+              <el-form-item label="所属商户" prop="companyName">
+                <el-input v-model="formData.companyName" autocomplete="off" placeholder="请输入所属商户" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="销售类型" prop="saleType">
+                <el-radio-group v-model="formData.saleType" disabled>
+                  <el-radio :label="1">线上销售</el-radio>
+                  <el-radio :label="2">线下销售</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="订单编号" prop="orderId">
+                <el-input v-model="formData.orderId" autocomplete="off" placeholder="请输入订单编号"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="工单类型" prop="orderSmallType">
+                <el-select v-model="formData.orderSmallType" placeholder="请选择">
+                  <el-option
+                    v-for="item in orderTypeList"
+                    :key="item.id"
+                    :label="item.orderSmallTypeText"
+                    :value="item.id">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="工单编号" prop="pgOrderId">
+                <el-input v-model="formData.pgOrderId" autocomplete="off" placeholder="请输入工单编号"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="完工时间" prop="overTime">
+                <el-date-picker
+                  v-model="formData.overTime"
+                  format="yyyy-MM-dd"
+                  value-format="yyyy-MM-dd"
+                  style="width: 100%;"
+                  type="date"
+                  placeholder="选择日期">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="客户名称" prop="userName">
+                <el-input v-model="formData.userName" autocomplete="off" placeholder="请输入客户名称"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="客户电话" prop="userPhone">
+                <el-input v-model="formData.userPhone" autocomplete="off" placeholder="请输入客户电话"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="客户地址" prop="province" :required="true">
+                <el-row>
+                  <el-col :span="5" style="margin-right: 12px;">
+                    <el-select v-model="formData.provinceId" placeholder="请选择省" style="width: 100%;" @change="changeProvince">
+                      <el-option
+                        v-for="item in provinceList.map(v => ({ value: v.id, label: v.name }))"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+                      </el-option>
+                    </el-select>
+                  </el-col>
+                  <el-col :span="5" style="margin-right: 12px;">
+                    <el-select v-model="formData.cityId" placeholder="请选择市" style="width: 100%;" @change="changeCity">
+                      <el-option
+                        v-for="item in cityList.map(v => ({ value: v.id, label: v.name }))"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+                      </el-option>
+                    </el-select>
+                  </el-col>
+                  <el-col :span="5" style="margin-right: 12px;">
+                    <el-select v-model="formData.areaId" placeholder="请选择区" style="width: 100%;" @change="changeArea">
+                      <el-option
+                        v-for="item in areaList.map(v => ({ value: v.id, label: v.name }))"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+                      </el-option>
+                    </el-select>
+                  </el-col>
+                  <el-col :span="8">
+                    <el-select v-model="formData.streetId" placeholder="请选择街道" style="width: 100%;" @change="changeStreet">
+                      <el-option
+                        v-for="item in streetList.map(v => ({ value: v.id, label: v.name }))"
+                        :key="item.value"
+                        :label="item.label"
+                        :value="item.value">
+                      </el-option>
+                    </el-select>
+                  </el-col>
+                </el-row>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="" prop="userAddress">
+                <el-row :gutter="20">
+                  <el-col :span="22">
+                    <el-input type="text" v-model="formData.userAddress" placeholder="详细地址"></el-input>
+                  </el-col>
+                  <el-col :span="2">
+                    <geographicalPosi :formData="formData" @selectPosi="selectAddress"/>
+                  </el-col>
+                </el-row>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="备注" prop="remark">
+                <el-input type="textarea" v-model="formData.remark" autocomplete="off" placeholder="请输入备注"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="附件" prop="remark">
+                <el-upload class="avatar-uploader" style="height:122px" :action="baseURL + 'common/upload'" :headers="myHeaders"
+                  :show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload">
+                  <img v-if="formData.fileUrl" :src="formData.fileUrl" class="avatar">
+                  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+                </el-upload>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+
+        <el-tabs v-model="formTabs">
+          <el-tab-pane label="旧机信息" name="a"></el-tab-pane>
+        </el-tabs>
+
+        <div v-show="formTabs == 'a'">
+          <div style="margin-top: 30px;">
+            <el-button type="primary" size="small" @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)"
+                  v-if="scope.row.isEdit">
+                  <el-option
+                    v-for="item in mainList"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+                <div v-else>{{scope.row.mainName}}</div>
+              </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)"
+                  v-if="scope.row.isEdit">
+                  <el-option
+                    v-for="item in smallList"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+                <div v-else>{{scope.row.smallName}}</div>
+              </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="请选择"
+                  @change="changeSpec(scope.$index, scope.row)"
+                  v-if="scope.row.isEdit">
+                  <el-option
+                    v-for="item in specList"
+                    :key="item.id"
+                    :label="item.dictName"
+                    :value="item.id">
+                  </el-option>
+                </el-select>
+                <div v-else>{{scope.row.specName}}</div>
+              </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="请选择"
+                  @change="changeAttr(scope.$index, scope.row)"
+                  v-if="scope.row.isEdit">
+                  <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>
+                <div v-else>{{scope.row.attrName.join('、')}}</div>
+              </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" v-if="scope.row.isEdit"></el-input>
+                <div v-else>{{scope.row.num}}</div>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="金额" prop="payAmount" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" v-model="scope.row.payAmount" v-if="scope.row.isEdit"></el-input>
+                <div v-else>{{scope.row.payAmount}}</div>
+              </template>
+            </el-table-column>
+
+            <el-table-column align="center" label="操作" min-width="120" fixed="right">
+              <template slot-scope="scope">
+                <el-button type="text" @click="saveOld(scope.$index, scope.row)" v-if="scope.row.isEdit">保存</el-button>
+                <el-button type="text" @click="editOld(scope.$index, scope.row)" v-else>编辑</el-button>
+                <el-popconfirm title="确定删除吗?" @confirm="deleteOld(scope.$index)" style="margin-left: 10px">
+                  <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;">
+				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
+				</div>
+			</div>
+
+      <div v-if="~['detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
+        <div style="font-weight: 500;">客户信息</div>
+        <el-divider></el-divider>
+
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%">
+          <el-descriptions-item label="所属商户">
+            {{detailData.companyName}}
+          </el-descriptions-item>
+          <el-descriptions-item label="销售类型">
+            {{{1: '线上销售', 2: '线下销售'}[detailData.saleType]}}
+          </el-descriptions-item>
+          <el-descriptions-item label="订单单号">
+            {{detailData.orderId}}
+          </el-descriptions-item>
+          <el-descriptions-item label="工单类型">
+            {{detailData.orderSmallTypeText}}
+          </el-descriptions-item>
+        </el-descriptions>
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%" style="margin-top: -1px">
+          <el-descriptions-item label="订单单号">
+            {{detailData.pgOrderId}}
+          </el-descriptions-item>
+          <el-descriptions-item label="完工时间">
+            {{detailData.overTime}}
+          </el-descriptions-item>
+          <el-descriptions-item label="客户姓名">
+            {{detailData.userName}}
+          </el-descriptions-item>
+          <el-descriptions-item label="客户电话">
+            {{detailData.userPhone}}
+          </el-descriptions-item>
+        </el-descriptions>
+        <el-descriptions border title="" :column="1" :colon="false" labelStyle="width: 8%" contentStyle="width: 92%" style="margin-top: -1px">
+          <el-descriptions-item label="详细地址">
+            {{detailData.province}}{{detailData.city}}{{detailData.area}}{{detailData.street}}{{detailData.userAddress}}
+          </el-descriptions-item>
+        </el-descriptions>
+        <el-descriptions border title="" :column="1" :colon="false" labelStyle="width: 8%" contentStyle="width: 92%" style="margin-top: -1px">
+          <el-descriptions-item label="附件">
+            <el-image 
+              v-if="detailData.fileUrl"
+              style="width: 100px; height: 100px"
+              :src="detailData.fileUrl" 
+              :preview-src-list="[detailData.fileUrl]">
+            </el-image>
+          </el-descriptions-item>
+          <el-descriptions-item label="备注">
+            {{detailData.remark}}
+          </el-descriptions-item>
+        </el-descriptions>
+
+        <el-tabs v-model="detailTabs" style="margin-top: 30px;">
+          <el-tab-pane label="旧机信息" name="a"></el-tab-pane>
+        </el-tabs>
+
+        <div v-show="detailTabs == 'a'">
+          <el-table
+            class="specTable"
+            :data="detailData.itemList"
+            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.oldProductManagerItemAttributes.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;">
+				  <el-button size="mini" @click="data.removeTab()">关 闭</el-button>
+				</div>
+      </div>
+
+    </template>
+  </zj-tab-page>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+import { getToken } from '@/utils/auth'
+import { lbsAmapRegion } from '@/api/common.js'
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import {getList,
+        listExport,
+        addData,
+        editData,
+        getDetail,
+        outData,
+        getOrderTypeList,
+        getCategoryList,
+        getAttrList,
+      } from "@/api/old_machine";
+import operation_mixin from '@/components/template/operation_mixin.js'
+import geographicalPosi from '@/components/geographicalPosi/index.vue'
+
+export default {
+  components: { TemplatePage, geographicalPosi },
+  mixins: [import_mixin,operation_mixin],
+
+  data() {
+    const validatePhone = (rule, value, callback) => {
+      if(!value) {
+        callback('请输入手机号')
+      } else if(!(/^1[3456789]\d{9}$/.test(value))) {
+        callback('请输入正确的手机号')
+      } else {
+        callback()
+      }
+    }
+    return {
+      baseURL: process.env.VUE_APP_BASE_API,
+      myHeaders: { 'x-token': getToken() },
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ["新增", "编辑"],
+      formDialog: false,
+      formData: {
+        id: '',
+        companyName: '', // 所属商户
+        saleType: 2, // 销售类型
+        orderId: '', // 订单编号
+        orderSmallType: '', // 工单类型
+        pgOrderId: '', // 工单编号
+        overTime: '', // 完工时间
+        userName: '', // 客户名称
+        userPhone: '', // 客户电话
+        lng: '',
+        lat: '',
+        province: '',
+        provinceId: '',
+        city: '',
+        cityId: '',
+        area: '',
+        areaId: '',
+        street: '',
+        streetId: '',
+        userAddress: '',
+        remark: '', // 备注
+        fileUrl: '', // 附件
+      },
+      formRules: {
+        userName: [{ required: true, message: '请输入客户名称', trigger: 'blur' }],
+        userPhone: [{ required: true, validator: validatePhone, trigger: 'blur' }],
+      },
+      formType: 'add',
+      formVisible: false,
+
+      examineStatus: '',
+      orderTypeList: [],
+      provinceList: [],
+      cityList: [],
+      areaList: [],
+      streetList: [],
+      goodsList: [],
+      goodsSpecList: [],
+      goodsSelectList: [],
+
+      detailData: {},
+      examineFormData: {
+        status: '',
+        remark: '',
+      },
+      examineFormRules: {
+        status: [{ required: true, message: '请选择审批结果', trigger: 'change' }],
+        remark: [{ required: true, message: '请输入审批备注', trigger: 'blur' }],
+      },
+
+      showCodeDialog: false,
+			timer: '',
+
+      pageType: '',
+
+      formTabs: 'a',
+      detailTabs: 'a',
+
+      oldList: [], // 旧机列表
+      mainList: [],
+      smallList: [],
+      specList: [],
+      attrList: [],
+
+    }
+  },
+
+  computed: {
+    ...mapGetters(['name']),
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth("add", {
+              click: () => {
+                this.openForm('add')
+              }
+            })
+          ],
+        ],
+        [
+          [
+            this.optionsEvensAuth('out', {
+              name: '批量出库',
+              click: () => {
+                this.batchOut()
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    // 更多参数
+    moreParameters() {
+      return []
+    },
+  },
+
+  create() {
+		
+  },
+
+  methods: {
+    // 列表请求函数
+    // getList: getList,
+    getList(p) {
+      try {
+        var pam = JSON.parse(JSON.stringify(p))
+        if (this.examineStatus) {
+          pam.params.push({ "param": "a.status", "compare": "=", "value": this.examineStatus })
+        }
+        return getList(pam)
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 列表导出函数
+    exportList: listExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
+    },
+    // 切换状态
+    changeType(val) {
+      this.$refs.pageRef.refreshList()
+    },
+    // 表格操作列
+    operation() {
+      return this.operationBtn({
+        edit: {
+          conditions: ({ row, index, column }) => {
+            return row.status == 'IN'
+          },
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.id)
+          }
+        },
+        detail: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openDetail('detail', row.id)
+          }
+        },
+        out: {
+          conditions: ({ row, index, column }) => {
+            return row.status == 'IN'
+          },
+          btnType: 'text',
+          prompt: '确定出库吗?',
+          click: ({ row, index, column }) => {
+            outData({ oldManagerId: row.id }).then(() => {
+              this.$message({ type: 'success', message: '出库成功!' })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        },
+        orderDetail: {
+          conditions: ({ row, index, column }) => {
+            return row.saleType == 1
+          },
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.$router.push({
+              name: "order_detail",
+              query: {
+                orderId: row.orderId
+              }
+            })
+          }
+        },
+      })
+    },
+    openForm(type, id) {
+      this.$refs.tabPage.addTab({
+      	// 对应显示的模块
+      	activeKey: type,
+      	// 唯一标识
+      	key: type,
+      	// 页签名称
+      	label: ({ add: '新增', edit: '编辑' })[type],
+      	// 打开时事件
+      	triggerEvent: () => {
+          this.pageType = type;
+      		this.formCancel()
+      		this.$nextTick(()=>{
+            this.getOrderTypeList();
+      			this.formType = type;
+      			this.formVisible = true;
+            if (type == 'add') {
+      				this.formDialogType = 0
+              this.formData.companyName = this.name;
+              this.getinitlbslist();
+      			} else if(type == 'edit'){
+      				this.formDialogType = 1;
+      				getDetail({ oldManagerId: id }).then(res => {
+                const data = res.data;
+
+                this.formData = Object.keys(this.formData).reduce((result, key) => {
+                  if (data.hasOwnProperty(key)) {
+                    result[key] = data[key];
+                  }else {
+                    result[key] = this.formData[key];
+                  }
+                  return result;
+                }, {});
+
+                if(data.itemList?.length > 0) {
+                  this.oldList = data.itemList.map(item => {
+                    return {
+                      isEdit: false,
+                      mainId: item.mainId,
+                      mainName: item.mainName,
+                      smallId: item.smallId,
+                      smallName: item.smallName,
+                      specId: item.specId,
+                      specName: item.specName,
+                      attrId: item.oldProductManagerItemAttributes.map(o => o.goodsCategoryItemId),
+                      attrName: item.oldProductManagerItemAttributes.map(o => o.dictName),
+                      num: item.num,
+                      payAmount: item.payAmount,
+                    }
+                  })
+                }
+                this.getinitlbslist();
+      				})
+      			}
+      		})
+      	},
+      	// 关闭时事件
+      	closeEvent: () => {
+			    this.formCancel()
+      	}
+      })
+    },
+
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      this.formData.id = '';
+      this.formData.province = '';
+      this.formData.provinceId = '';
+      this.formData.city = '';
+      this.formData.cityId = '';
+      this.formData.area = '';
+      this.formData.areaId = '';
+      this.formData.street = '';
+      this.formData.streetId = '';
+      this.formData.fileUrl = '';
+      this.oldList = [];
+      this.$data.formRef = this.$options.data().formRef
+    },
+
+    formConfirm(cancel) {
+      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
+
+          let orderSmallTypeText = this.orderTypeList.find(o => o.id == this.formData.orderSmallType).orderSmallTypeText;
+          let oldList = this.oldList.map(item => {
+            return {
+              id: item.specId,
+              itemIds: item.attrId,
+              num: item.num,
+              payAmount: item.payAmount
+            }
+          })
+
+          if(this.formDialogType == 0) {
+            addData({
+              ...this.formData,
+              overTime: this.formData.overTime.length == 10 ? this.formData.overTime + ' 00:00:00' : this.formData.overTime,
+              orderSmallTypeText,
+              orderOldProductAdds: oldList
+            }).then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          }else {
+            editData({
+              ...this.formData,
+              overTime: this.formData.overTime.length == 10 ? this.formData.overTime + ' 00:00:00' : this.formData.overTime,
+              orderSmallTypeText,
+              orderOldProductAdds: oldList
+            }).then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          }
+          
+        }
+      })
+    },
+
+    openDetail(type, id) {
+      this.$refs.tabPage.addTab({
+      	// 对应显示的模块
+      	activeKey: type,
+      	// 唯一标识
+      	key: type,
+      	// 页签名称
+      	label: ({ detail: '详情' })[type],
+      	// 打开时事件
+      	triggerEvent: () => {
+          this.pageType = type;
+      		this.formCancel()
+      		this.$nextTick(()=>{
+            this.detailTabs = 'a';
+            if (type == 'detail') {
+      				this.formDialogType = 0
+      			}
+            getDetail({ oldManagerId: id }).then(res => {
+              this.detailData = res.data;
+            })
+      		})
+      	},
+      	// 关闭时事件
+      	closeEvent: () => {
+			    this.detailCancel()
+      	}
+      })
+    },
+    detailCancel() {
+      this.formVisible = false
+      this.$refs?.examineForm?.resetFields()
+      this.$data.examineForm = this.$options.data().examineForm
+    },
+    detailConfirm(cancel) {
+      this.$refs.examineForm.validate((valid, invalidFields, errLabels) => {
+        if (valid) {
+          outData({
+            orderId: this.detailData.orderId,
+            examineStatus: this.examineFormData.status,
+            examineRemark: this.examineFormData.remark,
+          }).then(res => {
+            if(this.examineFormData.status == 'OK' && res.data.codeUrl) {
+              this.creatCode(res.data.codeUrl, this.detailData.orderId);
+            }else {
+              this.$message({ type: 'success', message: `审批成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            }
+          })
+        }
+      })
+    },
+
+    // 附件 - 上传成功
+    uploadSuccess(res, file) {
+      this.formData.fileUrl = res.data.url;
+    },
+
+    // 附件 - 上传前
+    beforeUpload(file) {
+      const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
+      const whiteList = ['jpg', 'jpeg', 'png'];
+      if (whiteList.indexOf(fileSuffix) === -1) {
+        this.$errorMsg('只支持上传jpg/png文件!');
+        return false;
+      }
+    },
+
+    getinitlbslist() {
+      // 初始化请求省市区街道下拉选项数据
+      lbsAmapRegion({ pid: 0 }).then(res => {
+        this.provinceList = res.data
+        if (this.formData.province) {
+          var provinceItem = this.provinceList.find(o => o.name === this.formData.province)
+          if (provinceItem) {
+            this.formData.provinceId = provinceItem.id
+          }
+          lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
+            this.cityList = res.data
+            if (this.formData.city) {
+              var cityItem = this.cityList.find(o => o.name === this.formData.city)
+              if (cityItem) {
+                this.formData.cityId = cityItem.id
+              }
+              lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
+                this.areaList = res.data
+                if (this.formData.area) {
+                  var areaItem = this.areaList.find(o => o.name === this.formData.area)
+                  if (areaItem) {
+                    this.formData.areaId = areaItem.id
+                  }
+                  lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
+                    this.streetList = res.data
+                    if (this.formData.street) {
+                      var streetItem = this.streetList.find(o => o.name === this.formData.street)
+                      if (streetItem) {
+                        this.formData.streetId = streetItem.id
+                      }
+                    }
+                  })
+                }
+              })
+            }
+          })
+        }
+      })
+    },
+
+    delDataK(num) {
+      if (num <= 1) {
+        // 删除市
+        this.formData.cityId = ''
+        this.formData.city = ''
+        // 删除市选项
+        this.cityList = []
+      }
+      if (num <= 2) {
+        // 删除区
+        this.formData.areaId = ''
+        this.formData.area = ''
+        // 删除区选项
+        this.areaList = []
+      }
+      if (num <= 3) {
+        // 删除街道
+        this.formData.streetId = ''
+        this.formData.street = ''
+        // 删除街道选项
+        this.streetList = []
+      }
+      // 删除gps地址
+      this.formData.gpsAddress = ''
+    },
+
+    // 更改省
+    changeProvince(val) {
+      // 获取省名称
+      this.formData.province = this.provinceList.find(item => item.id === val)?.name || ''
+      // 清除市区街道以及详细地址数据
+      this.delDataK(1)
+      lbsAmapRegion({ pid: val }).then(res => {
+        this.cityList = res.data
+      })
+    },
+
+    // 更改市
+    changeCity(val) {
+      // 获取市名称
+      this.formData.city = this.cityList.find(item => item.id === val).name
+      // 清除区街道以及详细地址数据
+      this.delDataK(2)
+      lbsAmapRegion({ pid: val }).then(res => {
+        this.areaList = res.data
+      })
+    },
+
+    // 更改区
+    changeArea(val) {
+      // 获取区名称
+      this.formData.area = this.areaList.find(item => item.id === val).name
+      // 清除街道以及详细地址数据
+      this.delDataK(3)
+      lbsAmapRegion({ pid: val }).then(res => {
+        this.streetList = res.data
+      })
+    },
+
+    // 更改街道
+    changeStreet(val) {
+      // 获取街道名称
+      this.formData.street = this.streetList.find(item => item.id === val).name
+      // 清除详细地址数据
+      this.delDataK(4)
+    },
+
+    selectAddress(data){
+      console.log(data);
+      this.formData.lng = data.center[0]
+      this.formData.lat = data.center[1]
+      // 获取定位的省市区街道
+      var { province, city, district, township } = data.data.addressComponent
+      // 获取选中省名称id
+      var { id, name } = this.provinceList.find(item => item.name === province)
+      this.formData.provinceId = id
+      this.formData.province = name
+      // 请求市选项
+      lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
+        // 赋值市选项
+        this.cityList = res.data
+        // 获取选中市名称id
+        var { id, name } = res.data.find(item => item.name === city)
+        this.formData.cityId = id
+        this.formData.city = name
+        // 请求区选项
+        lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
+          // 赋值区选项
+          this.areaList = res.data
+          // 获取选中区名称id
+          var { id, name } = res.data.find(item => item.name === district)
+          this.formData.areaId = id
+          this.formData.area = name
+          // 请求街道选项
+          lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
+            // 赋值街道选项
+            this.streetList = res.data
+            // 获取选中街道名称id
+            var { id, name } = res.data.find(item => item.name === township)
+            this.formData.streetId = id
+            this.formData.street = name
+            // 赋值GPS详细地址
+            this.formData.userAddress = data.name
+          })
+        })
+      })
+    },
+
+    batchOut() {
+      if (this.recordSelected && this.recordSelected.length > 0) {
+        let ids = []
+        this.recordSelected.forEach(value => {
+          ids.push(value.id)
+        })
+        outData({oldManagerId: ids.join(',')}).then(() => {
+          this.$message({ type: 'success', message: '出库成功!' })
+          this.$refs.pageRef.refreshList()
+        })
+      } else {
+        this.$errorMsg('请选择')
+      }
+    },
+
+    // 获取工单类型列表
+    getOrderTypeList() {
+      getOrderTypeList({
+        pageNum: 1,
+        pageSize: -1,
+        params: [{param: "a.status", compare: "=", value: true}]
+      }).then(res => {
+        this.orderTypeList = res.data.records;
+      })
+    },
+    
+    // 获取类目列表
+    getCategoryList() {
+      return new Promise((resolve, reject) => {
+        getCategoryList().then(res => {
+          this.mainList = res.data;
+          resolve(1);
+        })
+      })
+    },
+
+    // 获取规格/属性列表
+    getAttrList(smallId) {
+      getAttrList({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          {param: 'small_id', compare: '=', value: smallId},
+          {param: 'status', compare: '=', value: 'ON'}
+        ]
+      }).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 === "SIGIN") {
+        return !!list.filter(item => !!~vals.indexOf(item.id) && item.serviceCategoryId === data.serviceCategoryId).length
+      } else {
+        return false
+      }
+    },
+
+    // 添加旧机
+    addOld() {
+      if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
+
+      this.getCategoryList();
+      let obj = {
+        isEdit: true,
+        mainId: '',
+        mainName: '',
+        smallId: '',
+        smallName: '',
+        specId: '',
+        specName: '',
+        attrId: [],
+        attrName: [],
+        num: '',
+        payAmount: '',
+      }
+      let item = JSON.parse(JSON.stringify(obj));
+      this.oldList.push(item);
+    },
+
+    // 编辑旧机
+    async editOld(index, row) {
+      if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
+
+      this.oldList[index].isEdit = true;
+      await this.getCategoryList();
+      this.smallList = this.mainList.find(o => o.categoryId == row.mainId).children;
+      this.getAttrList(row.smallId);
+    },
+
+    // 保存旧机
+    saveOld(index) {
+      const data = this.oldList[index];
+      if(!data.mainId) return this.$errorMsg('请选择大类');
+      if(!data.smallId) return this.$errorMsg('请选择小类');
+      if(!data.specId) return this.$errorMsg('请选择规格型号');
+      if(!data.num) return this.$errorMsg('请输入数量');
+      if(!data.payAmount) return this.$errorMsg('请输入金额');
+
+      this.oldList[index].isEdit = false;
+      this.mainList = [];
+      this.smallList = [];
+      this.specList = [];
+      this.attrList = [];
+    },
+
+    // 删除旧机
+    deleteOld(index) {
+      this.oldList.splice(index, 1);
+    },
+
+    // 切换大类
+    changeMain(index, row) {
+      this.oldList[index].mainName = this.mainList.find(o => o.categoryId == row.mainId).name;
+      this.smallList = this.mainList.find(o => o.categoryId == row.mainId).children;
+
+      this.oldList[index].smallId = '';
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+    },
+
+    // 切换小类
+    changeSmall(index, row) {
+      this.oldList[index].smallName = this.smallList.find(o => o.categoryId == row.smallId).name;
+
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+      this.getAttrList(row.smallId);
+    },
+
+    // 切换规格
+    changeSpec(index, row) {
+      this.oldList[index].specName = this.specList.find(o => o.id == row.specId).dictName;
+    },
+
+    // 切换属性
+    changeAttr(index, row) {
+      let names = [];
+      // 遍历对象数组
+      this.attrList.forEach(obj => {
+        // 如果当前对象的ID在ID数组中
+        if (row.attrId.includes(obj.id)) {
+          // 将当前对象的name属性添加到names数组中
+          names.push(obj.dictName);
+        }
+      });
+      this.oldList[index].attrName = names;
+    },
+
+  }
+
+}
+</script>
+
+<style lang="scss">
+.specTable .el-table__cell {
+  padding: 0 !important;
+}
+
+// 图片墙
+.el-upload-list--picture-card .el-upload-list__item {
+  width: 100px;
+  height: 100px;
+}
+
+.el-upload--picture-card {
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+
+  .avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 100px;
+    height: 100px;
+    line-height: 100px;
+    text-align: center;
+  }
+}
+</style>

+ 347 - 54
src/views/mallManagement/order/offline_order_list/index.vue

@@ -16,7 +16,7 @@
 			</template-page>
 			<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="85px">
 
           <div style="font-weight: 500;">客户信息</div>
           <el-divider></el-divider>
@@ -61,7 +61,7 @@
                 <el-input v-model="formData.recePhone" autocomplete="off" placeholder="请输入客户电话"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="12">
+            <el-col :span="6">
               <el-form-item label="支付方式" prop="payType">
                 <el-radio-group v-model="formData.payType">
                   <el-radio label="WECHAT">微信支付</el-radio>
@@ -70,6 +70,14 @@
                 </el-radio-group>
               </el-form-item>
             </el-col>
+            <el-col :span="6">
+              <el-form-item label="是否以旧换新" prop="isOld" label-width="100px">
+                <el-radio-group v-model="formData.isOld" @change="changeOld">
+                  <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-form-item label="客户地址" prop="province" :required="true">
                 <el-row>
@@ -143,13 +151,17 @@
               </el-form-item>
             </el-col>
           </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>
           <el-table
             class="specTable"
@@ -247,7 +259,7 @@
             </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>
+                <el-input size="small" type="number" v-model="scope.row.num" :disabled="formData.isOld == 'YES'"></el-input>
               </template>
             </el-table-column>
             <el-table-column align="center" label="内机数量" prop="insideNum" min-width="120">
@@ -267,7 +279,7 @@
             </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>
+                <el-input size="small" type="number" v-model="scope.row.price"></el-input>
               </template>
             </el-table-column>
             <el-table-column align="center" label="金额" prop="amount" min-width="120">
@@ -281,17 +293,120 @@
               </template>
             </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">
                 <!-- <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-popconfirm>
               </template>
             </el-table-column>
           </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"
+                  @change="changeOldAttr(scope.$index, scope.row)"
+                  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"
+                  @change="changeOldAttr(scope.$index, scope.row)"
+                  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"></el-table-column>
+            <el-table-column align="center" label="金额" prop="payAmount" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" type="number" v-model="scope.row.payAmount"></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;">
 				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
 				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</el-button>
@@ -381,43 +496,72 @@
           </el-descriptions-item>
         </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" v-if="detailData.isOld == 'YES'"></el-tab-pane>
+        </el-tabs>
+
+        <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>
 
-        <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 == '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 style="font-weight: 500; margin-top: 20px;">审批信息</div>
@@ -470,7 +614,15 @@ import { lbsAmapRegion } from '@/api/common.js'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.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 operation_mixin from '@/components/template/operation_mixin.js'
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
@@ -547,6 +699,7 @@ export default {
         receUserName: '', // 客户名称
         recePhone: '', // 客户电话
         payType: 'WECHAT', // 支付方式
+        isOld: 'NO',
         lng: '',
         lat: '',
         province: '',
@@ -595,6 +748,15 @@ export default {
 			timer: '',
 
       pageType: '',
+
+      formTabs: 'a',
+      detailTabs: 'a',
+
+      oldList: [], // 旧机列表
+      categoryList: [],
+      specList: [],
+      attrList: [],
+
     }
   },
   computed: {
@@ -668,7 +830,7 @@ export default {
       return this.operationBtn({
         edit: {
           conditions: ({ row, index, column }) => {
-            return row.examineStatus != 'OK'
+            return row.examineStatus === 'WAIT'
           },
           btnType: 'text',
           click: ({ row, index, column }) => {
@@ -708,8 +870,10 @@ export default {
             this.getOrderTypeList();
             this.getGoodsSpecList();
             this.getGoodsList();
+            this.getCategoryList();
       			this.formType = type
       			this.formVisible = true
+            this.formTabs = 'a';
             if (type == 'add') {
       				this.formDialogType = 0
               this.getinitlbslist();
@@ -722,6 +886,21 @@ export default {
                   item.unit = item.goodsMaterialUnit;
                 })
                 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.goodsCategoryItemId),
+                      num: item.num,
+                      payAmount: item.payAmount,
+                    }
+                  })
+                  this.getAttrList(res.data.orderOldProductDTOList[0].smallId);
+                }
+                
       				  Object.assign(this.formData, res.data)
                 this.getinitlbslist();
       				})
@@ -735,6 +914,7 @@ export default {
       	}
       })
     },
+
     formCancel() {
       this.formVisible = false
       this.$refs?.formRef?.resetFields()
@@ -749,13 +929,35 @@ export default {
       this.formData.orderId = '';
       this.formData.fileUrl = '';
       this.goodsList = [];
+      this.oldList = [];
       this.$data.formRef = this.$options.data().formRef
     },
+
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         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;
-          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.payAmount
+            }
+          })
+
+          offlineOrderSave({
+            ...this.formData,
+            orderSmallTypeText,
+            orderDetails: this.goodsList,
+            orderOldProductAdds: this.formData.isOld == 'YES' ? oldList : []
+          }).then(res => {
             if(this.formData.payType == 'WECHAT' && this.formDialogType == 0) {
               offlineOrderExamine({
                 orderId: res.data,
@@ -793,6 +995,7 @@ export default {
           this.pageType = type;
       		this.formCancel()
       		this.$nextTick(()=>{
+            this.detailTabs = 'a';
             if (type == 'detail') {
       				this.formDialogType = 0
       			} else if(type == 'examine'){
@@ -1010,10 +1213,11 @@ export default {
     },
 
     // 获取商品列表
-    getGoodsList() {
+    getGoodsList(isOld = '') {
       getGoodsList({
         pageNum: 1,
         pageSize: -1,
+        isTrade: isOld
       }).then(res => {
         this.goodsSelectList = res.data.records;
       })
@@ -1046,7 +1250,7 @@ export default {
         goodsName: '', // 商品名称
         specsName: '', // 规格名称
         unit: '', // 单位
-        num: '', // 订单数量
+        num: this.formData.isOld == 'YES' ? 1 : '', // 订单数量
         insideNum: '', // 内机数量
         outNum: '', // 外机数量
         partsNum: '', // 配件数量
@@ -1168,6 +1372,7 @@ export default {
       }else{
         this.clear()
         this.$refs.tabPage.removeTab(this.pageType);
+        this.$refs.pageRef.refreshList()
         return 
       }
       getOfflineOrderDetail({orderId}).then(res => {
@@ -1192,6 +1397,94 @@ export default {
       clearTimeout(this.timer)
     },
 
+    changeOld() {
+      this.formTabs = 'a';
+      this.goodsList = [];
+      this.getGoodsList(this.formData.isOld);
+    },
+
+
+
+    // 获取类目列表
+    getCategoryList() {
+      getCategoryList().then(res => {
+        this.categoryList = res.data;
+      })
+    },
+
+    // 获取规格/属性列表
+    getAttrList(smallId) {
+      getAttrList({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          {param: 'small_id', compare: '=', value: smallId},
+          {param: 'status', compare: '=', value: 'ON'}
+        ]
+      }).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 === "SIGIN") {
+        return !!list.filter(item => !!~vals.indexOf(item.id) && item.serviceCategoryId === data.serviceCategoryId).length
+      } else {
+        return false
+      }
+    },
+
+    // 添加旧机
+    addOld() {
+      let obj = {
+        mainId: '',
+        smallId: '',
+        specId: '',
+        attrId: [],
+        num: 1,
+        payAmount: '',
+      }
+      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);
+    },
+
+    changeOldAttr(index, row) {
+      console.log(row);
+      let amount = 0;
+      let specItem = this.specList.find(o => o.id == row.specId);
+      amount = amount + specItem.price;
+      row.attrId.forEach(item => {
+        let attrItem = this.attrList.find(o => o.id == item);
+        amount = amount + attrItem.price;
+      })
+
+      this.oldList[index].payAmount = amount;
+    },
+
   }
 }
 </script>

+ 48 - 19
src/views/mallManagement/order/order_detail/index.vue

@@ -71,11 +71,12 @@
         </el-row>
       </div>
     </div>
-    <div class="order-receive-info" style="padding-bottom: 15px;">
+
+    <div class="order-receive-info">
       <el-row :gutter="30">
         <el-col :xs="24" :sm="12" :lg="12">
           <div class="main-detail">
-            <div class="title">订单信息</div>
+            <h3>订单信息</h3>
             <div class="item">
               <div class="label">收货人信息:</div>
               <div class="value">{{ orderDetail.receUserName }} ({{ orderDetail.recePhone }})</div>
@@ -129,24 +130,52 @@
           </div>
         </el-col>
       </el-row>
+    </div>
 
-
+    <div v-if="orderDetail.orderOldProductDTOList && orderDetail.orderOldProductDTOList.length > 0" style="margin-bottom: 30px;">
+      <h3>旧机信息</h3>
+      <div class="order-detail">
+        <!-- 回收 -->
+        <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;">
-      <!-- 理赔表格 -->
-      <el-table :data="compensateList" style="width: 100%;" size="small" border>
-        <el-table-column prop="goodsName" label="理赔商品" align="center"></el-table-column>
-        <el-table-column prop="num" label="理赔数量" align="center"></el-table-column>
-        <el-table-column prop="createTime" label="理赔时间" align="center"></el-table-column>
-        <el-table-column prop="refundAmount" label="理赔金额" align="center"></el-table-column>
-        <el-table-column prop="operatorUser" label="操作人" align="center"></el-table-column>
-        <el-table-column prop="remark" label="备注" align="center"></el-table-column>
-      </el-table>
+    <div v-if="compensateList.length > 0" style="margin-bottom: 30px;">
+      <h3>理赔信息</h3>
+      <div class="order-detail">
+        <!-- 理赔表格 -->
+        <el-table :data="compensateList" style="width: 100%;" size="small" border>
+          <el-table-column prop="goodsName" label="理赔商品" align="center"></el-table-column>
+          <el-table-column prop="num" label="理赔数量" align="center"></el-table-column>
+          <el-table-column prop="createTime" label="理赔时间" align="center"></el-table-column>
+          <el-table-column prop="refundAmount" label="理赔金额" align="center"></el-table-column>
+          <el-table-column prop="operatorUser" label="操作人" align="center"></el-table-column>
+          <el-table-column prop="remark" label="备注" align="center"></el-table-column>
+        </el-table>
+      </div>
     </div>
 
+    <h3>商品信息</h3>
     <div class="order-detail">
-
       <!-- 订单表格 -->
       <el-table :data="orderDetail.orderDetails" style="width: 100%" border>
         <el-table-column label="商品信息" min-width="200">
@@ -165,7 +194,7 @@
             </el-row>
           </template>
         </el-table-column>
-        <el-table-column prop="goodsSpecName" label="规格" align="center"></el-table-column>
+        <el-table-column prop="goodsSpecValue" label="规格" align="center"></el-table-column>
         <el-table-column prop="price" label="单价" align="center"></el-table-column>
         <el-table-column prop="num" label="数量" align="center"></el-table-column>
         <el-table-column prop="shareAmount" label="分销金额" align="center">
@@ -176,15 +205,15 @@
         <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="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">
             {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.profitAmount : scope.row.payAmount }}
           </template>
         </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="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="refundAmount" label="退款金额" align="center"></el-table-column>
         <el-table-column label="操作" align="center" width="160" v-if="orderDetail.orderStatus != 'CLOSE' && orderDetail.payTypeId == 'WECHAT'">
@@ -1209,7 +1238,7 @@ export default {
 }
 
 .order-receive-info {
-  margin: 15px 0;
+  margin: 15px 0 30px;
   padding: 15px;
   background: #f5f7fa;
 

+ 113 - 31
src/views/mallManagement/order/sales_return_order_list/index.vue

@@ -109,12 +109,21 @@
             </el-col>
           </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="b" v-if="joinCode"></el-tab-pane>
+            <el-tab-pane label="旧机信息" name="c" v-if="formData.isReturnOld === 'YES'"></el-tab-pane>
           </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
               class="specTable"
               :data="goodsList"
@@ -134,12 +143,12 @@
               </el-table-column>
               <el-table-column align="center" label="退货数量" prop="waitRefundNum" min-width="120">
                 <template slot-scope="scope">
-                  <el-input size="small" v-model="scope.row.waitRefundNum"></el-input>
+                  <el-input size="small" type="number" v-model="scope.row.waitRefundNum"></el-input>
                 </template>
               </el-table-column>
               <el-table-column align="center" label="退货单价" prop="waitRefundPrice" min-width="120">
                 <template slot-scope="scope">
-                  <el-input size="small" v-model="scope.row.waitRefundPrice"></el-input>
+                  <el-input size="small" type="number" v-model="scope.row.waitRefundPrice"></el-input>
                 </template>
               </el-table-column>
               <el-table-column align="center" label="退货金额" prop="amount" min-width="120">
@@ -168,7 +177,7 @@
               </el-table-column>
             </el-table>
           </div>
-          <div v-show="curTabs == 'b'">
+          <div v-show="formTabs == 'b'">
             <el-table
               class="specTable"
               :data="codeList"
@@ -191,7 +200,7 @@
               </el-table-column>
               <el-table-column align="center" label="条码" prop="materialCode" min-width="120"></el-table-column>
               <el-table-column align="center" label="数量" prop="stockQty" min-width="120"></el-table-column>
-              <el-table-column align="center" label="操作" min-width="100" fixed="right">
+              <el-table-column align="center" label="操作" min-width="100" fixed="right" v-if="codeList.length > 1">
                 <template slot-scope="scope">
                   <el-popconfirm title="确定删除吗?" @confirm="deleteCode(scope.$index)">
                     <el-button slot="reference" type="text">删除</el-button>
@@ -201,7 +210,30 @@
 
             </el-table>
           </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>
 				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
@@ -262,12 +294,13 @@
           </el-descriptions-item>
         </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="b" v-if="joinCode"></el-tab-pane>
+          <el-tab-pane label="旧机信息" name="c" v-if="detailData.isOld == 'YES'"></el-tab-pane>
         </el-tabs>
 
-        <div v-show="curTabs == 'a'">
+        <div v-show="detailTabs == 'a'">
           <el-table
             class="specTable"
             :data="detailData.orderOfflineRefundItems"
@@ -305,7 +338,7 @@
             <el-table-column align="center" label="订单金额" prop="payAmount" min-width="120"></el-table-column>
           </el-table>
         </div>
-        <div v-show="curTabs == 'b'">
+        <div v-show="detailTabs == 'b'">
           <el-table
             class="specTable"
             :data="detailData.orderOfflineItemCodes"
@@ -331,6 +364,30 @@
 
           </el-table>
         </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;">
 				  <el-button size="mini" @click="data.removeTab()">关 闭</el-button>
@@ -535,8 +592,13 @@ export default {
 
         remark: '', // 备注
         fileUrl: '', // 附件
+
+        isOld: 'NO',
+        isReturnOld: '',
+      },
+      formRules: {
+        isReturnOld: [{ required: true, message: '请选择是否退旧机', trigger: 'change' }],
       },
-      formRules: {},
       formType: 'add',
       formVisible: false,
 
@@ -544,7 +606,9 @@ export default {
       orderTypeList: [],
       goodsList: [],
       codeList: [],
-      curTabs: 'a',
+      oldList: [],
+      formTabs: 'a',
+      detailTabs: 'a',
 
       detailData: {},
 
@@ -598,6 +662,7 @@ export default {
         getOrderDetail({ orderId: this.$route.query.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;
@@ -610,6 +675,7 @@ export default {
             item.waitRefundPrice = item.price;
           })
           this.goodsList = data.orderDetails;
+          this.oldList = data.orderOldProductDTOList;
         })
         getOrderCodeList({orderId: this.$route.query.orderId}).then(res => {
           this.codeList = res.data;
@@ -692,6 +758,7 @@ export default {
             // this.getOrderTypeList();
       			this.formType = type
       			this.formVisible = true
+            this.formTabs = 'a';
             if (type == 'add') {
       				this.formDialogType = 0
               this.formData.companyWechatName = this.name;
@@ -723,6 +790,9 @@ export default {
                 this.goodsList = data.orderOfflineRefundItems;
                 this.codeList = data.orderOfflineItemCodes;
       				  // Object.assign(this.formData, res.data)
+
+                this.formData.isReturnOld = data.isOld;
+                this.oldList = data.orderOldProductDTOList;
       				})
       			}
       		})
@@ -758,7 +828,9 @@ export default {
                 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 => {
             this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
             cancel('list')
@@ -781,6 +853,7 @@ export default {
           this.pageType = type;
       		this.formCancel()
       		this.$nextTick(()=>{
+            this.detailTabs = 'a';
             if (type == 'detail') {
       				this.formDialogType = 0
       			} else if(type == 'examine'){
@@ -884,26 +957,30 @@ export default {
       if(this.waitChooseOrder.length > 1) {
         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);
     },
 
+    // 删除旧机
+    deleteOld(index) {
+      this.oldList.splice(index, 1);
+    },
+
     // 获取工单类型列表
     getOrderTypeList() {
       getOrderTypeList({