commerce_form.vue 29 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. 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="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  209. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  210. <template slot-scope="scope">
  211. <el-input v-model="scope.row.remark" size="small"></el-input>
  212. </template>
  213. </el-table-column>
  214. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
  215. <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  216. <template slot-scope="scope">
  217. <div>{{ scope.row.status1 | status1Filter }}</div>
  218. </template>
  219. </el-table-column>
  220. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  221. <template slot-scope="scope">
  222. <div>{{ status2Filter(scope.row) }}</div>
  223. </template>
  224. </el-table-column>
  225. <el-table-column align="center" label="操作" width="100" fixed="right">
  226. <template slot-scope="scope">
  227. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  228. </template>
  229. </el-table-column>
  230. </el-table>
  231. </div>
  232. <div class="page-footer">
  233. <div class="footer" :class="classObj">
  234. <el-button type="primary" @click="clickSubmitForm(1)">保 存</el-button>
  235. <el-button type="primary" @click="clickSubmitForm(2)">提交审核</el-button>
  236. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  237. <el-button slot="reference">关 闭</el-button>
  238. </el-popconfirm>
  239. </div>
  240. </div>
  241. <!-- 工程登录列表 -->
  242. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  243. <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
  244. <el-row :gutter="20">
  245. <el-col :xs="24" :sm="12" :lg="6">
  246. <el-form-item prop="enginNum">
  247. <el-input v-model="screenForm.enginNum" placeholder="工程信息单"></el-input>
  248. </el-form-item>
  249. </el-col>
  250. <el-col :xs="24" :sm="12" :lg="6">
  251. <el-form-item prop="enginName">
  252. <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
  253. </el-form-item>
  254. </el-col>
  255. <el-col :xs="24" :sm="12" :lg="6">
  256. <el-form-item prop="company">
  257. <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  261. <el-form-item label="">
  262. <el-button size="small" @click="resetScreenForm">清空</el-button>
  263. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  264. </el-form-item>
  265. </el-col>
  266. </el-row>
  267. </el-form>
  268. <div class="table" style="margin: 10px 0 20px;">
  269. <el-table
  270. v-loading="dialogTable_listLoading"
  271. :data="dialogTable_dataList"
  272. element-loading-text="Loading"
  273. tooltip-effect="dark"
  274. style="width: 100%"
  275. max-height="270">
  276. <el-table-column align="center" label="" width="100">
  277. <template slot-scope="scope">
  278. <el-button type="primary" size="small" @click="chooseItem(scope.row.enginInfoId)">选择</el-button>
  279. </template>
  280. </el-table-column>
  281. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
  282. <el-table-column align="center" prop="enginInfoNo" label="工程信息单" show-overflow-tooltip></el-table-column>
  283. <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
  284. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
  285. </el-table>
  286. </div>
  287. <div class="pagination clearfix">
  288. <div class="fr">
  289. <el-pagination
  290. @current-change="dialogTableCurrentChange"
  291. :current-page="dialogTable_currentPage"
  292. :page-size="dialogTable_pageSize"
  293. background
  294. layout="prev, pager, next"
  295. :total="dialogTable_listTotal">
  296. </el-pagination>
  297. </div>
  298. </div>
  299. <div slot="footer" class="dialog-footer">
  300. <el-button @click="isShowDialog = false">关 闭</el-button>
  301. </div>
  302. </el-dialog>
  303. </div>
  304. </template>
  305. <script>
  306. import { getOrderDetail, getComLoginList, getComLoginDetail, getWarehouseList, addCom, editCom, submitCom, checkStock, getWalletList } from "@/api/supply/engin";
  307. import { getDictList, getTypeList } from '@/api/common'
  308. let that
  309. export default {
  310. name: 'CommerceForm',
  311. componentName: 'CommerceForm',
  312. props: ['listItem'],
  313. filters: {
  314. status1Filter(val) {
  315. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  316. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  317. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  318. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  319. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  320. if (val === '' || val === null || val === undefined) return '未检查';
  321. else if (val === 0) return '无货';
  322. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  323. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  324. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  325. },
  326. },
  327. data() {
  328. return {
  329. editId: '',
  330. mainForm: {
  331. orderNum: '',
  332. orderDate: '',
  333. type: '',
  334. jxsNum: '',
  335. jxsName: '',
  336. enginNum: '',
  337. enginName: '',
  338. loginType: '',
  339. factoryNum: '',
  340. company: '',
  341. contactMan: '',
  342. tel: '',
  343. phone: '',
  344. address: '',
  345. greeRemark: '',
  346. greeReply: '',
  347. remark: '',
  348. createMan: '',
  349. createDate: '',
  350. fileNum: '',
  351. },
  352. mainFormRules: {
  353. orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  354. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  355. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  356. enginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  357. enginName: [{ required: true, message: '请输入工程项目名称', trigger: 'blur' }],
  358. loginType: [{ required: true, message: '请输入工程登录类型', trigger: 'blur' }],
  359. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  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. typeList: [],
  366. stockList: [],
  367. goodsList: [],
  368. isShowDialog: false, // 工程登录列表 - 弹窗
  369. screenForm: {
  370. enginNum: '',
  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. beforeCreate() {
  397. that = this;
  398. },
  399. created() {
  400. this.getDictList();
  401. this.getWalletList();
  402. this.getWarehouseList();
  403. if(this.listItem) {
  404. this.editId = this.listItem.parentId;
  405. this.getDetail();
  406. }else {
  407. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerId;
  408. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  409. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  410. this.mainForm.createDate = this.getDate();
  411. }
  412. },
  413. methods: {
  414. // 返回列表
  415. goBack() {
  416. this.$emit('backListFormDetail');
  417. },
  418. getDate() {
  419. var date = new Date();
  420. var seperator1 = "-";
  421. var year = date.getFullYear();
  422. var month = date.getMonth() + 1;
  423. var strDate = date.getDate();
  424. if (month >= 1 && month <= 9) {
  425. month = "0" + month;
  426. }
  427. if (strDate >= 0 && strDate <= 9) {
  428. strDate = "0" + strDate;
  429. }
  430. var currentdate = year + seperator1 + month + seperator1 + strDate;
  431. return currentdate;
  432. },
  433. // 获取钱包列表
  434. getWalletList() {
  435. getWalletList({
  436. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
  437. type: 'COMMONLY'
  438. }).then(res => {
  439. this.xjWalletList = res.data;
  440. })
  441. getWalletList({
  442. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId,
  443. type: 'REBATE'
  444. }).then(res => {
  445. this.flWalletList = res.data;
  446. })
  447. },
  448. // 获取产品大类列表
  449. getDictList() {
  450. getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  451. this.typeList = res.data;
  452. })
  453. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  454. this.stockList = res.data;
  455. })
  456. },
  457. // 获取仓库列表
  458. getWarehouseList() {
  459. getWarehouseList({
  460. pageNum: 1,
  461. pageSize: -1
  462. }).then((res) => {
  463. this.warehouseList = res.data.records;
  464. })
  465. },
  466. // 获取详情
  467. getDetail() {
  468. getOrderDetail({id: this.editId}).then(res => {
  469. let data = res.data;
  470. this.mainForm.orderNum = data.enginOrderId;
  471. this.mainForm.orderDate = data.orderDate;
  472. this.mainForm.type = data.mainId;
  473. this.mainForm.jxsNum = data.customerId;
  474. this.mainForm.jxsName = data.customerName;
  475. this.mainForm.enginNum = data.refEnginRecordNo;
  476. this.mainForm.enginName = data.refProjectName;
  477. this.mainForm.loginType = data.refPromiseStatus;
  478. this.mainForm.factoryNum = data.refFactoryNo;
  479. this.mainForm.company = data.refUseUnit;
  480. this.mainForm.saleType = data.saleTypeId;
  481. this.mainForm.contactMan = data.refLinkman;
  482. this.mainForm.tel = data.refTel;
  483. this.mainForm.phone = data.refPhone;
  484. this.mainForm.address = data.refInstallAddress;
  485. this.mainForm.greeRemark = data.note2;
  486. this.mainForm.greeReply = data.note1;
  487. this.mainForm.remark = data.remark;
  488. this.mainForm.createMan = data.createName;
  489. this.mainForm.createDate = data.createTime;
  490. this.mainForm.fileNum = data.fileNo;
  491. data.items.forEach(item => {
  492. item.status1 = '';
  493. item.status2 = '';
  494. })
  495. this.goodsList = data.items;
  496. })
  497. },
  498. // 工程登录列表 - 获取列表
  499. getComLoginList() {
  500. getComLoginList({
  501. pageNum: this.dialogTable_currentPage,
  502. pageSize: this.dialogTable_pageSize,
  503. enginInfoNo: this.screenForm.enginNum,
  504. projectName: this.screenForm.enginName,
  505. useUnit: this.screenForm.company,
  506. }).then(res => {
  507. this.dialogTable_dataList = res.data.records;
  508. this.dialogTable_listTotal = res.data.total;
  509. this.dialogTable_listLoading = false;
  510. })
  511. },
  512. // 工程登录列表 - 打开弹窗
  513. openShareDetail() {
  514. this.isShowDialog = true;
  515. this.dialogTable_currentPage = 1;
  516. this.getComLoginList();
  517. },
  518. // 工程登录列表 - 更改列表当前页
  519. dialogTableCurrentChange(val) {
  520. this.dialogTable_currentPage = val;
  521. this.getComLoginList();
  522. },
  523. // 提交筛选表单
  524. submitScreenForm() {
  525. this.dialogTable_currentPage = 1;
  526. this.getComLoginList();
  527. },
  528. // 重置筛选表单
  529. resetScreenForm() {
  530. this.$refs.screenForm.resetFields();
  531. this.dialogTable_currentPage = 1;
  532. this.getComLoginList();
  533. },
  534. // 选择工程登录
  535. chooseItem(id) {
  536. getComLoginDetail({id}).then(res => {
  537. this.isShowDialog = false;
  538. let data = res.data;
  539. this.mainForm.type = data.productCategoryId;
  540. this.mainForm.enginNum = data.enginInfoNo;
  541. this.mainForm.enginName = data.projectName;
  542. this.mainForm.loginType = data.enginSignType;
  543. this.mainForm.company = data.useUnit;
  544. this.mainForm.contactMan = data.linkman;
  545. this.mainForm.tel = data.tel;
  546. this.mainForm.phone = data.phone;
  547. this.mainForm.address = data.installAddress;
  548. this.goodsList = data.items.map(item => {
  549. return {
  550. useRefCount: '',
  551. saleTypeName: item.saleTypeName,
  552. materialId: item.materialId,
  553. materialNumber: item.materialNumber,
  554. materialOldNumber: item.materialOldNumber,
  555. materialName: item.materialName,
  556. specification: item.machine,
  557. baseUnitId: item.unit,
  558. price: item.price,
  559. enginNum: '',
  560. qty: item.qty,
  561. customerWalletId2: '',
  562. rebateRate: '',
  563. discAmount: '',
  564. customerWalletId: '',
  565. isDirectTransfer: false,
  566. directTransferQty: '',
  567. hasSendQty: '',
  568. remark: item.remark,
  569. tax: item.taxRate,
  570. status1: '',
  571. status2: '',
  572. }
  573. })
  574. })
  575. },
  576. // 删除产品
  577. deleteItem(index) {
  578. this.goodsList.splice(index, 1);
  579. },
  580. // 修改返利钱包
  581. changeFlWallet(index) {
  582. if(this.goodsList[index].customerWalletId2) {
  583. let obj = this.flWalletList.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  584. this.goodsList[index].rebateRate = obj.rebateRate;
  585. this.goodsList[index].customerWalletName2 = obj.name;
  586. }else {
  587. this.goodsList[index].rebateRate = '';
  588. this.goodsList[index].customerWalletName2 = '';
  589. }
  590. },
  591. // 修改现金钱包
  592. changeXjWallet(index) {
  593. if(this.goodsList[index].customerWalletId) {
  594. let obj = this.xjWalletList.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  595. this.goodsList[index].customerWalletName = obj.name;
  596. }else {
  597. this.goodsList[index].customerWalletName = '';
  598. }
  599. },
  600. // 检查库存
  601. checkStock() {
  602. if(!this.warehouseValue) {
  603. return this.$errorMsg('请选择仓库');
  604. }
  605. if(!this.goodsList) {
  606. return this.$errorMsg('请添加货品');
  607. }
  608. let ids = [];
  609. this.goodsList.forEach(item => {
  610. ids.push(item.materialId);
  611. })
  612. checkStock({
  613. correspondId: this.warehouseValue,
  614. materialId: ids.join(',')
  615. }).then(res => {
  616. if(res.data) {
  617. this.goodsList.forEach((item, index) => {
  618. item.status1 = res.data[index].allStockNum;
  619. item.status2 = res.data[index].stockNum;
  620. })
  621. }
  622. })
  623. },
  624. status2Filter(item) {
  625. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  626. else if (item.status2 >= item.qty) return '可用';
  627. else return '短缺';
  628. },
  629. // 保存 / 提交审核
  630. clickSubmitForm(type) {
  631. this.$refs.mainForm.validate((valid) => {
  632. if (valid) {
  633. for(let i=0; i<this.goodsList.length; i++) {
  634. if(!this.goodsList[i].customerWalletId) {
  635. this.$errorMsg('请选择现金钱包');
  636. return;
  637. }
  638. }
  639. let params = {
  640. enginOrderId: this.mainForm.orderNum,
  641. orderDate: this.mainForm.orderDate,
  642. mainId: this.mainForm.type || '',
  643. refEnginRecordNo: this.mainForm.enginNum || '',
  644. refFactoryNo: this.mainForm.factoryNum || '',
  645. note2: this.mainForm.greeRemark || '',
  646. note1: this.mainForm.greeReply || '',
  647. remark: this.mainForm.remark || '',
  648. fileNo: this.mainForm.fileNum || '',
  649. items: this.goodsList,
  650. }
  651. if(type === 1) {
  652. if(this.listItem) {
  653. editCom(params).then(res => {
  654. this.$successMsg('编辑成功');
  655. this.goBack();
  656. this.$parent.getList();
  657. })
  658. }else {
  659. addCom(params).then(res => {
  660. this.$successMsg('新增成功');
  661. this.goBack();
  662. this.$parent.getList();
  663. })
  664. }
  665. }else if(type === 2) {
  666. submitCom(params).then(res => {
  667. this.$successMsg('提交审核成功');
  668. this.goBack();
  669. this.$parent.getList();
  670. })
  671. }
  672. }
  673. })
  674. },
  675. }
  676. }
  677. </script>
  678. <style scoped lang="scss">
  679. .detail-container {
  680. width: 100%;
  681. height: 100%;
  682. }
  683. .main-title {
  684. display: flex;
  685. justify-content: space-between;
  686. align-items: center;
  687. margin-top: 20px;
  688. height: 60px;
  689. border-bottom: 1px solid #DCDFE6;
  690. margin-bottom: 20px;
  691. .title {
  692. font-size: 16px;
  693. font-weight: 600;
  694. padding-left: 10px;
  695. }
  696. }
  697. ::v-deep input::-webkit-outer-spin-button,
  698. ::v-deep input::-webkit-inner-spin-button {
  699. -webkit-appearance: none;
  700. }
  701. ::v-deep input[type='number'] {
  702. -moz-appearance: textfield;
  703. }
  704. </style>