home_form.vue 32 KB

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