home_form.vue 48 KB

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