commerce_form.vue 31 KB

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