commerce_form.vue 28 KB

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