commerce_form.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">工程订单</div>
  6. </div>
  7. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-width="110px" size="small" label-position="right">
  8. <el-row :gutter="20">
  9. <el-col :xs="24" :sm="12" :lg="8">
  10. <el-form-item label="工程订单" prop="orderNum">
  11. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  15. <el-form-item label="单据日期" prop="orderDate">
  16. <el-date-picker
  17. v-model="mainForm.orderDate"
  18. disabled
  19. type="date"
  20. value-format="yyyy-MM-dd"
  21. style="width: 100%;"
  22. placeholder="系统自动生成">
  23. </el-date-picker>
  24. </el-form-item>
  25. </el-col>
  26. <!-- <el-col :xs="24" :sm="12" :lg="8">
  27. <el-form-item label="产品大类" prop="type">
  28. <el-select v-model="mainForm.type" placeholder="选择产品大类" style="width: 100%" disabled>
  29. <el-option v-for="item in typeList" :key="item.dictCode" :label="item.dictValue" :value="item.dictCode"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col> -->
  33. </el-row>
  34. <el-row :gutter="20">
  35. <el-col :xs="24" :sm="12" :lg="8">
  36. <el-form-item label="经销商编码" prop="jxsNum">
  37. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :xs="24" :sm="12" :lg="16">
  41. <el-form-item label="经销商名称" prop="jxsName">
  42. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
  43. </el-form-item>
  44. </el-col>
  45. <el-col :xs="24" :sm="12" :lg="8">
  46. <el-form-item label="工程信息单号" prop="enginNum">
  47. <div style="display: flex;">
  48. <el-input v-model="mainForm.enginNum" placeholder="请引用工程登录" disabled></el-input>
  49. <el-button style="margin-left: 10px;" @click="openShareDetail">引用</el-button>
  50. </div>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :xs="24" :sm="12" :lg="8">
  54. <el-form-item label="工程项目名称" prop="enginName">
  55. <el-input v-model="mainForm.enginName" placeholder="请输入工程项目名称" disabled></el-input>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :xs="24" :sm="12" :lg="8">
  59. <el-form-item label="工程登录类型" prop="loginType">
  60. <el-input v-model="mainForm.loginType" placeholder="请输入工程登录类型" disabled></el-input>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :xs="24" :sm="12" :lg="8">
  64. <el-form-item label="厂工程编码" prop="factoryNum">
  65. <el-input v-model="mainForm.factoryNum" placeholder="请输入厂工程编码"></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :xs="24" :sm="12" :lg="8">
  69. <el-form-item label="使用单位" prop="company">
  70. <el-input v-model="mainForm.company" placeholder="请输入使用单位" disabled></el-input>
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. <el-row :gutter="20">
  75. <el-col :xs="24" :sm="12" :lg="8">
  76. <el-form-item label="联系人" prop="contactMan">
  77. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" disabled></el-input>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :xs="24" :sm="12" :lg="8">
  81. <el-form-item label="固定电话" prop="tel">
  82. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" disabled></el-input>
  83. </el-form-item>
  84. </el-col>
  85. <el-col :xs="24" :sm="12" :lg="8">
  86. <el-form-item label="移动电话" prop="phone">
  87. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" disabled></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :xs="24" :sm="24" :lg="24">
  91. <el-form-item label="安装地址" prop="address">
  92. <el-input v-model="mainForm.address" placeholder="请输入安装地址" disabled></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :xs="24" :sm="24" :lg="24">
  96. <el-form-item label="格力内部备注" prop="greeRemark">
  97. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注"></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :xs="24" :sm="24" :lg="24">
  101. <el-form-item label="格力回复" prop="greeReply">
  102. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :xs="24" :sm="24" :lg="24">
  106. <el-form-item label="备注" prop="remark">
  107. <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
  108. </el-form-item>
  109. </el-col>
  110. <el-col :xs="24" :sm="12" :lg="8">
  111. <el-form-item label="制单人" prop="createMan">
  112. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  116. <el-form-item label="制单日期" prop="createDate">
  117. <el-date-picker
  118. v-model="mainForm.createDate"
  119. disabled
  120. type="date"
  121. value-format="yyyy-MM-dd"
  122. style="width: 100%;"
  123. placeholder="选择日期">
  124. </el-date-picker>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :xs="24" :sm="12" :lg="8">
  128. <el-form-item label="文件编号" prop="fileNum">
  129. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
  130. </el-form-item>
  131. </el-col>
  132. </el-row>
  133. </el-form>
  134. <div class="main-title">
  135. <div class="title">货品信息</div>
  136. <div>
  137. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
  138. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  139. </el-select>
  140. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  141. </div>
  142. </div>
  143. <div class="table" style="margin-top: 20px">
  144. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  145. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  146. <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
  147. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  148. <el-table-column align="center" label="产品编码" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
  149. <el-table-column align="center" label="物料代码" prop="materialOldNumber" min-width="160" show-overflow-tooltip></el-table-column>
  150. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  151. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  152. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  153. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
  154. <el-table-column align="center" label="工程信息数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
  155. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  156. <template slot-scope="scope">
  157. <el-input v-model="scope.row.qty" size="small"></el-input>
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
  161. <template slot-scope="scope">
  162. {{scope.row.price * scope.row.qty}}
  163. </template>
  164. </el-table-column>
  165. <el-table-column align="center" label="返利钱包" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  166. <template slot-scope="scope">
  167. <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利类型" size="small" clearable @change="changeFlWallet(scope.$index)">
  168. <el-option
  169. v-for="item in scope.row.rebateWallets"
  170. :key="item.customerWalletId"
  171. :label="item.customerWalletName"
  172. :value="item.customerWalletId">
  173. </el-option>
  174. </el-select>
  175. </template>
  176. </el-table-column>
  177. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
  178. <template slot-scope="scope">
  179. {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
  180. </template>
  181. </el-table-column>
  182. <el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
  183. <template slot-scope="scope">
  184. {{scope.row.qty * scope.row.discAmount}}
  185. </template>
  186. </el-table-column>
  187. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  188. <template slot-scope="scope">
  189. <el-select v-model="scope.row.customerWalletId" placeholder="选择现金钱包" size="small" clearable @change="changeXjWallet(scope.$index)">
  190. <el-option
  191. v-for="item in scope.row.wallets"
  192. :key="item.customerWalletId"
  193. :label="item.customerWalletName"
  194. :value="item.customerWalletId">
  195. </el-option>
  196. </el-select>
  197. </template>
  198. </el-table-column>
  199. <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
  200. <template slot-scope="scope">
  201. {{((scope.row.price * scope.row.qty) * 100 - ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 - ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) / 100}}
  202. </template>
  203. </el-table-column>
  204. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  205. <template slot-scope="scope">
  206. <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
  207. </template>
  208. </el-table-column>
  209. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
  210. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
  211. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  212. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  213. <template slot-scope="scope">
  214. <el-input v-model="scope.row.remark" size="small"></el-input>
  215. </template>
  216. </el-table-column>
  217. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
  218. <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  219. <template slot-scope="scope">
  220. <div>{{ scope.row.status1 | status1Filter }}</div>
  221. </template>
  222. </el-table-column>
  223. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  224. <template slot-scope="scope">
  225. <div>{{ status2Filter(scope.row) }}</div>
  226. </template>
  227. </el-table-column>
  228. <el-table-column align="center" label="操作" width="100" fixed="right">
  229. <template slot-scope="scope">
  230. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  231. </template>
  232. </el-table-column>
  233. </el-table>
  234. </div>
  235. <div class="page-footer">
  236. <div class="footer">
  237. <el-button type="primary" @click="clickSubmitForm(1)">保 存</el-button>
  238. <el-button type="primary" @click="clickSubmitForm(2)">提交审核</el-button>
  239. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  240. <el-button slot="reference">关 闭</el-button>
  241. </el-popconfirm>
  242. </div>
  243. </div>
  244. <!-- 工程登录列表 -->
  245. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  246. <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
  247. <el-row :gutter="20">
  248. <el-col :xs="24" :sm="12" :lg="6">
  249. <el-form-item prop="enginNum">
  250. <el-input v-model="screenForm.enginNum" placeholder="工程信息单"></el-input>
  251. </el-form-item>
  252. </el-col>
  253. <el-col :xs="24" :sm="12" :lg="6">
  254. <el-form-item prop="enginName">
  255. <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
  256. </el-form-item>
  257. </el-col>
  258. <el-col :xs="24" :sm="12" :lg="6">
  259. <el-form-item prop="company">
  260. <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
  261. </el-form-item>
  262. </el-col>
  263. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  264. <el-form-item label="">
  265. <el-button size="small" @click="resetScreenForm">清空</el-button>
  266. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  267. </el-form-item>
  268. </el-col>
  269. </el-row>
  270. </el-form>
  271. <div class="table" style="margin: 10px 0 20px;">
  272. <el-table
  273. v-loading="dialogTable_listLoading"
  274. :data="dialogTable_dataList"
  275. element-loading-text="Loading"
  276. tooltip-effect="dark"
  277. style="width: 100%"
  278. max-height="270">
  279. <el-table-column align="center" label="" width="100">
  280. <template slot-scope="scope">
  281. <el-button type="primary" size="small" @click="chooseItem(scope.row.enginInfoNo)">选择</el-button>
  282. </template>
  283. </el-table-column>
  284. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
  285. <el-table-column align="center" prop="enginInfoNo" label="工程信息单" show-overflow-tooltip></el-table-column>
  286. <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
  287. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
  288. </el-table>
  289. </div>
  290. <div class="pagination clearfix">
  291. <div class="fr">
  292. <el-pagination
  293. @current-change="dialogTableCurrentChange"
  294. :current-page="dialogTable_currentPage"
  295. :page-size="dialogTable_pageSize"
  296. background
  297. layout="prev, pager, next"
  298. :total="dialogTable_listTotal">
  299. </el-pagination>
  300. </div>
  301. </div>
  302. <div slot="footer" class="dialog-footer">
  303. <el-button @click="isShowDialog = false">关 闭</el-button>
  304. </div>
  305. </el-dialog>
  306. </div>
  307. </template>
  308. <script>
  309. import { getOrderDetail, getComLoginList, getComLoginDetail, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
  310. import { getDictList, getTypeList } from '@/api/common'
  311. let that
  312. export default {
  313. name: 'CommerceForm',
  314. componentName: 'CommerceForm',
  315. props: ['listItem'],
  316. filters: {
  317. status1Filter(val) {
  318. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  319. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  320. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  321. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  322. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  323. if (val === '' || val === null || val === undefined) return '未检查';
  324. else if (val === 0) return '无货';
  325. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  326. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  327. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  328. },
  329. },
  330. data() {
  331. return {
  332. editId: '',
  333. mainForm: {
  334. orderNum: '',
  335. orderDate: '',
  336. // type: '',
  337. jxsNum: '',
  338. jxsName: '',
  339. enginNum: '',
  340. enginName: '',
  341. loginType: '',
  342. factoryNum: '',
  343. company: '',
  344. contactMan: '',
  345. tel: '',
  346. phone: '',
  347. address: '',
  348. greeRemark: '',
  349. greeReply: '',
  350. remark: '',
  351. createMan: '',
  352. createDate: '',
  353. fileNum: '',
  354. },
  355. mainFormRules: {
  356. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  357. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  358. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  359. enginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  360. enginName: [{ required: true, message: '请输入工程项目名称', trigger: 'blur' }],
  361. loginType: [{ required: true, message: '请输入工程登录类型', trigger: 'blur' }],
  362. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  363. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  364. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  365. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  366. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  367. },
  368. // typeList: [],
  369. stockList: [],
  370. goodsList: [],
  371. isShowDialog: false, // 工程登录列表 - 弹窗
  372. screenForm: {
  373. enginNum: '',
  374. enginName: '',
  375. company: '',
  376. },
  377. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  378. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  379. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  380. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  381. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  382. warehouseList: [],
  383. warehouseValue: '',
  384. }
  385. },
  386. beforeCreate() {
  387. that = this;
  388. },
  389. created() {
  390. this.getDictList();
  391. this.getWarehouseList();
  392. if(this.listItem) {
  393. this.editId = this.listItem.parentId;
  394. this.getDetail();
  395. }else {
  396. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
  397. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  398. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  399. this.mainForm.createDate = this.getDate();
  400. }
  401. },
  402. methods: {
  403. // 返回列表
  404. goBack() {
  405. this.$emit('backListFormDetail');
  406. },
  407. getDate() {
  408. var date = new Date();
  409. var seperator1 = "-";
  410. var year = date.getFullYear();
  411. var month = date.getMonth() + 1;
  412. var strDate = date.getDate();
  413. if (month >= 1 && month <= 9) {
  414. month = "0" + month;
  415. }
  416. if (strDate >= 0 && strDate <= 9) {
  417. strDate = "0" + strDate;
  418. }
  419. var currentdate = year + seperator1 + month + seperator1 + strDate;
  420. return currentdate;
  421. },
  422. // 获取产品大类列表
  423. getDictList() {
  424. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  425. // this.typeList = res.data;
  426. // })
  427. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  428. this.stockList = res.data;
  429. })
  430. },
  431. // 获取仓库列表
  432. getWarehouseList() {
  433. getWarehouseList({
  434. pageNum: 1,
  435. pageSize: -1
  436. }).then((res) => {
  437. this.warehouseList = res.data.records;
  438. })
  439. },
  440. // 获取详情
  441. getDetail() {
  442. getOrderDetail({id: this.editId}).then(res => {
  443. let data = res.data;
  444. this.mainForm.orderNum = data.enginOrderId;
  445. this.mainForm.orderDate = data.orderDate;
  446. // this.mainForm.type = data.mainId;
  447. this.mainForm.jxsNum = data.customerId;
  448. this.mainForm.jxsName = data.customerName;
  449. this.mainForm.enginNum = data.refEnginRecordNo;
  450. this.mainForm.enginName = data.refProjectName;
  451. this.mainForm.loginType = data.refPromiseStatus;
  452. this.mainForm.factoryNum = data.refFactoryNo;
  453. this.mainForm.company = data.refUseUnit;
  454. this.mainForm.saleType = data.saleTypeId;
  455. this.mainForm.contactMan = data.refLinkman;
  456. this.mainForm.tel = data.refTel;
  457. this.mainForm.phone = data.refPhone;
  458. this.mainForm.address = data.refInstallAddress;
  459. this.mainForm.greeRemark = data.note2;
  460. this.mainForm.greeReply = data.note1;
  461. this.mainForm.remark = data.remark;
  462. this.mainForm.createMan = data.createName;
  463. this.mainForm.createDate = data.createTime;
  464. this.mainForm.fileNum = data.fileNo;
  465. data.items.forEach(item => {
  466. item.status1 = '';
  467. item.status2 = '';
  468. item.rebateWallets = item.customerWalletList.filter(item => {
  469. return item.type === 'REBATE';
  470. });
  471. item.wallets = item.customerWalletList.filter(item => {
  472. return item.type === 'COMMONLY';
  473. });
  474. })
  475. this.goodsList = data.items;
  476. })
  477. },
  478. // 工程登录列表 - 获取列表
  479. getComLoginList() {
  480. getComLoginList({
  481. pageNum: this.dialogTable_currentPage,
  482. pageSize: this.dialogTable_pageSize,
  483. enginInfoNo: this.screenForm.enginNum,
  484. projectName: this.screenForm.enginName,
  485. useUnit: this.screenForm.company,
  486. examineStatus: 'OK'
  487. }).then(res => {
  488. this.dialogTable_dataList = res.data.records;
  489. this.dialogTable_listTotal = res.data.total;
  490. this.dialogTable_listLoading = false;
  491. })
  492. },
  493. // 工程登录列表 - 打开弹窗
  494. openShareDetail() {
  495. this.isShowDialog = true;
  496. this.dialogTable_currentPage = 1;
  497. this.getComLoginList();
  498. },
  499. // 工程登录列表 - 更改列表当前页
  500. dialogTableCurrentChange(val) {
  501. this.dialogTable_currentPage = val;
  502. this.getComLoginList();
  503. },
  504. // 提交筛选表单
  505. submitScreenForm() {
  506. this.dialogTable_currentPage = 1;
  507. this.getComLoginList();
  508. },
  509. // 重置筛选表单
  510. resetScreenForm() {
  511. this.$refs.screenForm.resetFields();
  512. this.dialogTable_currentPage = 1;
  513. this.getComLoginList();
  514. },
  515. // 选择工程登录
  516. chooseItem(id) {
  517. getComLoginDetail({
  518. recordNo: id
  519. }).then(res => {
  520. this.isShowDialog = false;
  521. let data = res.data;
  522. // this.mainForm.type = data.mainId;
  523. this.mainForm.enginNum = data.enginInfoNo;
  524. this.mainForm.enginName = data.projectName;
  525. this.mainForm.loginType = data.enginSignType;
  526. this.mainForm.company = data.useUnit;
  527. this.mainForm.contactMan = data.linkman;
  528. this.mainForm.tel = data.tel;
  529. this.mainForm.phone = data.phone;
  530. this.mainForm.address = data.installAddress;
  531. this.goodsList = data.items.map(item => {
  532. return {
  533. useRefCount: '',
  534. saleTypeId: item.saleTypeId,
  535. saleTypeCode: item.saleTypeCode,
  536. saleTypeName: item.saleTypeName,
  537. materialId: item.materialId,
  538. materialNumber: item.materialNumber,
  539. materialOldNumber: item.materialOldNumber,
  540. materialName: item.materialName,
  541. specification: item.specification,
  542. unit: item.unit,
  543. price: item.price,
  544. enginNum: '',
  545. qty: item.qty,
  546. customerWalletId2: '',
  547. rebateRate: '',
  548. discAmount: '',
  549. customerWalletId: '',
  550. isDirectTransfer: false,
  551. directTransferQty: '',
  552. hasSendQty: '',
  553. remark: item.remark,
  554. tax: item.taxRate,
  555. status1: '',
  556. status2: '',
  557. rebateWallets: item.customerWalletList.filter(item => {
  558. return item.type === 'REBATE';
  559. }),
  560. wallets: item.customerWalletList.filter(item => {
  561. return item.type === 'COMMONLY';
  562. }),
  563. }
  564. })
  565. })
  566. },
  567. // 删除产品
  568. deleteItem(index) {
  569. this.goodsList.splice(index, 1);
  570. },
  571. // 修改返利钱包
  572. changeFlWallet(index) {
  573. if(this.goodsList[index].customerWalletId2) {
  574. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  575. this.goodsList[index].rebateRate = obj.rebateRate;
  576. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  577. }else {
  578. this.goodsList[index].rebateRate = '';
  579. this.goodsList[index].customerWalletName2 = '';
  580. }
  581. },
  582. // 修改现金钱包
  583. changeXjWallet(index) {
  584. if(this.goodsList[index].customerWalletId) {
  585. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  586. this.goodsList[index].customerWalletName = obj.customerWalletName;
  587. }else {
  588. this.goodsList[index].customerWalletName = '';
  589. }
  590. },
  591. // 检查库存
  592. checkStock() {
  593. if(!this.warehouseValue) {
  594. return this.$errorMsg('请选择仓库');
  595. }
  596. if(!this.goodsList) {
  597. return this.$errorMsg('请添加货品');
  598. }
  599. let ids = [];
  600. this.goodsList.forEach(item => {
  601. ids.push(item.materialId);
  602. })
  603. checkStock({
  604. correspondId: this.warehouseValue,
  605. materialId: ids.join(',')
  606. }).then(res => {
  607. if(res.data) {
  608. this.goodsList.forEach((item, index) => {
  609. item.status1 = res.data[index].allStockNum;
  610. item.status2 = res.data[index].stockNum;
  611. })
  612. }
  613. })
  614. },
  615. status2Filter(item) {
  616. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  617. else if (item.status2 >= item.qty) return '可用';
  618. else return '短缺';
  619. },
  620. // 保存 / 提交审核
  621. clickSubmitForm(type) {
  622. this.$refs.mainForm.validate((valid) => {
  623. if (valid) {
  624. for(let i=0; i<this.goodsList.length; i++) {
  625. if(!this.goodsList[i].customerWalletId) {
  626. this.$errorMsg('请选择现金钱包');
  627. return;
  628. }
  629. }
  630. this.goodsList.forEach(item => {
  631. delete item.rebateWallets;
  632. delete item.wallets;
  633. })
  634. let params = {
  635. enginOrderId: this.mainForm.orderNum,
  636. // orderDate: this.mainForm.orderDate,
  637. // mainId: this.mainForm.type || '',
  638. refEnginRecordNo: this.mainForm.enginNum || '',
  639. refProjectName: this.mainForm.enginName || '',
  640. refPromiseStatus: this.mainForm.loginType || '',
  641. refFactoryNo: this.mainForm.factoryNum || '',
  642. refUseUnit: this.mainForm.company || '',
  643. refLinkman: this.mainForm.contactMan || '',
  644. refTel: this.mainForm.tel || '',
  645. refPhone: this.mainForm.phone || '',
  646. refInstallAddress: this.mainForm.address || '',
  647. note2: this.mainForm.greeRemark || '',
  648. note1: this.mainForm.greeReply || '',
  649. remark: this.mainForm.remark || '',
  650. fileNo: this.mainForm.fileNum || '',
  651. items: this.goodsList,
  652. }
  653. if(type === 1) {
  654. if(this.listItem) {
  655. editCom(params).then(res => {
  656. this.$successMsg('编辑成功');
  657. this.goBack();
  658. this.$parent.getList();
  659. })
  660. }else {
  661. addCom(params).then(res => {
  662. this.$successMsg('新增成功');
  663. this.goBack();
  664. this.$parent.getList();
  665. })
  666. }
  667. }else if(type === 2) {
  668. submitCom(params).then(res => {
  669. this.$successMsg('提交审核成功');
  670. this.goBack();
  671. this.$parent.getList();
  672. })
  673. }
  674. }
  675. })
  676. },
  677. }
  678. }
  679. </script>
  680. <style scoped lang="scss">
  681. .detail-container {
  682. width: 100%;
  683. height: 100%;
  684. }
  685. .main-title {
  686. display: flex;
  687. justify-content: space-between;
  688. align-items: center;
  689. margin-top: 20px;
  690. height: 60px;
  691. border-bottom: 1px solid #DCDFE6;
  692. margin-bottom: 20px;
  693. .title {
  694. font-size: 16px;
  695. font-weight: 600;
  696. padding-left: 10px;
  697. }
  698. }
  699. ::v-deep input::-webkit-outer-spin-button,
  700. ::v-deep input::-webkit-inner-spin-button {
  701. -webkit-appearance: none;
  702. }
  703. ::v-deep input[type='number'] {
  704. -moz-appearance: textfield;
  705. }
  706. </style>