home_form.vue 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  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="saleName" min-width="100" show-overflow-tooltip></el-table-column>
  409. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  410. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  411. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  412. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  413. </el-table>
  414. <div class="pagination clearfix" style="margin-top: 10px">
  415. <div class="fr">
  416. <el-pagination
  417. @current-change="handleTableCurrentChange"
  418. :current-page="currentPage"
  419. :page-size="10"
  420. background
  421. layout="prev, pager, next"
  422. :total="listTotal">
  423. </el-pagination>
  424. </div>
  425. </div>
  426. </div>
  427. <div class="buttons">
  428. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  429. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  430. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  431. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  432. </div>
  433. <div class="table">
  434. <el-table :data="rightGoodsList" element-loading-text="Loading" border fit highlight-current-row stripe height="400" @selection-change="rightSelectionChange">
  435. <el-table-column align="center" type="selection" width="55"></el-table-column>
  436. <el-table-column align="center" label="产品编码" prop="number" min-width="100" show-overflow-tooltip></el-table-column>
  437. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip></el-table-column>
  438. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  439. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip></el-table-column>
  440. </el-table>
  441. </div>
  442. </div>
  443. <span slot="footer" class="dialog-footer">
  444. <el-button @click="closeDialog">取 消</el-button>
  445. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  446. </span>
  447. </el-dialog>
  448. </div>
  449. </template>
  450. <script>
  451. import { getOrderDetail, getHomeLoginList, getHomeLoginDetail, getWarehouseList, addHome, editHome, submitHome, checkStock, getRetailProductList } from "@/api/supply/engin";
  452. import { getDictList, getTypeList, getSalesmanList } from '@/api/common'
  453. import { findElem } from '@/utils/util'
  454. let that
  455. export default {
  456. name: 'HomeForm',
  457. componentName: 'HomeForm',
  458. props: ['listItem'],
  459. filters: {
  460. status1Filter(val) {
  461. let STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue;
  462. let STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue;
  463. let STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue;
  464. let STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue;
  465. let STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue;
  466. if (val === '' || val === null || val === undefined) return '未检查';
  467. else if (val <= 0) return '无货';
  468. else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) return val;
  469. else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) return '有货';
  470. else if (val > STOCK_ORDER_ALL_NUM) return '充足';
  471. },
  472. },
  473. data() {
  474. return {
  475. editId: '',
  476. mainForm: {
  477. customerId: '',
  478. orderNum: '',
  479. orderDate: '',
  480. type: '',
  481. jxsNum: '',
  482. jxsName: '',
  483. loginNum: '',
  484. enginName: '',
  485. loginType: '',
  486. promiseStatus: '',
  487. factoryNum: '',
  488. company: '',
  489. saleType: '',
  490. contactMan: '',
  491. tel: '',
  492. phone: '',
  493. address: '',
  494. declareNo: '',
  495. greeRemark: '',
  496. greeReply: '',
  497. remark: '',
  498. createMan: '',
  499. createDate: '',
  500. fileNum: '',
  501. loginUserId: '',
  502. salesMan: '',
  503. projectRemark: '',
  504. projectType: '',
  505. examineRemark: '',
  506. refCount: '',
  507. regionWork: '',
  508. },
  509. mainFormRules: {
  510. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  511. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  512. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  513. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  514. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  515. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  516. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  517. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  518. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  519. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  520. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  521. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }],
  522. },
  523. salesTypeList: [],
  524. // typeList: [],
  525. stockList: [],
  526. goodsList: [],
  527. isShowDialog: false, // 工程登录列表 - 弹窗
  528. screenForm: {
  529. loginNum: '',
  530. enginName: '',
  531. company: '',
  532. },
  533. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  534. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  535. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  536. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  537. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  538. warehouseList: [],
  539. warehouseValue: '',
  540. isShowGoodsDialog: false,
  541. goodsScreenForm: {
  542. proNum: '',
  543. proName: '',
  544. proModel: '',
  545. price1: '',
  546. price2: '',
  547. },
  548. currentPage: 1,
  549. listTotal: 0,
  550. leftGoodsList: [],
  551. rightGoodsList: [],
  552. leftSelection: [],
  553. rightSelection: [],
  554. formLoading: false,
  555. isFirst: false,
  556. salesmanList: [],
  557. }
  558. },
  559. computed: {
  560. isDealer() {
  561. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  562. },
  563. outSalesmanList() {
  564. let list = [];
  565. if(this.goodsList && this.goodsList.length) {
  566. this.goodsList.forEach(item => {
  567. if(item.serviceId) {
  568. let hasItem = findElem(list, 'adminUserId', item.serviceId);
  569. if(hasItem < 0) {
  570. let obj = this.salesmanList.find(o => o.adminUserId == item.serviceId);
  571. if(obj) {
  572. list.push(obj);
  573. }
  574. }
  575. }
  576. })
  577. if(this.isFirst) {
  578. this.isFirst = false;
  579. }else {
  580. this.mainForm.salesMan = this.goodsList[0].serviceId;
  581. }
  582. }
  583. return list
  584. }
  585. },
  586. watch: {
  587. goodsList: {
  588. handler(newValue, oldValue) {
  589. if(this.goodsList && this.goodsList.length) {
  590. if(this.isFirst) {
  591. this.isFirst = false;
  592. }else {
  593. // this.mainForm.salesMan = this.goodsList[0].serviceId;
  594. }
  595. }else {
  596. this.mainForm.salesMan = '';
  597. }
  598. },
  599. immediate: true,
  600. deep: true
  601. }
  602. },
  603. beforeCreate() {
  604. that = this;
  605. },
  606. async created() {
  607. await this.getSalesmanList();
  608. this.getDictList();
  609. this.getSalesTypeList();
  610. this.getWarehouseList();
  611. if(this.listItem) {
  612. this.isFirst = true;
  613. this.editId = this.listItem.parentId;
  614. this.getDetail();
  615. }else {
  616. this.mainForm.jxsNum = JSON.parse(localStorage.getItem("supply_user")).customerNumber;
  617. this.mainForm.jxsName = JSON.parse(localStorage.getItem("supply_user")).customerName;
  618. this.mainForm.createMan = JSON.parse(localStorage.getItem("supply_user")).nickName;
  619. this.mainForm.createDate = this.getDate();
  620. }
  621. },
  622. methods: {
  623. // 返回列表
  624. goBack() {
  625. this.$emit('backListFormDetail');
  626. },
  627. getDate() {
  628. var date = new Date();
  629. var seperator1 = "-";
  630. var year = date.getFullYear();
  631. var month = date.getMonth() + 1;
  632. var strDate = date.getDate();
  633. if (month >= 1 && month <= 9) {
  634. month = "0" + month;
  635. }
  636. if (strDate >= 0 && strDate <= 9) {
  637. strDate = "0" + strDate;
  638. }
  639. var currentdate = year + seperator1 + month + seperator1 + strDate;
  640. return currentdate;
  641. },
  642. // 获取产品大类列表
  643. getDictList() {
  644. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  645. // this.typeList = res.data;
  646. // })
  647. getDictList({sysDictEnum: 'STOCK_ORDER'}).then(res => {
  648. this.stockList = res.data;
  649. })
  650. },
  651. // 获取销售类型列表
  652. getSalesTypeList() {
  653. getTypeList({
  654. pageNum: 1,
  655. pageSize: -1
  656. }).then((res) => {
  657. this.salesTypeList = res.data.records;
  658. })
  659. },
  660. // 获取仓库列表
  661. getWarehouseList() {
  662. getWarehouseList({
  663. pageNum: 1,
  664. pageSize: -1
  665. }).then((res) => {
  666. this.warehouseList = res.data.records;
  667. })
  668. },
  669. async getSalesmanList() {
  670. const res = await getSalesmanList({
  671. pageNum: 1,
  672. pageSize: -1,
  673. isCustomer: 0,
  674. status: true,
  675. });
  676. this.salesmanList = res.data.records;
  677. },
  678. // 工程登录列表 - 获取列表
  679. getHomeLoginList() {
  680. getHomeLoginList({
  681. pageNum: this.dialogTable_currentPage,
  682. pageSize: this.dialogTable_pageSize,
  683. recordNo: this.screenForm.loginNum,
  684. projectName: this.screenForm.enginName,
  685. useUnit: this.screenForm.company,
  686. examineStatus: 'OK'
  687. }).then(res => {
  688. this.dialogTable_dataList = res.data.records;
  689. this.dialogTable_listTotal = res.data.total;
  690. this.dialogTable_listLoading = false;
  691. })
  692. },
  693. // 工程登录列表 - 打开弹窗
  694. openShareDetail() {
  695. if(!this.mainForm.saleType) {
  696. return this.$errorMsg('请先选择销售类型');
  697. }
  698. this.isShowDialog = true;
  699. this.dialogTable_currentPage = 1;
  700. this.screenForm.loginNum = this.mainForm.loginNum;
  701. this.getHomeLoginList();
  702. },
  703. // 工程登录列表 - 更改列表当前页
  704. dialogTableCurrentChange(val) {
  705. this.dialogTable_currentPage = val;
  706. this.getHomeLoginList();
  707. },
  708. // 提交筛选表单
  709. submitScreenForm() {
  710. this.dialogTable_currentPage = 1;
  711. this.getHomeLoginList();
  712. },
  713. // 重置筛选表单
  714. resetScreenForm() {
  715. this.$refs.screenForm.resetFields();
  716. this.dialogTable_currentPage = 1;
  717. this.getHomeLoginList();
  718. },
  719. // 选择工程登录
  720. chooseItem(id, uid) {
  721. getHomeLoginDetail({
  722. recordNo: id,
  723. saleTypeId: this.mainForm.saleType,
  724. userId: uid,
  725. enginOrderId: this.mainForm.orderNum,
  726. customerId: JSON.parse(localStorage.getItem("supply_user")).customerId
  727. }).then(res => {
  728. this.isShowDialog = false;
  729. let data = res.data;
  730. this.mainForm.type = data.productCategory;
  731. this.mainForm.loginUserId = data.userid;
  732. // this.mainForm.saleType = '';
  733. this.mainForm.loginNum = data.recordNo;
  734. this.mainForm.enginName = data.projectName;
  735. this.mainForm.loginType = data.tradeCategory;
  736. this.mainForm.factoryNum = data.factoryNo;
  737. this.mainForm.promiseStatus = data.promiseStatus;
  738. this.mainForm.company = data.useUnit;
  739. this.mainForm.contactMan = data.buyUnitCallMen;
  740. this.mainForm.tel = data.buyUnitTel;
  741. this.mainForm.phone = data.buyUnitPhone;
  742. this.mainForm.address = data.installAddress;
  743. this.mainForm.declareNo = data.declareNo;
  744. this.mainForm.projectRemark = data.buChonShuoMing;
  745. this.mainForm.projectType = data.govBuyType;
  746. this.mainForm.refCount = data.refCount;
  747. this.mainForm.regionWork = data.regionWork;
  748. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  749. this.goodsList = data.items.map(item => {
  750. return {
  751. useRefCount: item.useRefCount,
  752. saleTypeId: saleTypeItem.id,
  753. saleTypeCode: saleTypeItem.saleCode,
  754. saleTypeName: saleTypeItem.saleName,
  755. materialId: item.materialId,
  756. materialNumber: item.materialNumber,
  757. materialOldNumber: item.materialOldNumber,
  758. materialName: item.materialName,
  759. specification: item.machine,
  760. enginNum: item.num,
  761. enginPrice: item.price,
  762. enginTotality: item.totality,
  763. historyHasDeliverQty: item.hasDeliverQty,
  764. unit: item.unit,
  765. price: item.price,
  766. qty: item.num,
  767. customerWalletId2: '',
  768. rebateRate: '',
  769. discAmount: '',
  770. customerWalletId: '',
  771. isDirectTransfer: false,
  772. directTransferQty: '',
  773. hasSendQty: '',
  774. remark: item.discri,
  775. tax: '',
  776. status1: '',
  777. status2: '',
  778. rebateWallets: item.customerWalletList.filter(item => {
  779. return item.type === 'REBATE';
  780. }),
  781. wallets: item.customerWalletList.filter(item => {
  782. return item.type === 'COMMONLY';
  783. }),
  784. }
  785. })
  786. this.goodsList.forEach(item => {
  787. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  788. item.serviceId = (item.wallets && item.wallets.length) ? item.wallets[0].serviceId : '';
  789. item.serviceName = (item.wallets && item.wallets.length) ? item.wallets[0].serviceName : '';
  790. })
  791. })
  792. },
  793. // 选择销售类型
  794. changeSaleType() {
  795. if(this.mainForm.loginNum) {
  796. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId);
  797. }
  798. },
  799. // 删除产品
  800. deleteItem(index) {
  801. this.goodsList.splice(index, 1);
  802. },
  803. // 修改返利钱包
  804. changeFlWallet(index) {
  805. if(this.goodsList[index].customerWalletId2) {
  806. let obj = this.goodsList[index].rebateWallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId2);
  807. this.goodsList[index].rebateRate = obj.rebateRate;
  808. this.goodsList[index].customerWalletName2 = obj.customerWalletName;
  809. }else {
  810. this.goodsList[index].rebateRate = '';
  811. this.goodsList[index].customerWalletName2 = '';
  812. }
  813. },
  814. // 修改现金钱包
  815. changeXjWallet(index) {
  816. if(this.goodsList[index].customerWalletId) {
  817. let obj = this.goodsList[index].wallets.find(o => o.customerWalletId == this.goodsList[index].customerWalletId);
  818. this.goodsList[index].customerWalletName = obj.customerWalletName;
  819. this.goodsList[index].serviceId = obj.serviceId;
  820. this.goodsList[index].serviceName = obj.serviceName;
  821. }else {
  822. this.goodsList[index].customerWalletName = '';
  823. this.goodsList[index].serviceId = '';
  824. this.goodsList[index].serviceName = '';
  825. }
  826. },
  827. // 获取详情
  828. getDetail() {
  829. getOrderDetail({id: this.editId}).then(res => {
  830. let data = res.data;
  831. this.mainForm.customerId = data.customerId
  832. this.mainForm.orderNum = data.enginOrderId;
  833. this.mainForm.orderDate = data.orderDate;
  834. this.mainForm.type = data.mainId;
  835. this.mainForm.jxsNum = data.customerNumber;
  836. this.mainForm.jxsName = data.customerName;
  837. this.mainForm.loginNum = data.refEnginRecordNo;
  838. this.mainForm.enginName = data.refProjectCategory;
  839. this.mainForm.loginType = data.refTradeCategory;
  840. this.mainForm.promiseStatus = data.refPromiseStatus;
  841. this.mainForm.factoryNum = data.refFactoryNo;
  842. this.mainForm.company = data.refUseUnit;
  843. this.mainForm.saleType = data.saleTypeId;
  844. this.mainForm.contactMan = data.refLinkman;
  845. this.mainForm.tel = data.refTel;
  846. this.mainForm.phone = data.refPhone;
  847. this.mainForm.address = data.refInstallAddress;
  848. this.mainForm.declareNo = data.refDeclareNo;
  849. this.mainForm.refCount = data.refCount;
  850. this.mainForm.greeRemark = data.geLiInerNote;
  851. this.mainForm.greeReply = data.note1;
  852. this.mainForm.remark = data.remark;
  853. this.mainForm.createMan = data.createBy;
  854. this.mainForm.createDate = data.createTime;
  855. this.mainForm.fileNum = data.fileNo;
  856. this.mainForm.salesMan = data.serviceId;
  857. this.mainForm.projectRemark = data.refProjectNote;
  858. this.mainForm.projectType = data.refProjectType;
  859. this.mainForm.examineRemark = data.examineNote;
  860. this.mainForm.loginUserId = data.loginUserId;
  861. this.mainForm.regionWork = data.refRegionWork;
  862. data.items.forEach(item => {
  863. item.status1 = '';
  864. item.status2 = '';
  865. item.rebateWallets = item.customerWalletList.filter(item => {
  866. return item.type === 'REBATE';
  867. });
  868. item.wallets = item.customerWalletList.filter(item => {
  869. return item.type === 'COMMONLY';
  870. });
  871. })
  872. this.goodsList = data.items;
  873. })
  874. },
  875. // 获取商品列表
  876. getGoodsList() {
  877. getRetailProductList({
  878. pageNum: this.currentPage,
  879. pageSize: 10,
  880. saleId: this.mainForm.saleType,
  881. billType: 'HOME',
  882. materialCode: this.goodsScreenForm.proNum,
  883. materialName: this.goodsScreenForm.proName,
  884. specification: this.goodsScreenForm.proModel,
  885. price1: this.goodsScreenForm.price1,
  886. price2: this.goodsScreenForm.price2,
  887. customerId:this.listItem ?this.listItem.customerId :'' ,
  888. }).then(res => {
  889. let oldGoodsList = this.goodsList;
  890. let newGoodsList = res.data.records;
  891. for(let i = 0; i < oldGoodsList.length; i++) {
  892. let oldItem = oldGoodsList[i]
  893. for(let j = 0; j < newGoodsList.length; j++) {
  894. let newItem = newGoodsList[j]
  895. if(newItem.id === oldItem.id){
  896. newGoodsList[j].selected = true;
  897. break;
  898. }
  899. }
  900. }
  901. res.data.records.forEach(item => {
  902. item.materialName = item.name;
  903. item.materialCode = item.number;
  904. item.saleTypeName = item.saleName;
  905. item.unit = item.baseUnit;
  906. item.price = item.batchPrice;
  907. item.tax = item.taxRate;
  908. item.isDirectTransfer = false;
  909. item.directTransferQty = '';
  910. item.status1 = '';
  911. item.status2 = '';
  912. item.rebateAmount = '';
  913. item.rebateRate = '';
  914. item.productPriceId = item.id;
  915. item.customerWalletId = (item.wallets && item.wallets.length) ? item.wallets[0].customerWalletId : '';
  916. });
  917. this.leftGoodsList = res.data.records;
  918. this.listTotal = res.data.total;
  919. })
  920. },
  921. // 查询重复值并禁选
  922. checkboxSelect(row, rowIndex) {
  923. if (row.selected) {
  924. return false // 禁用
  925. }else{
  926. return true // 不禁用
  927. }
  928. },
  929. // 点击 选择商品
  930. openDialog() {
  931. if(!this.mainForm.saleType) {
  932. return this.$errorMsg('请先选择销售类型');
  933. }
  934. this.isShowGoodsDialog = true;
  935. this.getGoodsList();
  936. },
  937. // 提交筛选表单
  938. submitGoodsScreenForm() {
  939. this.currentPage = 1;
  940. this.getGoodsList();
  941. },
  942. // 重置筛选表单
  943. resetGoodsScreenForm() {
  944. this.$refs.goodsScreenForm.resetFields();
  945. this.currentPage = 1;
  946. this.getGoodsList();
  947. },
  948. // 更改列表当前页
  949. handleTableCurrentChange(val) {
  950. this.currentPage = val;
  951. this.getGoodsList();
  952. },
  953. // 关闭 弹窗
  954. closeDialog() {
  955. this.isShowGoodsDialog = false;
  956. },
  957. // 左侧列表选择
  958. leftSelectionChange(val) {
  959. this.leftSelection = val;
  960. },
  961. // 右侧列表选择
  962. rightSelectionChange(val) {
  963. this.rightSelection = val;
  964. },
  965. // 数组去重
  966. delRepeat(arr1, arr2) {
  967. let allArr = arr1.concat(arr2); // 两个数组对象合并
  968. let newArr = []; // 存放去重后数据的新数组
  969. for(let i=0; i<allArr.length; i++){ // 循环allArr数组对象的内容
  970. let flag = true; // 建立标记,判断数据是否重复,true为不重复
  971. for(let j=0; j<newArr.length; j++){ // 循环新数组的内容
  972. if(allArr[i].id == newArr[j].id){ // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  973. flag = false;
  974. }
  975. }
  976. if(flag){ // 判断是否重复
  977. newArr.push(allArr[i]); // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  978. }
  979. }
  980. return newArr;
  981. },
  982. // 全部添加
  983. addAllGoods() {
  984. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList);
  985. },
  986. // 添加
  987. addGoods() {
  988. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList);
  989. },
  990. // 删除
  991. deleteGoods() {
  992. let rightGoodsList = this.rightGoodsList;
  993. let rightSelection = this.rightSelection;
  994. for(let i = 0; i < rightGoodsList.length; i++) {
  995. for(let j = 0; j < rightSelection.length; j++) {
  996. if(rightSelection[j].materialId == rightGoodsList[i].materialId){
  997. this.rightGoodsList.splice(i, 1);
  998. }
  999. }
  1000. }
  1001. },
  1002. // 全部删除
  1003. deleteAllGoods() {
  1004. this.rightGoodsList = [];
  1005. },
  1006. // 确定 添加产品
  1007. submitAddGoods() {
  1008. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  1009. this.goodsList = this.goodsList.concat(this.rightGoodsList);
  1010. this.isShowGoodsDialog = false;
  1011. this.leftGoodsList = [];
  1012. this.rightGoodsList = [];
  1013. },
  1014. // 检查库存
  1015. checkStock() {
  1016. if(!this.warehouseValue) {
  1017. return this.$errorMsg('请选择仓库');
  1018. }
  1019. if(!this.goodsList) {
  1020. return this.$errorMsg('请添加货品');
  1021. }
  1022. let ids = [];
  1023. this.goodsList.forEach(item => {
  1024. ids.push(item.materialId);
  1025. })
  1026. checkStock({
  1027. correspondId: this.warehouseValue,
  1028. materialId: ids.join(',')
  1029. }).then(res => {
  1030. if(res.data) {
  1031. this.goodsList.forEach((item, index) => {
  1032. item.status1 = res.data[index].allStockNum;
  1033. item.status2 = res.data[index].stockNum;
  1034. })
  1035. }
  1036. })
  1037. },
  1038. status2Filter(item) {
  1039. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) return '未检查';
  1040. else if (item.status2 <= 0) return '无货';
  1041. if ( item.status2 <= 0 ) {
  1042. return '无货'
  1043. }else if(item.status2 >= 1 && item.status2 <= 30){
  1044. return '紧缺'
  1045. }else if(item.status2 >=31 && item.status2 <= 1000 ){
  1046. return '有货'
  1047. }else{
  1048. return '充足'
  1049. }
  1050. },
  1051. // 保存 / 提交审核
  1052. clickSubmitForm(type) {
  1053. this.$refs.mainForm.validate((valid) => {
  1054. if (valid) {
  1055. for(let i=0; i<this.goodsList.length; i++) {
  1056. if(!this.goodsList[i].customerWalletId) {
  1057. this.$errorMsg('请选择现金钱包');
  1058. return;
  1059. }
  1060. }
  1061. let goodsList = JSON.parse(JSON.stringify(this.goodsList));
  1062. goodsList.forEach(item => {
  1063. delete item.rebateWallets;
  1064. delete item.wallets;
  1065. })
  1066. let saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType);
  1067. let saleManItem = this.mainForm.salesMan ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan) : '';
  1068. let params = {
  1069. enginOrderId: this.mainForm.orderNum,
  1070. loginUserId: this.mainForm.loginUserId,
  1071. refEnginRecordNo: this.mainForm.loginNum || '',
  1072. refProjectCategory: this.mainForm.enginName || '',
  1073. refTradeCategory: this.mainForm.loginType || '',
  1074. refPromiseStatus: this.mainForm.promiseStatus || '',
  1075. refFactoryNo: this.mainForm.factoryNum || '',
  1076. refUseUnit: this.mainForm.company || '',
  1077. refLinkman: this.mainForm.contactMan || '',
  1078. refTel: this.mainForm.tel || '',
  1079. refPhone: this.mainForm.phone || '',
  1080. refInstallAddress: this.mainForm.address || '',
  1081. refDeclareNo: this.mainForm.declareNo || '',
  1082. refCount: this.mainForm.refCount || '',
  1083. saleTypeId: this.mainForm.saleType,
  1084. saleTypeCode: saleTypeItem.saleCode,
  1085. saleTypeName: saleTypeItem.saleName,
  1086. geLiInerNote: this.mainForm.greeRemark || '',
  1087. geLiNote: this.mainForm.greeReply || '',
  1088. remark: this.mainForm.remark || '',
  1089. fileNo: this.mainForm.fileNum || '',
  1090. serviceId: this.mainForm.salesMan,
  1091. serviceName: saleManItem ? saleManItem.nickName : goodsList[0].serviceName,
  1092. refProjectNote: this.mainForm.projectRemark,
  1093. refProjectType: this.mainForm.projectType,
  1094. refRegionWork: this.mainForm.regionWork,
  1095. items: goodsList,
  1096. }
  1097. this.formLoading = true;
  1098. if(type === 1) {
  1099. if(this.listItem) {
  1100. editHome(params).then(res => {
  1101. this.$successMsg('编辑成功');
  1102. this.goBack();
  1103. this.$parent.getList();
  1104. }).finally(res => {
  1105. this.formLoading = false;
  1106. })
  1107. }else {
  1108. addHome(params).then(res => {
  1109. this.$successMsg('新增成功');
  1110. this.goBack();
  1111. this.$parent.getList();
  1112. }).finally(res => {
  1113. this.formLoading = false;
  1114. })
  1115. }
  1116. }else if(type === 2) {
  1117. submitHome(params).then(res => {
  1118. this.$successMsg('提交审核成功');
  1119. this.goBack();
  1120. this.$parent.getList();
  1121. }).finally(res => {
  1122. this.formLoading = false;
  1123. })
  1124. }
  1125. }
  1126. })
  1127. },
  1128. }
  1129. }
  1130. </script>
  1131. <style scoped lang="scss">
  1132. .detail-container {
  1133. width: 100%;
  1134. height: 100%;
  1135. }
  1136. .main-title {
  1137. display: flex;
  1138. justify-content: space-between;
  1139. align-items: center;
  1140. margin-top: 20px;
  1141. height: 60px;
  1142. border-bottom: 1px solid #DCDFE6;
  1143. margin-bottom: 20px;
  1144. .title {
  1145. font-size: 16px;
  1146. font-weight: 600;
  1147. padding-left: 10px;
  1148. }
  1149. }
  1150. .tables {
  1151. display: flex;
  1152. margin-top: 10px;
  1153. .table {
  1154. width: 45%;
  1155. }
  1156. .buttons {
  1157. display: flex;
  1158. flex-direction: column;
  1159. justify-content: center;
  1160. align-items: center;
  1161. padding: 0 10px;
  1162. button {
  1163. margin: 0;
  1164. margin-top: 10px;
  1165. }
  1166. }
  1167. }
  1168. ::v-deep input::-webkit-outer-spin-button,
  1169. ::v-deep input::-webkit-inner-spin-button {
  1170. -webkit-appearance: none;
  1171. }
  1172. ::v-deep input[type='number'] {
  1173. -moz-appearance: textfield;
  1174. }
  1175. </style>