home_form.vue 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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="saleType">
  28. <el-select v-model="mainForm.saleType" placeholder="选择销售类型" style="width: 100%" clearable @change="changeSaleType">
  29. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="8">
  34. <el-form-item label="经销商编码" prop="jxsNum">
  35. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :xs="24" :sm="12" :lg="16">
  39. <el-form-item label="经销商名称" prop="jxsName">
  40. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled></el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :xs="24" :sm="12" :lg="8">
  44. <el-form-item label="工程登录编号" prop="loginNum">
  45. <div style="display: flex;">
  46. <el-input v-model="mainForm.loginNum" placeholder="请引用工程登录" disabled></el-input>
  47. <el-button style="margin-left: 10px;" @click="openShareDetail">引用</el-button>
  48. </div>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :xs="24" :sm="12" :lg="8">
  52. <el-form-item label="项目类别" prop="enginName">
  53. <el-input v-model="mainForm.enginName" placeholder="请输入项目类别" :disabled="isDealer"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :xs="24" :sm="12" :lg="8">
  57. <el-form-item label="行业类别" prop="loginType">
  58. <el-input v-model="mainForm.loginType" placeholder="请输入行业类别"></el-input>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :xs="24" :sm="12" :lg="8">
  62. <el-form-item label="跨区厂编号" prop="factoryNum">
  63. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨区厂编号" :disabled="isDealer"></el-input>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :xs="24" :sm="12" :lg="8">
  67. <el-form-item label="使用单位" prop="company">
  68. <el-input v-model="mainForm.company" placeholder="请输入使用单位" :disabled="isDealer"></el-input>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :xs="24" :sm="12" :lg="8">
  72. <el-form-item label="业务员" prop="salesMan">
  73. <el-select v-model="mainForm.salesMan" placeholder="选择业务员" size="small" filterable clearable style="width: 100%">
  74. <el-option
  75. v-for="item in salesmanList"
  76. :key="item.adminUserId"
  77. :label="item.nickName"
  78. :value="item.adminUserId">
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :xs="24" :sm="12" :lg="8">
  84. <el-form-item label="引用记录" prop="refCount">
  85. <el-input v-model="mainForm.refCount" placeholder="请输入引用记录" :disabled="isDealer"></el-input>
  86. </el-form-item>
  87. </el-col>
  88. <el-col :xs="24" :sm="12" :lg="8">
  89. <el-form-item label="第几次申报" prop="declareNo">
  90. <el-input v-model="mainForm.declareNo" placeholder="请输入第几次申报" :disabled="isDealer"></el-input>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :xs="24" :sm="12" :lg="8">
  94. <el-form-item label="项目类型" prop="projectType">
  95. <el-input v-model="mainForm.projectType" placeholder="请输入项目类型" :disabled="isDealer"></el-input>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :xs="24" :sm="12" :lg="8">
  99. <el-form-item label="区域" prop="regionWork">
  100. <el-input v-model="mainForm.regionWork" placeholder="请输入区域"></el-input>
  101. </el-form-item>
  102. </el-col>
  103. <el-col :xs="24" :sm="12" :lg="8">
  104. <el-form-item label="文件编号" prop="fileNum">
  105. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号"></el-input>
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. <el-row :gutter="20">
  110. <el-col :xs="24" :sm="12" :lg="8">
  111. <el-form-item label="联系人" prop="contactMan">
  112. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" :disabled="isDealer"></el-input>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :xs="24" :sm="12" :lg="8">
  116. <el-form-item label="固定电话" prop="tel">
  117. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" :disabled="isDealer"></el-input>
  118. </el-form-item>
  119. </el-col>
  120. <el-col :xs="24" :sm="12" :lg="8">
  121. <el-form-item label="移动电话" prop="phone">
  122. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" :disabled="isDealer"></el-input>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :xs="24" :sm="24" :lg="24">
  126. <el-form-item label="安装地址" prop="address">
  127. <el-input v-model="mainForm.address" placeholder="请输入安装地址" :disabled="isDealer"></el-input>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :xs="24" :sm="24" :lg="24">
  131. <el-form-item label="项目说明" prop="projectRemark">
  132. <el-input v-model="mainForm.projectRemark" placeholder="请输入项目说明" :disabled="isDealer"></el-input>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :xs="24" :sm="24" :lg="24" v-if="!isDealer">
  136. <el-form-item label="格力内部备注" prop="greeRemark">
  137. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注"></el-input>
  138. </el-form-item>
  139. </el-col>
  140. <!-- <el-col :xs="24" :sm="24" :lg="24">
  141. <el-form-item label="格力回复" prop="greeReply">
  142. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  143. </el-form-item>
  144. </el-col> -->
  145. <el-col :xs="24" :sm="24" :lg="24">
  146. <el-form-item label="备注" prop="remark">
  147. <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
  148. </el-form-item>
  149. </el-col>
  150. <el-col :xs="24" :sm="12" :lg="8">
  151. <el-form-item label="制单人" prop="createMan">
  152. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled></el-input>
  153. </el-form-item>
  154. </el-col>
  155. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
  156. <el-form-item label="制单日期" prop="createDate">
  157. <el-date-picker
  158. v-model="mainForm.createDate"
  159. disabled
  160. type="date"
  161. value-format="yyyy-MM-dd"
  162. style="width: 100%;"
  163. placeholder="选择日期">
  164. </el-date-picker>
  165. </el-form-item>
  166. </el-col>
  167. <el-col :xs="24" :sm="24" :lg="24" v-if="mainForm.examineRemark">
  168. <el-form-item label="审批说明" prop="examineRemark">
  169. <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled></el-input>
  170. </el-form-item>
  171. </el-col>
  172. </el-row>
  173. </el-form>
  174. <div class="main-title">
  175. <div class="title">货品信息</div>
  176. <div>
  177. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
  178. <el-option :label="item.name" :value="item.id" v-for="(item, index) in warehouseList" :key="index"></el-option>
  179. </el-select>
  180. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  181. <el-divider direction="vertical"></el-divider>
  182. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  183. </div>
  184. </div>
  185. <div class="table" style="margin-top: 20px">
  186. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  187. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  188. <!-- <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column> -->
  189. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
  190. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip></el-table-column>
  191. <el-table-column align="center" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  192. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  193. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip>
  194. <template slot-scope="scope">
  195. <el-input v-model="scope.row.specification" size="small" v-if="listItem"></el-input>
  196. <div v-else>{{scope.row.specification}}</div>
  197. </template>
  198. </el-table-column>
  199. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  200. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  201. <template slot-scope="scope">
  202. <el-input v-model="scope.row.price" size="small" type="number"></el-input>
  203. </template>
  204. </el-table-column>
  205. <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip></el-table-column>
  206. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  207. <template slot-scope="scope">
  208. <el-input v-model="scope.row.qty" size="small" type="number"></el-input>
  209. </template>
  210. </el-table-column>
  211. <el-table-column align="center" label="订单金额" min-width="100" show-overflow-tooltip>
  212. <template slot-scope="scope">
  213. {{scope.row.price * scope.row.qty}}
  214. </template>
  215. </el-table-column>
  216. <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  217. <template slot-scope="scope">
  218. <el-select v-model="scope.row.customerWalletId2" placeholder="选择返利类型" size="small" clearable @change="changeFlWallet(scope.$index)">
  219. <el-option
  220. v-for="item in scope.row.rebateWallets"
  221. :key="item.customerWalletId"
  222. :label="item.customerWalletName"
  223. :value="item.customerWalletId">
  224. </el-option>
  225. </el-select>
  226. </template>
  227. </el-table-column>
  228. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip>
  229. <template slot-scope="scope">
  230. {{(scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100}}
  231. </template>
  232. </el-table-column>
  233. <el-table-column align="center" label="格力折扣" min-width="100" show-overflow-tooltip>
  234. <template slot-scope="scope">
  235. {{scope.row.qty * scope.row.discAmount}}
  236. </template>
  237. </el-table-column>
  238. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  239. <template slot-scope="scope">
  240. <el-select v-model="scope.row.customerWalletId" placeholder="选择现金钱包" size="small" clearable @change="changeXjWallet(scope.$index)">
  241. <el-option
  242. v-for="item in scope.row.wallets"
  243. :key="item.customerWalletId"
  244. :label="item.customerWalletName"
  245. :value="item.customerWalletId">
  246. </el-option>
  247. </el-select>
  248. </template>
  249. </el-table-column>
  250. <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip>
  251. <template slot-scope="scope">
  252. {{((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}}
  253. </template>
  254. </el-table-column>
  255. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  256. <template slot-scope="scope">
  257. <el-checkbox v-model="scope.row.isDirectTransfer"></el-checkbox>
  258. </template>
  259. </el-table-column>
  260. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100"></el-table-column>
  261. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip></el-table-column>
  262. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  263. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  264. <template slot-scope="scope">
  265. <el-input v-model="scope.row.remark" size="small"></el-input>
  266. </template>
  267. </el-table-column>
  268. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip></el-table-column>
  269. <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  270. <template slot-scope="scope">
  271. <div>{{ scope.row.status1 | status1Filter }}</div>
  272. </template>
  273. </el-table-column> -->
  274. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  275. <template slot-scope="scope">
  276. <div>{{ status2Filter(scope.row) }}</div>
  277. </template>
  278. </el-table-column>
  279. <!-- <el-table-column align="center" label="业务员" prop="serviceId" min-width="160" show-overflow-tooltip>
  280. <template slot-scope="scope">
  281. <el-select v-model="scope.row.serviceId" placeholder="选择业务员" size="small" clearable disabled>
  282. <el-option
  283. v-for="item in salesmanList"
  284. :key="item.adminUserId"
  285. :label="item.nickName"
  286. :value="item.adminUserId">
  287. </el-option>
  288. </el-select>
  289. </template>
  290. </el-table-column> -->
  291. <el-table-column align="center" label="操作" width="100" fixed="right">
  292. <template slot-scope="scope">
  293. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  294. </template>
  295. </el-table-column>
  296. </el-table>
  297. </div>
  298. <div class="page-footer">
  299. <div class="footer">
  300. <el-button type="primary" @click="clickSubmitForm(1)" :loading="formLoading">保 存</el-button>
  301. <el-button type="primary" @click="clickSubmitForm(2)" :loading="formLoading">提交审核</el-button>
  302. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  303. <el-button slot="reference">关 闭</el-button>
  304. </el-popconfirm>
  305. </div>
  306. </div>
  307. <!-- 工程登录列表 -->
  308. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  309. <el-form ref="screenForm" :model="screenForm" label-width="0" size="small" label-position="left">
  310. <el-row :gutter="20">
  311. <el-col :xs="24" :sm="12" :lg="6">
  312. <el-form-item prop="loginNum">
  313. <el-input v-model="screenForm.loginNum" placeholder="工程登录编号"></el-input>
  314. </el-form-item>
  315. </el-col>
  316. <el-col :xs="24" :sm="12" :lg="6">
  317. <el-form-item prop="enginName">
  318. <el-input v-model="screenForm.enginName" placeholder="工程项目"></el-input>
  319. </el-form-item>
  320. </el-col>
  321. <el-col :xs="24" :sm="12" :lg="6">
  322. <el-form-item prop="company">
  323. <el-input v-model="screenForm.company" placeholder="使用单位"></el-input>
  324. </el-form-item>
  325. </el-col>
  326. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  327. <el-form-item label="">
  328. <el-button size="small" @click="resetScreenForm">清空</el-button>
  329. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  330. </el-form-item>
  331. </el-col>
  332. </el-row>
  333. </el-form>
  334. <div class="table" style="margin: 10px 0 20px;">
  335. <el-table
  336. v-loading="dialogTable_listLoading"
  337. :data="dialogTable_dataList"
  338. element-loading-text="Loading"
  339. tooltip-effect="dark"
  340. style="width: 100%"
  341. max-height="270">
  342. <el-table-column align="center" label="" width="100">
  343. <template slot-scope="scope">
  344. <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo, scope.row.userid)">选择</el-button>
  345. </template>
  346. </el-table-column>
  347. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip></el-table-column>
  348. <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip></el-table-column>
  349. <el-table-column align="center" prop="projectName" label="工程项目" show-overflow-tooltip></el-table-column>
  350. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip></el-table-column>
  351. <el-table-column align="center" prop="organizationName" label="经销商" show-overflow-tooltip></el-table-column>
  352. </el-table>
  353. </div>
  354. <div class="pagination clearfix">
  355. <div class="fr">
  356. <el-pagination
  357. @current-change="dialogTableCurrentChange"
  358. :current-page="dialogTable_currentPage"
  359. :page-size="dialogTable_pageSize"
  360. background
  361. layout="prev, pager, next"
  362. :total="dialogTable_listTotal">
  363. </el-pagination>
  364. </div>
  365. </div>
  366. <div slot="footer" class="dialog-footer">
  367. <el-button @click="isShowDialog = false">关 闭</el-button>
  368. </div>
  369. </el-dialog>
  370. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  371. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  372. <el-row :gutter="20">
  373. <el-col :xs="12" :sm="6" :lg="6">
  374. <el-form-item prop="proNum">
  375. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入产品编码"></el-input>
  376. </el-form-item>
  377. </el-col>
  378. <el-col :xs="12" :sm="6" :lg="6">
  379. <el-form-item prop="proName">
  380. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称"></el-input>
  381. </el-form-item>
  382. </el-col>
  383. <el-col :xs="12" :sm="6" :lg="6">
  384. <el-form-item prop="proModel">
  385. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号"></el-input>
  386. </el-form-item>
  387. </el-col>
  388. <el-col :xs="12" :sm="6" :lg="6">
  389. <el-form-item prop="price1" style="display: flex">
  390. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%"></el-input>
  391. <span> - </span>
  392. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%"></el-input>
  393. </el-form-item>
  394. </el-col>
  395. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  396. <el-form-item label="">
  397. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  398. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  399. </el-form-item>
  400. </el-col>
  401. </el-row>
  402. </el-form>
  403. <div class="tables">
  404. <div class="table">
  405. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="leftSelectionChange">
  406. <el-table-column align="center" type="selection" width="55" :selectable='checkboxSelect'></el-table-column>
  407. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  408. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  409. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  410. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  411. </el-table>
  412. <div class="pagination clearfix" style="margin-top: 10px">
  413. <div class="fr">
  414. <el-pagination
  415. @current-change="handleTableCurrentChange"
  416. :current-page="currentPage"
  417. :page-size="10"
  418. background
  419. layout="prev, pager, next"
  420. :total="listTotal">
  421. </el-pagination>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="buttons">
  426. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  427. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  428. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  429. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  430. </div>
  431. <div class="table">
  432. <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
  433. <el-table-column align="center" type="selection" width="55"></el-table-column>
  434. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  435. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  436. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  437. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  438. </el-table>
  439. </div>
  440. </div>
  441. <span slot="footer" class="dialog-footer">
  442. <el-button @click="closeDialog">取 消</el-button>
  443. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  444. </span>
  445. </el-dialog>
  446. </div>
  447. </template>
  448. <script>
  449. import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getRetailProductList } from "@/api/supply/engin";
  450. import { getDictList, getTypeList, getSalesmanList } from '@/api/common'
  451. import { findElem } from '@/utils/util'
  452. let that
  453. export default {
  454. name: 'HomeForm',
  455. componentName: 'HomeForm',
  456. props: ['listItem'],
  457. filters: {
  458. status1Filter(val) {
  459. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  460. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  461. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  462. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  463. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  464. if (val === '' || val === null || val === undefined) return '未检查';
  465. else if (val <= 0) return '无货';
  466. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  467. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  468. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  469. },
  470. },
  471. data() {
  472. return {
  473. editId: '',
  474. mainForm: {
  475. orderNum: '',
  476. orderDate: '',
  477. type: '',
  478. jxsNum: '',
  479. jxsName: '',
  480. loginNum: '',
  481. enginName: '',
  482. loginType: '',
  483. promiseStatus: '',
  484. factoryNum: '',
  485. company: '',
  486. saleType: '',
  487. contactMan: '',
  488. tel: '',
  489. phone: '',
  490. address: '',
  491. declareNo: '',
  492. greeRemark: '',
  493. greeReply: '',
  494. remark: '',
  495. createMan: '',
  496. createDate: '',
  497. fileNum: '',
  498. loginUserId: '',
  499. salesMan: '',
  500. projectRemark: '',
  501. projectType: '',
  502. examineRemark: '',
  503. refCount: '',
  504. regionWork: '',
  505. },
  506. mainFormRules: {
  507. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  508. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  509. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  510. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  511. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  512. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  513. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  514. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  515. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  516. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  517. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  518. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  519. },
  520. salesTypeList: [],
  521. // typeList: [],
  522. stockList: [],
  523. goodsList: [],
  524. isShowDialog: false, // 工程登录列表 - 弹窗
  525. screenForm: {
  526. loginNum: '',
  527. enginName: '',
  528. company: '',
  529. },
  530. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  531. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  532. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  533. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  534. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  535. warehouseList: [],
  536. warehouseValue: '',
  537. isShowGoodsDialog: false,
  538. goodsScreenForm: {
  539. proNum: '',
  540. proName: '',
  541. proModel: '',
  542. price1: '',
  543. price2: '',
  544. },
  545. currentPage: 1,
  546. listTotal: 0,
  547. leftGoodsList: [],
  548. rightGoodsList: [],
  549. leftSelection: [],
  550. rightSelection: [],
  551. formLoading: false,
  552. isFirst: false,
  553. salesmanList: [],
  554. }
  555. },
  556. computed: {
  557. isDealer() {
  558. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  559. },
  560. outSalesmanList() {
  561. let list = [];
  562. if(this.goodsList && this.goodsList.length) {
  563. this.goodsList.forEach(item => {
  564. if(item.serviceId) {
  565. let hasItem = findElem(list, 'adminUserId', item.serviceId);
  566. if(hasItem < 0) {
  567. let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId);
  568. if(obj) {
  569. list.push(obj);
  570. }
  571. }
  572. }
  573. })
  574. if(this.isFirst) {
  575. this.isFirst = false;
  576. }else {
  577. this.mainForm.salesMan = this.goodsList[0].serviceId;
  578. }
  579. }
  580. return list
  581. }
  582. },
  583. watch: {
  584. goodsList: {
  585. handler(newValue, oldValue) {
  586. if(this.goodsList && this.goodsList.length) {
  587. if(this.isFirst) {
  588. this.isFirst = false;
  589. }else {
  590. this.mainForm.salesMan = this.goodsList[0].serviceId;
  591. }
  592. }else {
  593. this.mainForm.salesMan = '';
  594. }
  595. },
  596. immediate: true,
  597. deep: true
  598. }
  599. },
  600. beforeCreate() {
  601. that = this;
  602. },
  603. async created() {
  604. await this.getSalesmanList();
  605. this.getDictList();
  606. this.getSalesTypeList();
  607. this.getWarehouseList();
  608. if(this.listItem) {
  609. this.isFirst = true;
  610. this.editId = this.listItem.parentId;
  611. this.getDetail();
  612. }else {
  613. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerNumber;
  614. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  615. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  616. this.mainForm.createDate = this.getDate();
  617. }
  618. },
  619. methods: {
  620. // 返回列表
  621. goBack() {
  622. this.$emit('backListFormDetail');
  623. },
  624. getDate() {
  625. var date = new Date();
  626. var seperator1 = "-";
  627. var year = date.getFullYear();
  628. var month = date.getMonth() + 1;
  629. var strDate = date.getDate();
  630. if (month >= 1 && month <= 9) {
  631. month = "0" + month;
  632. }
  633. if (strDate >= 0 && strDate <= 9) {
  634. strDate = "0" + strDate;
  635. }
  636. var currentdate = year + seperator1 + month + seperator1 + strDate;
  637. return currentdate;
  638. },
  639. // 获取产品大类列表
  640. getDictList() {
  641. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  642. // this.typeList = res.data;
  643. // })
  644. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  645. this.stockList = res.data;
  646. })
  647. },
  648. // 获取销售类型列表
  649. getSalesTypeList() {
  650. getTypeList({
  651. pageNum: 1,
  652. pageSize: -1
  653. }).then((res) => {
  654. this.salesTypeList = res.data.records;
  655. })
  656. },
  657. // 获取仓库列表
  658. getWarehouseList() {
  659. getWarehouseList({
  660. pageNum: 1,
  661. pageSize: -1
  662. }).then((res) => {
  663. this.warehouseList = res.data.records;
  664. })
  665. },
  666. async getSalesmanList() {
  667. const res = await getSalesmanList({
  668. pageNum: 1,
  669. pageSize: -1,
  670. isCustomer: 0,
  671. status: true,
  672. });
  673. this.salesmanList = res.data.records;
  674. },
  675. // 工程登录列表 - 获取列表
  676. getHomeLoginList() {
  677. getHomeLoginList({
  678. pageNum: this.dialogTable_currentPage,
  679. pageSize: this.dialogTable_pageSize,
  680. recordNo: this.screenForm.loginNum,
  681. projectName: this.screenForm.enginName,
  682. useUnit: this.screenForm.company,
  683. examineStatus: 'OK'
  684. }).then(res => {
  685. this.dialogTable_dataList = res.data.records;
  686. this.dialogTable_listTotal = res.data.total;
  687. this.dialogTable_listLoading = false;
  688. })
  689. },
  690. // 工程登录列表 - 打开弹窗
  691. openShareDetail() {
  692. if(!this.mainForm.saleType) {
  693. return this.$errorMsg('请先选择销售类型');
  694. }
  695. this.isShowDialog = true;
  696. this.dialogTable_currentPage = 1;
  697. this.screenForm.loginNum = this.mainForm.loginNum;
  698. this.getHomeLoginList();
  699. },
  700. // 工程登录列表 - 更改列表当前页
  701. dialogTableCurrentChange(val) {
  702. this.dialogTable_currentPage = val;
  703. this.getHomeLoginList();
  704. },
  705. // 提交筛选表单
  706. submitScreenForm() {
  707. this.dialogTable_currentPage = 1;
  708. this.getHomeLoginList();
  709. },
  710. // 重置筛选表单
  711. resetScreenForm() {
  712. this.$refs.screenForm.resetFields();
  713. this.dialogTable_currentPage = 1;
  714. this.getHomeLoginList();
  715. },
  716. // 选择工程登录
  717. chooseItem(id, uid) {
  718. getHomeLoginDetail({
  719. recordNo: id,
  720. saleTypeId: this.mainForm.saleType,
  721. userId: uid,
  722. enginOrderId: this.mainForm.orderNum,
  723. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId
  724. }).then(res => {
  725. this.isShowDialog = false;
  726. let data = res.data;
  727. this.mainForm.type = data.productCategory;
  728. this.mainForm.loginUserId = data.userid;
  729. // this.mainForm.saleType = '';
  730. this.mainForm.loginNum = data.recordNo;
  731. this.mainForm.enginName = data.projectName;
  732. this.mainForm.loginType = data.tradeCategory;
  733. this.mainForm.factoryNum = data.factoryNo;
  734. this.mainForm.promiseStatus = data.promiseStatus;
  735. this.mainForm.company = data.useUnit;
  736. this.mainForm.contactMan = data.buyUnitCallMen;
  737. this.mainForm.tel = data.buyUnitTel;
  738. this.mainForm.phone = data.buyUnitPhone;
  739. this.mainForm.address = data.installAddress;
  740. this.mainForm.declareNo = data.declareNo;
  741. this.mainForm.projectRemark = data.buChonShuoMing;
  742. this.mainForm.projectType = data.govBuyType;
  743. this.mainForm.refCount = data.refCount;
  744. this.mainForm.regionWork = data.regionWork;
  745. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  746. this.goodsList = data.items.map(item => {
  747. return {
  748. useRefCount: item.useRefCount,
  749. saleTypeId: saleTypeItem.id,
  750. saleTypeCode: saleTypeItem.saleCode,
  751. saleTypeName: saleTypeItem.saleName,
  752. materialId: item.materialId,
  753. materialNumber: item.materialNumber,
  754. materialOldNumber: item.materialOldNumber,
  755. materialName: item.materialName,
  756. specification: item.machine,
  757. enginNum: item.num,
  758. enginPrice: item.price,
  759. enginTotality: item.totality,
  760. historyHasDeliverQty: item.hasDeliverQty,
  761. unit: item.unit,
  762. price: item.price,
  763. qty: item.num,
  764. customerWalletId2: '',
  765. rebateRate: '',
  766. discAmount: '',
  767. customerWalletId: '',
  768. isDirectTransfer: false,
  769. directTransferQty: '',
  770. hasSendQty: '',
  771. remark: item.discri,
  772. tax: '',
  773. status1: '',
  774. status2: '',
  775. rebateWallets: item.customerWalletList.filter(item => {
  776. return item.type === 'REBATE';
  777. }),
  778. wallets: item.customerWalletList.filter(item => {
  779. return item.type === 'COMMONLY';
  780. }),
  781. }
  782. })
  783. this.goodsList.forEach(item => {
  784. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  785. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  786. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  787. })
  788. })
  789. },
  790. // 选择销售类型
  791. changeSaleType() {
  792. if(this.mainForm.loginNum) {
  793. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  794. }
  795. },
  796. // 删除产品
  797. deleteItem(index) {
  798. this.goodsList.splice(index, 1);
  799. },
  800. // 修改返利钱包
  801. changeFlWallet(index) {
  802. if(this.goodsList[index].customerWalletId2) {
  803. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  804. this.goodsList[index].rebateRate = obj.rebateRate;
  805. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  806. }else {
  807. this.goodsList[index].rebateRate = '';
  808. this.goodsList[index].customerWalletName2 = '';
  809. }
  810. },
  811. // 修改现金钱包
  812. changeXjWallet(index) {
  813. if(this.goodsList[index].customerWalletId) {
  814. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  815. this.goodsList[index].customerWalletName = obj.customerWalletName;
  816. this.goodsList[index].serviceId = obj.serviceId;
  817. this.goodsList[index].serviceName = obj.serviceName;
  818. }else {
  819. this.goodsList[index].customerWalletName = '';
  820. this.goodsList[index].serviceId = '';
  821. this.goodsList[index].serviceName = '';
  822. }
  823. },
  824. // 获取详情
  825. getDetail() {
  826. getOrderDetail({id: this.editId}).then(res => {
  827. let data = res.data;
  828. this.mainForm.orderNum = data.enginOrderId;
  829. this.mainForm.orderDate = data.orderDate;
  830. this.mainForm.type = data.mainId;
  831. this.mainForm.jxsNum = data.customerNumber;
  832. this.mainForm.jxsName = data.customerName;
  833. this.mainForm.loginNum = data.refEnginRecordNo;
  834. this.mainForm.enginName = data.refProjectName;
  835. this.mainForm.loginType = data.refTradeCategory;
  836. this.mainForm.promiseStatus = data.refPromiseStatus;
  837. this.mainForm.factoryNum = data.refFactoryNo;
  838. this.mainForm.company = data.refUseUnit;
  839. this.mainForm.saleType = data.saleTypeId;
  840. this.mainForm.contactMan = data.refLinkman;
  841. this.mainForm.tel = data.refTel;
  842. this.mainForm.phone = data.refPhone;
  843. this.mainForm.address = data.refInstallAddress;
  844. this.mainForm.declareNo = data.refDeclareNo;
  845. this.mainForm.refCount = data.refCount;
  846. this.mainForm.greeRemark = data.geLiInerNote;
  847. this.mainForm.greeReply = data.note1;
  848. this.mainForm.remark = data.remark;
  849. this.mainForm.createMan = data.createBy;
  850. this.mainForm.createDate = data.createTime;
  851. this.mainForm.fileNum = data.fileNo;
  852. this.mainForm.salesMan = data.serviceId;
  853. this.mainForm.projectRemark = data.refProjectNote;
  854. this.mainForm.projectType = data.refProjectType;
  855. this.mainForm.examineRemark = data.examineNote;
  856. this.mainForm.loginUserId = data.loginUserId;
  857. this.mainForm.regionWork = data.refRegionWork;
  858. data.items.forEach(item => {
  859. item.status1 = '';
  860. item.status2 = '';
  861. item.rebateWallets = item.customerWalletList.filter(item => {
  862. return item.type === 'REBATE';
  863. });
  864. item.wallets = item.customerWalletList.filter(item => {
  865. return item.type === 'COMMONLY';
  866. });
  867. })
  868. this.goodsList = data.items;
  869. })
  870. },
  871. // 获取商品列表
  872. getGoodsList() {
  873. getRetailProductList({
  874. pageNum: this.currentPage,
  875. pageSize: 10,
  876. saleId: this.mainForm.saleType,
  877. materialCode: this.goodsScreenForm.proNum,
  878. materialName: this.goodsScreenForm.proName,
  879. specification: this.goodsScreenForm.proModel,
  880. price1: this.goodsScreenForm.price1,
  881. price2: this.goodsScreenForm.price2,
  882. }).then(res => {
  883. let oldGoodsList = this.goodsList;
  884. let newGoodsList = res.data.records;
  885. for(let i = 0; i < oldGoodsList.length; i++) {
  886. let oldItem = oldGoodsList[i]
  887. for(let j = 0; j < newGoodsList.length; j++) {
  888. let newItem = newGoodsList[j]
  889. if(newItem.id === oldItem.id){
  890. newGoodsList[j].selected = true;
  891. break;
  892. }
  893. }
  894. }
  895. res.data.records.forEach(item => {
  896. item.materialName = item.name;
  897. item.materialCode = item.number;
  898. item.saleTypeName = item.saleName;
  899. item.unit = item.baseUnit;
  900. item.price = item.batchPrice;
  901. item.tax = item.taxRate;
  902. item.isDirectTransfer = false;
  903. item.directTransferQty = '';
  904. item.status1 = '';
  905. item.status2 = '';
  906. item.rebateAmount = '';
  907. item.rebateRate = '';
  908. item.productPriceId = item.id;
  909. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  910. });
  911. this.leftGoodsList = res.data.records;
  912. this.listTotal = res.data.total;
  913. })
  914. },
  915. // 查询重复值并禁选
  916. checkboxSelect(row, rowIndex) {
  917. if (row.selected) {
  918. return false // 禁用
  919. }else{
  920. return true // 不禁用
  921. }
  922. },
  923. // 点击 选择商品
  924. openDialog() {
  925. if(!this.mainForm.saleType) {
  926. return this.$errorMsg('请先选择销售类型');
  927. }
  928. this.isShowGoodsDialog = true;
  929. this.getGoodsList();
  930. },
  931. // 提交筛选表单
  932. submitGoodsScreenForm() {
  933. this.currentPage = 1;
  934. this.getGoodsList();
  935. },
  936. // 重置筛选表单
  937. resetGoodsScreenForm() {
  938. this.$refs.goodsScreenForm.resetFields();
  939. this.currentPage = 1;
  940. this.getGoodsList();
  941. },
  942. // 更改列表当前页
  943. handleTableCurrentChange(val) {
  944. this.currentPage = val;
  945. this.getGoodsList();
  946. },
  947. // 关闭 弹窗
  948. closeDialog() {
  949. this.isShowGoodsDialog = false;
  950. },
  951. // 左侧列表选择
  952. leftSelectionChange(val) {
  953. this.leftSelection = val;
  954. },
  955. // 右侧列表选择
  956. rightSelectionChange(val) {
  957. this.rightSelection = val;
  958. },
  959. // 数组去重
  960. delRepeat(arr1, arr2) {
  961. let allArr = arr1.concat(arr2); // 两个数组对象合并
  962. let newArr = []; // 存放去重后数据的新数组
  963. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  964. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  965. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  966. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  967. flag = false;
  968. }
  969. }
  970. if(flag){ // 判断是否重复
  971. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  972. }
  973. }
  974. return newArr;
  975. },
  976. // 全部添加
  977. addAllGoods() {
  978. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  979. },
  980. // 添加
  981. addGoods() {
  982. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  983. },
  984. // 删除
  985. deleteGoods() {
  986. let rightGoodsList = this.rightGoodsList;
  987. let rightSelection = this.rightSelection;
  988. for(let i = 0; i < rightGoodsList.length; i++) {
  989. for(let j = 0; j < rightSelection.length; j++) {
  990. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  991. this.rightGoodsList.splice(i, 1);
  992. }
  993. }
  994. }
  995. },
  996. // 全部删除
  997. deleteAllGoods() {
  998. this.rightGoodsList = [];
  999. },
  1000. // 确定 添加产品
  1001. submitAddGoods() {
  1002. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  1003. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  1004. this.isShowGoodsDialog = false;
  1005. this.leftGoodsList = [];
  1006. this.rightGoodsList = [];
  1007. },
  1008. // 检查库存
  1009. checkStock() {
  1010. if(!this.warehouseValue) {
  1011. return this.$errorMsg('请选择仓库');
  1012. }
  1013. if(!this.goodsList) {
  1014. return this.$errorMsg('请添加货品');
  1015. }
  1016. let ids = [];
  1017. this.goodsList.forEach(item => {
  1018. ids.push(item.materialId);
  1019. })
  1020. checkStock({
  1021. correspondId: this.warehouseValue,
  1022. materialId: ids.join(',')
  1023. }).then(res => {
  1024. if(res.data) {
  1025. this.goodsList.forEach((item, index) => {
  1026. item.status1 = res.data[index].allStockNum;
  1027. item.status2 = res.data[index].stockNum;
  1028. })
  1029. }
  1030. })
  1031. },
  1032. status2Filter(item) {
  1033. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1034. else if (item.status2 <= 0) return '无货';
  1035. else if (item.status2 >= item.qty) return '可用';
  1036. else return '短缺';
  1037. },
  1038. // 保存 / 提交审核
  1039. clickSubmitForm(type) {
  1040. this.$refs.mainForm.validate((valid) => {
  1041. if (valid) {
  1042. for(let i=0; i<this.goodsList.length; i++) {
  1043. if(!this.goodsList[i].customerWalletId) {
  1044. this.$errorMsg('请选择现金钱包');
  1045. return;
  1046. }
  1047. }
  1048. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1049. goodsList.forEach(item => {
  1050. delete item.rebateWallets;
  1051. delete item.wallets;
  1052. })
  1053. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1054. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1055. let params = {
  1056. enginOrderId: this.mainForm.orderNum,
  1057. loginUserId: this.mainForm.loginUserId,
  1058. refEnginRecordNo: this.mainForm.loginNum || '',
  1059. refProjectName: this.mainForm.enginName || '',
  1060. refTradeCategory: this.mainForm.loginType || '',
  1061. refPromiseStatus: this.mainForm.promiseStatus || '',
  1062. refFactoryNo: this.mainForm.factoryNum || '',
  1063. refUseUnit: this.mainForm.company || '',
  1064. refLinkman: this.mainForm.contactMan || '',
  1065. refTel: this.mainForm.tel || '',
  1066. refPhone: this.mainForm.phone || '',
  1067. refInstallAddress: this.mainForm.address || '',
  1068. refDeclareNo: this.mainForm.declareNo || '',
  1069. refCount: this.mainForm.refCount || '',
  1070. saleTypeId: this.mainForm.saleType,
  1071. saleTypeCode: saleTypeItem.saleCode,
  1072. saleTypeName: saleTypeItem.saleName,
  1073. geLiInerNote: this.mainForm.greeRemark || '',
  1074. geLiNote: this.mainForm.greeReply || '',
  1075. remark: this.mainForm.remark || '',
  1076. fileNo: this.mainForm.fileNum || '',
  1077. serviceId: this.mainForm.salesMan,
  1078. serviceName: saleManItem ? saleManItem.nickName : goodsList[0].serviceName,
  1079. refProjectNote: this.mainForm.projectRemark,
  1080. refProjectType: this.mainForm.projectType,
  1081. refRegionWork: this.mainForm.regionWork,
  1082. items: goodsList,
  1083. }
  1084. this.formLoading = true;
  1085. if(type === 1) {
  1086. if(this.listItem) {
  1087. editHome(params).then(res => {
  1088. this.$successMsg('编辑成功');
  1089. this.goBack();
  1090. this.$parent.getList();
  1091. }).finally(res => {
  1092. this.formLoading = false;
  1093. })
  1094. }else {
  1095. addHome(params).then(res => {
  1096. this.$successMsg('新增成功');
  1097. this.goBack();
  1098. this.$parent.getList();
  1099. }).finally(res => {
  1100. this.formLoading = false;
  1101. })
  1102. }
  1103. }else if(type === 2) {
  1104. submitHome(params).then(res => {
  1105. this.$successMsg('提交审核成功');
  1106. this.goBack();
  1107. this.$parent.getList();
  1108. }).finally(res => {
  1109. this.formLoading = false;
  1110. })
  1111. }
  1112. }
  1113. })
  1114. },
  1115. }
  1116. }
  1117. </script>
  1118. <style scoped lang="scss">
  1119. .detail-container {
  1120. width: 100%;
  1121. height: 100%;
  1122. }
  1123. .main-title {
  1124. display: flex;
  1125. justify-content: space-between;
  1126. align-items: center;
  1127. margin-top: 20px;
  1128. height: 60px;
  1129. border-bottom: 1px solid #DCDFE6;
  1130. margin-bottom: 20px;
  1131. .title {
  1132. font-size: 16px;
  1133. font-weight: 600;
  1134. padding-left: 10px;
  1135. }
  1136. }
  1137. .tables {
  1138. display: flex;
  1139. margin-top: 10px;
  1140. .table {
  1141. width: 45%;
  1142. }
  1143. .buttons {
  1144. display: flex;
  1145. flex-direction: column;
  1146. justify-content: center;
  1147. align-items: center;
  1148. padding: 0 10px;
  1149. button {
  1150. margin: 0;
  1151. margin-top: 10px;
  1152. }
  1153. }
  1154. }
  1155. ::v-deep input::-webkit-outer-spin-button,
  1156. ::v-deep input::-webkit-inner-spin-button {
  1157. -webkit-appearance: none;
  1158. }
  1159. ::v-deep input[type='number'] {
  1160. -moz-appearance: textfield;
  1161. }
  1162. </style>