Browse Source

feat:旧机管理

Moss 1 year ago
parent
commit
6ac6c19e6f

+ 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
+  })
+}

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

@@ -0,0 +1,932 @@
+<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">
+        <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="companyWechatName">
+                <el-input v-model="formData.companyWechatName" autocomplete="off" placeholder="请输入所属商户" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="销售类型" prop="salesType">
+                <el-radio-group v-model="formData.salesType" disabled>
+                  <el-radio :label="''">线下销售</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="pgOrderType">
+                <el-select v-model="formData.pgOrderType" 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)">
+                  <el-option
+                    v-for="item in categoryList"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="小类" prop="smallId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.smallId"
+                  filterable
+                  placeholder="请选择"
+                  @change="changeSmall(scope.$index, scope.row)">
+                  <el-option
+                    v-for="item in scope.row.mainId ? categoryList.find(o => o.categoryId == scope.row.mainId).children : []"
+                    :key="item.categoryId"
+                    :label="item.name"
+                    :value="item.categoryId">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="规格型号" prop="specId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.specId"
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in specList"
+                    :key="item.id"
+                    :label="item.dictName"
+                    :value="item.id">
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="属性" prop="attrId" min-width="160">
+              <template slot-scope="scope">
+                <el-select
+                  size="small"
+                  v-model="scope.row.attrId"
+                  multiple
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in attrList"
+                    :key="item.id"
+                    :label="item.dictName"
+                    :value="item.id"
+                    :disabled="panduanduoxuandanxuan(attrList, item, scope.row.attrId) && !~scope.row.attrId.indexOf(item.id)">
+                    {{ `${item.categoryName} - ${item.dictName}` }}
+                  </el-option>
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="单位" min-width="120">
+              <template>台</template>
+            </el-table-column>
+            <el-table-column align="center" label="数量" prop="num" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" v-model="scope.row.num"></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column align="center" label="金额" prop="price" min-width="120">
+              <template slot-scope="scope">
+                <el-input size="small" v-model="scope.row.price"></el-input>
+              </template>
+            </el-table-column>
+
+            <el-table-column align="center" label="操作" min-width="120" fixed="right">
+              <template slot-scope="scope">
+                <!-- <el-button type="text" @click="edit('theory', scope.$index)">编辑</el-button> -->
+                <el-popconfirm title="确定删除吗?" @confirm="deleteOld(scope.$index)">
+                  <el-button slot="reference" type="text">删除</el-button>
+                </el-popconfirm>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        
+				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
+				  <el-button size="mini" @click="data.removeTab()">取 消</el-button>
+				  <el-button size="mini" @click="formConfirm(data.removeTab)" type="primary">确 定</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: {
+        companyWechatName: '', // 所属商户
+        salesType: '', // 销售类型
+        orderId: '', // 订单编号
+        pgOrderType: '', // 工单类型
+        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: [], // 旧机列表
+      categoryList: [],
+      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.examineStatus != 'OK'
+          // },
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openForm('edit', row.id)
+          }
+        },
+        detail: {
+          btnType: 'text',
+          click: ({ row, index, column }) => {
+            this.openDetail('detail', row.id)
+          }
+        },
+        out: {
+          btnType: 'text',
+          prompt: '确定出库吗?',
+          click: ({ row, index, column }) => {
+            outData({ oldManagerId: row.id }).then(() => {
+              this.$message({ type: 'success', message: '出库成功!' })
+              this.$refs.pageRef.refreshList()
+            })
+          }
+        },
+      })
+    },
+    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.getCategoryList();
+      			this.formType = type
+      			this.formVisible = true
+            if (type == 'add') {
+      				this.formDialogType = 0
+              this.formData.companyWechatName = this.name;
+              this.getinitlbslist();
+      			} else if(type == 'edit'){
+      				this.formDialogType = 1
+      				getDetail({ oldManagerId: id }).then(res => {
+                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,
+                      price: item.payAmount,
+                    }
+                  })
+                  this.getAttrList(res.data.orderOldProductDTOList[0].smallId);
+                }
+                
+      				  Object.assign(this.formData, res.data)
+                this.getinitlbslist();
+      				})
+      			}
+      		})
+      	},
+      	// 关闭时事件
+      	closeEvent: () => {
+			    this.formCancel()
+      	}
+      })
+    },
+
+    formCancel() {
+      this.formVisible = false
+      this.$refs?.formRef?.resetFields()
+      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) {
+          let oldList = this.oldList.map(item => {
+            return {
+              id: item.specId,
+              itemIds: item.attrId,
+              num: item.num,
+              payAmount: item.price
+            }
+          })
+
+          if(this.formDialogType == 0) {
+            addData({
+              ...this.formData,
+              orderOldProductAdds: oldList
+            }).then(res => {
+              this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            })
+          }else {
+            editData({
+              ...this.formData,
+              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({ 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() {
+      getCategoryList().then(res => {
+        this.categoryList = res.data;
+      })
+    },
+
+    // 获取规格/属性列表
+    getAttrList(smallId) {
+      getAttrList({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          {param: 'small_id', compare: '=', value: smallId},
+          // {param: 'type_attribute', compare: '=', value: 'SPEC'}
+        ]
+      }).then(res => {
+        this.specList = res.data.records.filter(o => o.typeAttribute == 'SPEC');
+        this.attrList = res.data.records.filter(o => o.typeAttribute == 'OTHER');
+      })
+    },
+
+    panduanduoxuandanxuan(list, data, vals) {
+      if (data.typeOption === "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: '',
+        price: '',
+      }
+      let item = JSON.parse(JSON.stringify(obj));
+      this.oldList.push(item);
+    },
+
+    // 删除旧机
+    deleteOld(index) {
+      this.oldList.splice(index, 1);
+    },
+
+    // 切换大类
+    changeMain(index, row) {
+      this.oldList[index].smallId = '';
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+    },
+
+    // 切换小类
+    changeSmall(index, row) {
+      this.oldList[index].specId = '';
+      this.oldList[index].attrId = [];
+      this.specList = [];
+      this.attrList = [];
+      this.getAttrList(row.smallId);
+    },
+
+  }
+
+}
+</script>
+
+<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>

+ 36 - 18
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="100px">
+				<el-form ref="formRef" :model="formData" :rules="formRules" label-position="left" label-width="85px">
 
           <div style="font-weight: 500;">客户信息</div>
           <el-divider></el-divider>
@@ -71,8 +71,8 @@
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item label="是否以旧换新" prop="isOld">
-                <el-radio-group v-model="formData.isOld" @change="() => {formTabs = 'a'}">
+              <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>
@@ -259,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"></el-input>
               </template>
             </el-table-column>
             <el-table-column align="center" label="内机数量" prop="insideNum" min-width="120">
@@ -279,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">
@@ -356,6 +356,7 @@
                 <el-select
                   size="small"
                   v-model="scope.row.specId"
+                  @change="changeOldAttr(scope.$index, scope.row)"
                   placeholder="请选择">
                   <el-option
                     v-for="item in specList"
@@ -371,6 +372,7 @@
                 <el-select
                   size="small"
                   v-model="scope.row.attrId"
+                  @change="changeOldAttr(scope.$index, scope.row)"
                   multiple
                   placeholder="请选择">
                   <el-option
@@ -387,14 +389,10 @@
             <el-table-column align="center" label="单位" min-width="120">
               <template>台</template>
             </el-table-column>
-            <el-table-column align="center" label="数量" prop="num" min-width="120">
-              <template slot-scope="scope">
-                <el-input size="small" v-model="scope.row.num"></el-input>
-              </template>
-            </el-table-column>
-            <el-table-column align="center" label="金额" prop="price" min-width="120">
+            <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" v-model="scope.row.price"></el-input>
+                <el-input size="small" type="number" v-model="scope.row.payAmount"></el-input>
               </template>
             </el-table-column>
 
@@ -897,7 +895,7 @@ export default {
                       specId: item.specId,
                       attrId: item.itemList.map(o => o.goodsCategoryItemId),
                       num: item.num,
-                      price: item.payAmount,
+                      payAmount: item.payAmount,
                     }
                   })
                   this.getAttrList(res.data.orderOldProductDTOList[0].smallId);
@@ -950,7 +948,7 @@ export default {
               id: item.specId,
               itemIds: item.attrId,
               num: item.num,
-              payAmount: item.price
+              payAmount: item.payAmount
             }
           })
 
