commerce_form.vue 28 KB

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