home_form.vue 49 KB

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