@@ -1215,10 +1213,11 @@ export default {
     },
 
     // 获取商品列表
-    getGoodsList() {
+    getGoodsList(isOld = 'NO') {
       getGoodsList({
         pageNum: 1,
         pageSize: -1,
+        isTrade: isOld
       }).then(res => {
         this.goodsSelectList = res.data.records;
       })
@@ -1398,6 +1397,12 @@ export default {
       clearTimeout(this.timer)
     },
 
+    changeOld() {
+      this.formTabs = 'a';
+      this.goodsList = [];
+      this.getGoodsList(this.formData.isOld);
+    },
+
 
 
     // 获取类目列表
@@ -1423,7 +1428,7 @@ export default {
     },
 
     panduanduoxuandanxuan(list, data, vals) {
-      if (data.typeOption === "SINGLE") {
+      if (data.typeOption === "SIGIN") {
         return !!list.filter(item => !!~vals.indexOf(item.id) && item.serviceCategoryId === data.serviceCategoryId).length
       } else {
         return false
@@ -1437,8 +1442,8 @@ export default {
         smallId: '',
         specId: '',
         attrId: [],
-        num: '',
-        price: '',
+        num: 1,
+        payAmount: '',
       }
       let item = JSON.parse(JSON.stringify(obj));
       this.oldList.push(item);
@@ -1467,6 +1472,19 @@ export default {
       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>

+ 2 - 2
src/views/mallManagement/order/sales_return_order_list/index.vue

@@ -143,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">