home_form.vue 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header :content="listItem ? '编辑' : '新增'" @back="goBack" />
  4. <div class="main-title">
  5. <div class="title">工程订单</div>
  6. </div>
  7. <el-form
  8. ref="mainForm"
  9. :model="mainForm"
  10. :rules="mainFormRules"
  11. label-width="125px"
  12. size="small"
  13. label-position="right"
  14. >
  15. <el-row :gutter="20">
  16. <el-col :xs="24" :sm="12" :lg="8">
  17. <el-form-item label="工程订单" prop="orderNum">
  18. <el-input v-model="mainForm.orderNum" placeholder="系统自动生成" disabled />
  19. </el-form-item>
  20. </el-col>
  21. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  22. <el-form-item label="单据日期" prop="orderDate">
  23. <el-date-picker
  24. v-model="mainForm.orderDate"
  25. disabled
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. style="width: 100%"
  29. placeholder="系统自动生成"
  30. />
  31. </el-form-item>
  32. </el-col>
  33. <el-col :xs="24" :sm="12" :lg="8">
  34. <el-form-item label="销售类型" prop="saleType">
  35. <el-select
  36. v-model="mainForm.saleType"
  37. placeholder="选择销售类型"
  38. style="width: 100%"
  39. filterable
  40. clearable
  41. @change="changeSaleType"
  42. >
  43. <el-option v-for="item in salesTypeList" :key="item.id" :label="item.saleName" :value="item.id">
  44. <span>{{ item.saleName }}</span> <span style="color: #f00">{{ item.saleCode }}</span>
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :xs="24" :sm="12" :lg="8">
  50. <el-form-item label="经销商编码" prop="jxsNum">
  51. <el-input v-model="mainForm.jxsNum" placeholder="请输入经销商编码" disabled />
  52. </el-form-item>
  53. </el-col>
  54. <el-col :xs="24" :sm="12" :lg="16">
  55. <el-form-item label="经销商名称" prop="jxsName">
  56. <el-input v-model="mainForm.jxsName" placeholder="请输入经销商名称" disabled />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :xs="24" :sm="12" :lg="8">
  60. <el-form-item label="工程登录编号" prop="loginNum">
  61. <div style="display: flex">
  62. <el-input v-model="mainForm.loginNum" placeholder="请引用工程登录" disabled />
  63. <el-button style="margin-left: 10px" @click="openShareDetail">引用</el-button>
  64. </div>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :xs="24" :sm="12" :lg="8">
  68. <el-form-item label="项目类别" prop="enginName">
  69. <el-input v-model="mainForm.enginName" placeholder="请输入项目类别" :disabled="isDealer" />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :xs="24" :sm="12" :lg="8">
  73. <el-form-item label="行业类别" prop="loginType">
  74. <el-input v-model="mainForm.loginType" :disabled="isDealer" placeholder="请输入行业类别" />
  75. </el-form-item>
  76. </el-col>
  77. <el-col :xs="24" :sm="12" :lg="8">
  78. <el-form-item label="跨区厂编号" prop="factoryNum">
  79. <el-input v-model="mainForm.factoryNum" placeholder="请输入跨区厂编号" :disabled="isDealer" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :xs="24" :sm="12" :lg="8">
  83. <el-form-item label="使用单位" prop="company">
  84. <el-input v-model="mainForm.company" placeholder="请输入使用单位" :disabled="isDealer" />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :xs="24" :sm="12" :lg="8">
  88. <el-form-item label="业务员" prop="salesMan">
  89. <el-select
  90. v-model="mainForm.salesMan"
  91. placeholder="选择业务员"
  92. size="small"
  93. filterable
  94. clearable
  95. style="width: 100%"
  96. >
  97. <el-option
  98. v-for="item in salesmanList"
  99. :key="item.adminUserId"
  100. :label="item.nickName"
  101. :value="item.adminUserId"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. </el-col>
  106. <el-col :xs="24" :sm="12" :lg="8">
  107. <el-form-item label="引用记录" prop="refCount">
  108. <el-input v-model="mainForm.refCount" placeholder="请输入引用记录" :disabled="isDealer" />
  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="请输入第几申报" :disabled="isDealer" />
  114. </el-form-item>
  115. </el-col>
  116. <el-col :xs="24" :sm="12" :lg="8">
  117. <el-form-item label="项目类型" prop="projectType">
  118. <el-input v-model="mainForm.projectType" placeholder="请输入项目类型" :disabled="isDealer" />
  119. </el-form-item>
  120. </el-col>
  121. <el-col :xs="24" :sm="12" :lg="8">
  122. <el-form-item label="区域" prop="regionWork">
  123. <el-input v-model="mainForm.regionWork" placeholder="请输入区域" :disabled="isDealer" />
  124. </el-form-item>
  125. </el-col>
  126. <el-col :xs="24" :sm="12" :lg="8">
  127. <el-form-item label="文件编号" prop="fileNum">
  128. <el-input v-model="mainForm.fileNum" placeholder="请输入文件编号" :disabled="isDealer" />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :xs="24" :sm="12" :lg="8">
  132. <el-form-item label="购买单位" prop="refBuyUnitName">
  133. <el-input v-model="mainForm.refBuyUnitName" placeholder="请输入购买单位" :disabled="isDealer" />
  134. </el-form-item>
  135. </el-col>
  136. <el-col :xs="24" :sm="12" :lg="8">
  137. <el-form-item label="联系人" prop="contactMan">
  138. <el-input v-model="mainForm.contactMan" placeholder="请输入联系人" />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :xs="24" :sm="12" :lg="8">
  142. <el-form-item label="固定电话" prop="tel">
  143. <el-input v-model="mainForm.tel" placeholder="请输入固定电话" />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :xs="24" :sm="12" :lg="8">
  147. <el-form-item label="移动电话" prop="phone">
  148. <el-input v-model="mainForm.phone" placeholder="请输入移动电话" />
  149. </el-form-item>
  150. </el-col>
  151. <el-col :xs="24" :sm="16" :lg="16">
  152. <el-form-item label="安装地址" prop="address">
  153. <el-input v-model="mainForm.address" placeholder="请输入安装地址" :disabled="isDealer" />
  154. </el-form-item>
  155. </el-col>
  156. <el-col :xs="24" :sm="8" :lg="8">
  157. <el-form-item label="保证函" prop="refPromiseProvide">
  158. <el-select
  159. v-model="mainForm.refPromiseProvide"
  160. placeholder="选择保证函状态"
  161. :disabled="isDealer ? true : false"
  162. size="small"
  163. clearable
  164. style="width: 100%"
  165. >
  166. <el-option label="未保证" value="未保证" />
  167. <el-option label="已保证" value="已保证" />
  168. </el-select>
  169. </el-form-item>
  170. </el-col>
  171. <el-col :xs="24" :sm="24" :lg="24">
  172. <el-form-item label="项目说明" prop="projectRemark">
  173. <el-input v-model="mainForm.projectRemark" placeholder="请输入项目说明" :disabled="isDealer" />
  174. </el-form-item>
  175. </el-col>
  176. <el-col :xs="24" :sm="24" :lg="24">
  177. <el-form-item label="其他附件审批意见" prop="refOtherAnnexIdea">
  178. <el-input v-model="mainForm.refOtherAnnexIdea" placeholder="请输入其他附件审批意见" disabled />
  179. </el-form-item>
  180. </el-col>
  181. <el-col v-if="!isDealer" :xs="24" :sm="24" :lg="24">
  182. <el-form-item label="格力内部备注" prop="greeRemark">
  183. <el-input v-model="mainForm.greeRemark" placeholder="请输入格力内部备注" />
  184. </el-form-item>
  185. </el-col>
  186. <!-- <el-col :xs="24" :sm="24" :lg="24">
  187. <el-form-item label="格力回复" prop="greeReply">
  188. <el-input v-model="mainForm.greeReply" placeholder="请输入格力回复"></el-input>
  189. </el-form-item>
  190. </el-col> -->
  191. <el-col :xs="24" :sm="24" :lg="24">
  192. <el-form-item label="备注" prop="remark">
  193. <el-input v-model="mainForm.remark" placeholder="请输入备注" />
  194. </el-form-item>
  195. </el-col>
  196. <el-col :xs="24" :sm="12" :lg="8">
  197. <el-form-item label="制单人" prop="createMan">
  198. <el-input v-model="mainForm.createMan" placeholder="请输入制单人" disabled />
  199. </el-form-item>
  200. </el-col>
  201. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  202. <el-form-item label="制单日期" prop="createDate">
  203. <el-date-picker
  204. v-model="mainForm.createDate"
  205. disabled
  206. type="date"
  207. :default-value="getDate()"
  208. value-format="yyyy-MM-dd"
  209. style="width: 100%"
  210. placeholder="选择日期"
  211. />
  212. </el-form-item>
  213. </el-col>
  214. <el-col v-if="mainForm.examineRemark" :xs="24" :sm="24" :lg="24">
  215. <el-form-item label="审批说明" prop="examineRemark">
  216. <el-input v-model="mainForm.examineRemark" placeholder="请输入审批说明" disabled />
  217. </el-form-item>
  218. </el-col>
  219. </el-row>
  220. </el-form>
  221. <div class="main-title">
  222. <div class="title">货品信息</div>
  223. <div>
  224. <el-select v-model="warehouseValue" placeholder="请选择发货仓库" size="small" style="margin-right: 10px">
  225. <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name" :value="item.id" />
  226. </el-select>
  227. <el-button type="primary" size="small" icon="el-icon-search" @click="checkStock">检查库存</el-button>
  228. <el-divider direction="vertical" />
  229. <el-button type="primary" size="small" icon="el-icon-plus" @click="openDialog">添加货品</el-button>
  230. </div>
  231. </div>
  232. <div class="table" style="margin-top: 20px">
  233. <el-table
  234. :data="goodsList"
  235. element-loading-text="Loading"
  236. border
  237. fit
  238. highlight-current-row
  239. stripe
  240. max-height="400"
  241. show-summary
  242. :summary-method="$getSummaries"
  243. >
  244. <el-table-column align="center" label="序号" type="index" width="50" />
  245. <!-- <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column> -->
  246. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip />
  247. <el-table-column align="center" label="物料编码" prop="materialNumber" min-width="120" show-overflow-tooltip />
  248. <el-table-column
  249. align="center"
  250. label="产品编码"
  251. prop="materialOldNumber"
  252. min-width="120"
  253. show-overflow-tooltip
  254. />
  255. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  256. <el-table-column align="center" label="规格型号" prop="specification" min-width="300" show-overflow-tooltip>
  257. <template slot-scope="scope">
  258. <el-input v-if="listItem" v-model="scope.row.specification" size="small" />
  259. <div v-else>{{ scope.row.specification }}</div>
  260. </template>
  261. </el-table-column>
  262. <el-table-column
  263. align="center"
  264. label="实装规格型号"
  265. prop="realSpecification"
  266. min-width="300"
  267. show-overflow-tooltip
  268. >
  269. <template slot-scope="scope">
  270. <el-input
  271. v-model="scope.row.realSpecification"
  272. :class="scope.row.realSpecification !== scope.row.specification ? 'input' : ''"
  273. size="small"
  274. readonly
  275. @click.native="getRealMaterData(scope.$index)"
  276. />
  277. </template>
  278. </el-table-column>
  279. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip>
  280. <template slot-scope="scope">
  281. <el-input v-model="scope.row.qty" size="small" type="number" @mousewheel.native.prevent />
  282. </template>
  283. </el-table-column>
  284. <el-table-column align="center" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  285. <template slot-scope="scope">
  286. <el-input v-model="scope.row.price" size="small" type="number" @mousewheel.native.prevent />
  287. </template>
  288. </el-table-column>
  289. <el-table-column align="center" label="订单金额" prop="dida" min-width="100" show-overflow-tooltip>
  290. <template slot-scope="scope">
  291. {{ scope.row.price * scope.row.qty }}
  292. </template>
  293. </el-table-column>
  294. <el-table-column align="center" label="工程登录数量" prop="enginNum" min-width="120" show-overflow-tooltip />
  295. <el-table-column align="center" label="现金钱包" prop="customerWalletId" min-width="160" show-overflow-tooltip>
  296. <template slot-scope="scope">
  297. <el-select
  298. v-model="scope.row.customerWalletId"
  299. placeholder="选择现金钱包"
  300. size="small"
  301. clearable
  302. @change="changeXjWallet(scope.$index)"
  303. >
  304. <el-option
  305. v-for="item in scope.row.wallets"
  306. :key="item.customerWalletId"
  307. :label="item.customerWalletName"
  308. :value="item.customerWalletId"
  309. />
  310. </el-select>
  311. </template>
  312. </el-table-column>
  313. <el-table-column align="center" label="返利类型" prop="customerWalletId2" min-width="160" show-overflow-tooltip>
  314. <template slot-scope="scope">
  315. <el-select
  316. v-model="scope.row.customerWalletId2"
  317. placeholder="选择返利类型"
  318. size="small"
  319. clearable
  320. @change="changeFlWallet(scope.$index)"
  321. >
  322. <el-option
  323. v-for="item in scope.row.rebateWallets"
  324. :key="item.customerWalletId"
  325. :label="item.customerWalletName"
  326. :value="item.customerWalletId"
  327. />
  328. </el-select>
  329. </template>
  330. </el-table-column>
  331. <el-table-column align="center" label="返利金额" min-width="100" show-overflow-tooltip prop="compute_flAmount">
  332. <template slot-scope="scope">
  333. {{ (scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100 }}
  334. </template>
  335. </el-table-column>
  336. <el-table-column align="center" label="格力折扣" prop="ko" min-width="100" show-overflow-tooltip>
  337. <template slot-scope="scope">
  338. {{ scope.row.qty * scope.row.discAmount }}
  339. </template>
  340. </el-table-column>
  341. <el-table-column align="center" label="实付金额" min-width="100" show-overflow-tooltip prop="compute_sfAmount">
  342. <template slot-scope="scope">
  343. {{
  344. (scope.row.price * scope.row.qty * 100 -
  345. ((scope.row.price * scope.row.qty * (scope.row.rebateRate * 100)) / 100) * 100 -
  346. ((scope.row.qty * (scope.row.discAmount * 100)) / 100) * 100) /
  347. 100
  348. }}
  349. </template>
  350. </el-table-column>
  351. <el-table-column align="center" label="是否直调" prop="isDirectTransfer" min-width="100">
  352. <template slot-scope="scope">
  353. <el-checkbox v-model="scope.row.isDirectTransfer" />
  354. </template>
  355. </el-table-column>
  356. <el-table-column align="center" label="直调数量" prop="directTransferQty" min-width="100" />
  357. <el-table-column align="center" label="已发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip />
  358. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip />
  359. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  360. <template slot-scope="scope">
  361. <el-input v-model="scope.row.remark" size="small" />
  362. </template>
  363. </el-table-column>
  364. <el-table-column
  365. align="center"
  366. label="实装物料编号"
  367. prop="realMaterialNumber"
  368. min-width="150"
  369. show-overflow-tooltip
  370. >
  371. <template slot-scope="scope">
  372. <el-input
  373. v-model="scope.row.realMaterialNumber"
  374. :class="scope.row.realMaterialNumber !== scope.row.materialNumber ? 'input' : ''"
  375. size="small"
  376. readonly
  377. @click.native="getRealMaterData(scope.$index)"
  378. />
  379. </template>
  380. </el-table-column>
  381. <el-table-column
  382. align="center"
  383. label="实装厂产品编码"
  384. prop="realMaterialOldNumber"
  385. min-width="200"
  386. show-overflow-tooltip
  387. >
  388. <template slot-scope="scope">
  389. <el-input
  390. v-model="scope.row.realMaterialOldNumber"
  391. :class="scope.row.realMaterialOldNumber !== scope.row.materialOldNumber ? 'input' : ''"
  392. size="small"
  393. readonly
  394. @click.native="getRealMaterData(scope.$index)"
  395. />
  396. </template>
  397. </el-table-column>
  398. <el-table-column align="center" label="税率" prop="tax" min-width="100" show-overflow-tooltip />
  399. <!-- <el-table-column align="center" label="总仓库" prop="status1" min-width="100" show-overflow-tooltip>
  400. <template slot-scope="scope">
  401. <div>{{ scope.row.status1 | status1Filter }}</div>
  402. </template>
  403. </el-table-column> -->
  404. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  405. <el-table-column align="center" label="仓库状态" prop="status2" min-width="100" show-overflow-tooltip>
  406. <template slot-scope="scope">
  407. <div>{{ status2Filter(scope.row) }}</div>
  408. </template>
  409. </el-table-column>
  410. <!-- <el-table-column align="center" label="业务员" prop="serviceId" min-width="160" show-overflow-tooltip>
  411. <template slot-scope="scope">
  412. <el-select v-model="scope.row.serviceId" placeholder="选择业务员" size="small" clearable disabled>
  413. <el-option
  414. v-for="item in salesmanList"
  415. :key="item.adminUserId"
  416. :label="item.nickName"
  417. :value="item.adminUserId">
  418. </el-option>
  419. </el-select>
  420. </template>
  421. </el-table-column> -->
  422. <el-table-column align="center" label="操作" width="100" fixed="right">
  423. <template slot-scope="scope">
  424. <el-button type="text" @click="deleteItem(scope.$index)">删除</el-button>
  425. </template>
  426. </el-table-column>
  427. </el-table>
  428. </div>
  429. <div class="page-footer">
  430. <div class="footer">
  431. <el-button type="primary" :loading="formLoading" @click="clickSubmitForm(1)">保 存</el-button>
  432. <el-button type="primary" :loading="formLoading" @click="clickSubmitForm(2)">提交审核</el-button>
  433. <el-popconfirm v-if="!isDealer" title="确定关闭吗?" style="margin-left: 10px" @onConfirm="goBack">
  434. <el-button slot="reference">返回列表</el-button>
  435. </el-popconfirm>
  436. </div>
  437. </div>
  438. <!-- 工程登录列表 -->
  439. <el-dialog title="工程登录列表" :visible.sync="isShowDialog" width="70%" :close-on-click-modal="false">
  440. <el-form
  441. ref="screenForm"
  442. :model="screenForm"
  443. label-width="0"
  444. size="small"
  445. label-position="left"
  446. v-if="mainForm.examineStatus !== 'SAVE'"
  447. >
  448. <el-row :gutter="20">
  449. <el-col :xs="24" :sm="12" :lg="6">
  450. <el-form-item prop="loginNum">
  451. <el-input v-model="screenForm.loginNum" placeholder="工程登录编号" />
  452. </el-form-item>
  453. </el-col>
  454. <el-col :xs="24" :sm="12" :lg="6">
  455. <el-form-item prop="enginName">
  456. <el-input v-model="screenForm.enginName" placeholder="工程类别" />
  457. </el-form-item>
  458. </el-col>
  459. <el-col :xs="24" :sm="12" :lg="6">
  460. <el-form-item prop="company">
  461. <el-input v-model="screenForm.company" placeholder="使用单位" />
  462. </el-form-item>
  463. </el-col>
  464. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  465. <el-form-item label="">
  466. <el-button size="small" @click="resetScreenForm">清空</el-button>
  467. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  468. </el-form-item>
  469. </el-col>
  470. </el-row>
  471. </el-form>
  472. <div class="table" style="margin: 10px 0 20px">
  473. <el-table
  474. v-loading="dialogTable_listLoading"
  475. :data="dialogTable_dataList"
  476. element-loading-text="Loading"
  477. tooltip-effect="dark"
  478. style="width: 100%"
  479. max-height="270"
  480. >
  481. <el-table-column align="center" label="" width="100">
  482. <template slot-scope="scope">
  483. <el-button type="primary" size="small" @click="chooseItem(scope.row.recordNo, scope.row.userid)"
  484. >选择
  485. </el-button
  486. >
  487. </template>
  488. </el-table-column>
  489. <el-table-column align="center" prop="checkTime" label="工程登录日期" show-overflow-tooltip />
  490. <el-table-column align="center" prop="recordNo" label="工程登录编号" show-overflow-tooltip />
  491. <el-table-column align="center" prop="projectName" label="项目类别" show-overflow-tooltip />
  492. <el-table-column align="center" prop="useUnit" label="使用单位" show-overflow-tooltip />
  493. <el-table-column align="center" prop="organizationName" label="经销商" show-overflow-tooltip />
  494. </el-table>
  495. </div>
  496. <div class="pagination clearfix">
  497. <div class="fr">
  498. <el-pagination
  499. :current-page="dialogTable_currentPage"
  500. :page-size="dialogTable_pageSize"
  501. background
  502. layout="prev, pager, next"
  503. :total="dialogTable_listTotal"
  504. @current-change="dialogTableCurrentChange"
  505. />
  506. </div>
  507. </div>
  508. <div slot="footer" class="dialog-footer">
  509. <el-button @click="isShowDialog = false">关 闭</el-button>
  510. </div>
  511. </el-dialog>
  512. <el-dialog title="添加产品" :visible.sync="isShowGoodsDialog" width="80%">
  513. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  514. <el-row :gutter="20">
  515. <el-col :xs="12" :sm="6" :lg="6">
  516. <el-form-item prop="proNum">
  517. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入物料编码" />
  518. </el-form-item>
  519. </el-col>
  520. <el-col :xs="12" :sm="6" :lg="6">
  521. <el-form-item prop="proName">
  522. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称" />
  523. </el-form-item>
  524. </el-col>
  525. <el-col :xs="12" :sm="6" :lg="6">
  526. <el-form-item prop="proModel">
  527. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号" />
  528. </el-form-item>
  529. </el-col>
  530. <el-col :xs="12" :sm="6" :lg="6">
  531. <el-form-item prop="price1" style="display: flex">
  532. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%" />
  533. <span> - </span>
  534. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%" />
  535. </el-form-item>
  536. </el-col>
  537. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  538. <el-form-item label="">
  539. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  540. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  541. </el-form-item>
  542. </el-col>
  543. </el-row>
  544. </el-form>
  545. <div class="tables">
  546. <div class="table">
  547. <el-table
  548. :data="leftGoodsList"
  549. element-loading-text="Loading"
  550. border
  551. fit
  552. highlight-current-row
  553. stripe
  554. height="400"
  555. @selection-change="leftSelectionChange"
  556. >
  557. <el-table-column align="center" type="selection" width="55" :selectable="checkboxSelect" />
  558. <el-table-column align="center" label="销售类型" prop="saleName" min-width="100" show-overflow-tooltip />
  559. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  560. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  561. <el-table-column
  562. align="center"
  563. label="产品型号"
  564. prop="specification"
  565. min-width="160"
  566. show-overflow-tooltip
  567. />
  568. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  569. </el-table>
  570. <div class="pagination clearfix" style="margin-top: 10px">
  571. <div class="fr">
  572. <el-pagination
  573. :current-page="currentPage"
  574. :page-size="10"
  575. background
  576. layout="prev, pager, next"
  577. :total="listTotal"
  578. @current-change="handleTableCurrentChange"
  579. />
  580. </div>
  581. </div>
  582. </div>
  583. <div class="buttons">
  584. <el-button size="small" type="primary" @click="addAllGoods">全部添加</el-button>
  585. <el-button size="small" type="primary" @click="addGoods">添&emsp;加</el-button>
  586. <el-button size="small" type="danger" @click="deleteGoods">删&emsp;除</el-button>
  587. <el-button size="small" type="danger" @click="deleteAllGoods">全部删除</el-button>
  588. </div>
  589. <div class="table">
  590. <el-table
  591. :data="rightGoodsList"
  592. element-loading-text="Loading"
  593. border
  594. fit
  595. highlight-current-row
  596. stripe
  597. height="400"
  598. @selection-change="rightSelectionChange"
  599. >
  600. <el-table-column align="center" type="selection" width="55" />
  601. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  602. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  603. <el-table-column
  604. align="center"
  605. label="产品型号"
  606. prop="specification"
  607. min-width="160"
  608. show-overflow-tooltip
  609. />
  610. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  611. </el-table>
  612. </div>
  613. </div>
  614. <span slot="footer" class="dialog-footer">
  615. <el-button @click="closeDialog">取 消</el-button>
  616. <el-button type="primary" @click="submitAddGoods">确 定</el-button>
  617. </span>
  618. </el-dialog>
  619. <el-dialog title="添加产品" :visible.sync="isSetMaterial" width="80%">
  620. <el-form ref="goodsScreenForm" :model="goodsScreenForm" size="small" label-position="left">
  621. <el-row :gutter="20">
  622. <el-col :xs="12" :sm="6" :lg="6">
  623. <el-form-item prop="proNum">
  624. <el-input v-model="goodsScreenForm.proNum" placeholder="请输入物料编码" />
  625. </el-form-item>
  626. </el-col>
  627. <el-col :xs="12" :sm="6" :lg="6">
  628. <el-form-item prop="proName">
  629. <el-input v-model="goodsScreenForm.proName" placeholder="请输入产品名称" />
  630. </el-form-item>
  631. </el-col>
  632. <el-col :xs="12" :sm="6" :lg="6">
  633. <el-form-item prop="proModel">
  634. <el-input v-model="goodsScreenForm.proModel" placeholder="请输入产品型号" />
  635. </el-form-item>
  636. </el-col>
  637. <el-col :xs="12" :sm="6" :lg="6">
  638. <el-form-item prop="price1" style="display: flex">
  639. <el-input v-model="goodsScreenForm.price1" placeholder="请输入价格" style="width: 46%" />
  640. <span> - </span>
  641. <el-input v-model="goodsScreenForm.price2" placeholder="请输入价格" style="width: 46%" />
  642. </el-form-item>
  643. </el-col>
  644. <el-col :xs="24" :sm="24" :lg="24" class="tr">
  645. <el-form-item label="">
  646. <el-button size="small" @click="resetGoodsScreenForm">清空</el-button>
  647. <el-button size="small" type="primary" @click="submitGoodsScreenForm">搜索</el-button>
  648. </el-form-item>
  649. </el-col>
  650. </el-row>
  651. </el-form>
  652. <div>
  653. <el-table :data="leftGoodsList" element-loading-text="Loading" border fit stripe height="400">
  654. <el-table-column align="center" width="55">
  655. <template slot-scope="scope">
  656. <el-radio v-model="currentRadio" :label="scope.row.id">{{ '' }}</el-radio>
  657. </template>
  658. </el-table-column>
  659. <el-table-column align="center" label="销售类型" prop="saleName" min-width="100" show-overflow-tooltip />
  660. <el-table-column align="center" label="物料编码" prop="number" min-width="100" show-overflow-tooltip />
  661. <el-table-column
  662. align="center"
  663. label="产品编码"
  664. prop="materialOldNumber"
  665. min-width="100"
  666. show-overflow-tooltip
  667. />
  668. <el-table-column align="center" label="产品名称" prop="name" min-width="160" show-overflow-tooltip />
  669. <el-table-column align="center" label="产品型号" prop="specification" min-width="160" show-overflow-tooltip />
  670. <el-table-column align="center" label="产品价格" prop="batchPrice" min-width="80" show-overflow-tooltip />
  671. </el-table>
  672. <div class="pagination clearfix" style="margin-top: 10px">
  673. <div class="fr">
  674. <el-pagination
  675. :current-page="currentPage"
  676. :page-size="10"
  677. background
  678. layout="prev, pager, next"
  679. :total="listTotal"
  680. @current-change="handleTableCurrentChange"
  681. />
  682. </div>
  683. </div>
  684. </div>
  685. <span slot="footer" class="dialog-footer">
  686. <el-button @click="closeDialog">取 消</el-button>
  687. <el-button type="primary" @click="submitPushGoods">确 定</el-button>
  688. </span>
  689. </el-dialog>
  690. </div>
  691. </template>
  692. <script>
  693. import {
  694. getOrderDetail,
  695. getHomeLoginList,
  696. getHomeLoginDetail,
  697. getWarehouseList,
  698. addHome,
  699. editHome,
  700. submitHome,
  701. checkStock,
  702. getRetailProductList
  703. } from '@/api/supply/engin'
  704. import { getDictList, getHomeTypeList, getSalesmanList } from '@/api/common'
  705. import { findElem } from '@/utils/util'
  706. let that
  707. export default {
  708. name: 'HomeForm',
  709. componentName: 'HomeForm',
  710. filters: {
  711. status1Filter(val) {
  712. const STOCK_ORDER_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_START').dictValue
  713. const STOCK_ORDER_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_END').dictValue
  714. const STOCK_ORDER_HAVE_START = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_START').dictValue
  715. const STOCK_ORDER_HAVE_END = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_HAVE_END').dictValue
  716. const STOCK_ORDER_ALL_NUM = that.stockList.find(o => o.dictCode == 'STOCK_ORDER_ALL_NUM').dictValue
  717. if (val === '' || val === null || val === undefined) {
  718. return '未检查'
  719. } else if (val <= 0) {
  720. return '无货'
  721. } else if (val > STOCK_ORDER_START && val <= STOCK_ORDER_END) {
  722. return val
  723. } else if (val >= STOCK_ORDER_HAVE_START && val <= STOCK_ORDER_HAVE_END) {
  724. return '有货'
  725. } else if (val > STOCK_ORDER_ALL_NUM) return '充足'
  726. }
  727. },
  728. props: ['listItem'],
  729. data() {
  730. return {
  731. editId: '',
  732. mainForm: {
  733. customerId: '',
  734. orderNum: '',
  735. orderDate: '',
  736. type: '',
  737. jxsNum: '',
  738. jxsName: '',
  739. loginNum: '',
  740. enginName: '',
  741. loginType: '',
  742. promiseStatus: '',
  743. factoryNum: '',
  744. company: '',
  745. saleType: '',
  746. contactMan: '',
  747. tel: '',
  748. phone: '',
  749. address: '',
  750. declareNo: '',
  751. greeRemark: '',
  752. greeReply: '',
  753. remark: '',
  754. createMan: '',
  755. createDate: '',
  756. fileNum: '',
  757. loginUserId: '',
  758. salesMan: '',
  759. projectRemark: '',
  760. projectType: '',
  761. examineRemark: '',
  762. refCount: '',
  763. regionWork: '',
  764. examineStatus: '',
  765. refBuyUnitName: '',
  766. refPromiseProvide: '',
  767. refOtherAnnexIdea: ''
  768. },
  769. mainFormRules: {
  770. // orderDate: [{ required: true, message: '请选择单据日期', trigger: 'change' }],
  771. jxsNum: [{ required: true, message: '请输入经销商编码', trigger: 'blur' }],
  772. jxsName: [{ required: true, message: '请输入经销商名称', trigger: 'blur' }],
  773. loginNum: [{ required: true, message: '请输入工程登录编号', trigger: 'blur' }],
  774. // enginName: [{ required: true, message: '请输入项目类别', trigger: 'blur' }],
  775. // loginType: [{ required: true, message: '请输入行业类别', trigger: 'blur' }],
  776. company: [{ required: true, message: '请输入使用单位', trigger: 'blur' }],
  777. saleType: [{ required: true, message: '请选择销售类型', trigger: 'change' }],
  778. // contactMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
  779. // tel: [{ required: true, message: '请输入固定电话', trigger: 'blur' }],
  780. // phone: [{ required: true, message: '请输入移动电话', trigger: 'blur' }],
  781. address: [{ required: true, message: '请输入安装地址', trigger: 'blur' }]
  782. },
  783. salesTypeList: [],
  784. // typeList: [],
  785. stockList: [],
  786. goodsList: [],
  787. isShowDialog: false, // 工程登录列表 - 弹窗
  788. screenForm: {
  789. loginNum: '',
  790. enginName: '',
  791. company: ''
  792. },
  793. dialogTable_dataList: null, // 工程登录列表 - 列表数据
  794. dialogTable_listLoading: true, // 工程登录列表 - 列表加载loading
  795. dialogTable_currentPage: 1, // 工程登录列表 - 当前页码
  796. dialogTable_pageSize: 10, // 工程登录列表 - 每页数量
  797. dialogTable_listTotal: 0, // 工程登录列表 - 列表总数
  798. warehouseList: [],
  799. warehouseValue: '',
  800. isShowGoodsDialog: false,
  801. goodsScreenForm: {
  802. proNum: '',
  803. proName: '',
  804. proModel: '',
  805. price1: '',
  806. price2: ''
  807. },
  808. currentPage: 1,
  809. listTotal: 0,
  810. leftGoodsList: [],
  811. rightGoodsList: [],
  812. leftSelection: [],
  813. rightSelection: [],
  814. formLoading: false,
  815. isFirst: false,
  816. salesmanList: [],
  817. oldSaleType: '',
  818. notInRefQueryGoodsList: '',
  819. isSetMaterial: false,
  820. currentId: '',
  821. currentRadio: ''
  822. }
  823. },
  824. computed: {
  825. isDealer() {
  826. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  827. },
  828. outSalesmanList() {
  829. const list = []
  830. if (this.goodsList && this.goodsList.length) {
  831. this.goodsList.forEach(item => {
  832. if (item.serviceId) {
  833. const hasItem = findElem(list, 'adminUserId', item.serviceId)
  834. if (hasItem < 0) {
  835. const obj = this.salesmanList.find(o => o.adminUserId == item.serviceId)
  836. if (obj) {
  837. list.push(obj)
  838. }
  839. }
  840. }
  841. })
  842. if (this.isFirst) {
  843. this.isFirst = false
  844. } else {
  845. this.mainForm.salesMan = this.goodsList[0].serviceId
  846. }
  847. }
  848. return list
  849. }
  850. },
  851. watch: {
  852. goodsList: {
  853. handler(newValue, oldValue) {
  854. if (newValue && newValue.length) {
  855. newValue.forEach((item, index) => {
  856. this.goodsList[index].compute_sfAmount =
  857. (item.price * item.qty * 100 -
  858. ((item.price * item.qty * (item.rebateRate * 100)) / 100) * 100 -
  859. ((item.qty * (item.discAmount * 100)) / 100) * 100) /
  860. 100
  861. this.goodsList[index].compute_flAmount = (item.price * item.qty * (item.rebateRate * 100)) / 100
  862. this.goodsList[index].ko = item.qty * item.discAmount
  863. this.goodsList[index].dida = item.price * item.qty
  864. })
  865. newValue.forEach(item => {
  866. // 'enginNum', 'directTransferQty', 'hasSendQty', 'retiredQty', 'ko'
  867. // 'price', 'compute_flAmount', 'compute_sfAmount'
  868. item.sums1 = ['qty']
  869. item.sums2 = ['dida']
  870. })
  871. }
  872. if (this.goodsList && this.goodsList.length) {
  873. if (this.isFirst) {
  874. this.isFirst = false
  875. } else {
  876. // this.mainForm.salesMan = this.goodsList[0].serviceId;
  877. }
  878. } else {
  879. this.mainForm.salesMan = ''
  880. }
  881. },
  882. immediate: true,
  883. deep: true
  884. },
  885. 'mainForm.saleType': function(newValue, oldValue) {
  886. this.oldSaleType = oldValue
  887. }
  888. },
  889. beforeCreate() {
  890. that = this
  891. },
  892. async created() {
  893. await this.getSalesmanList()
  894. this.getDictList()
  895. this.getHomeTypeList()
  896. this.getWarehouseList()
  897. if (this.listItem) {
  898. this.isFirst = true
  899. this.editId = this.listItem.parentId
  900. this.getDetail()
  901. } else {
  902. this.mainForm.jxsNum = JSON.parse(localStorage.getItem('supply_user')).customerNumber
  903. this.mainForm.jxsName = JSON.parse(localStorage.getItem('supply_user')).customerName
  904. this.mainForm.createMan = JSON.parse(localStorage.getItem('supply_user')).nickName
  905. this.mainForm.createDate = this.getDate()
  906. }
  907. },
  908. methods: {
  909. // 返回列表
  910. goBack() {
  911. this.$emit('backListFormDetail')
  912. },
  913. getDate() {
  914. var date = new Date()
  915. var seperator1 = '-'
  916. var year = date.getFullYear()
  917. var month = date.getMonth() + 1
  918. var strDate = date.getDate()
  919. if (month >= 1 && month <= 9) {
  920. month = '0' + month
  921. }
  922. if (strDate >= 0 && strDate <= 9) {
  923. strDate = '0' + strDate
  924. }
  925. var currentdate = year + seperator1 + month + seperator1 + strDate
  926. return currentdate
  927. },
  928. // 获取产品大类列表
  929. getDictList() {
  930. // getDictList({sysDictEnum: 'PRODUCT_TYPE'}).then(res => {
  931. // this.typeList = res.data;
  932. // })
  933. getDictList({ sysDictEnum: 'STOCK_ORDER' }).then(res => {
  934. this.stockList = res.data
  935. })
  936. },
  937. // 获取家用销售类型列表
  938. getHomeTypeList() {
  939. getHomeTypeList().then(res => {
  940. this.salesTypeList = res.data
  941. console.log(res.data)
  942. })
  943. },
  944. // 获取仓库列表
  945. getWarehouseList() {
  946. getWarehouseList({
  947. pageNum: 1,
  948. pageSize: -1
  949. }).then(res => {
  950. this.warehouseList = res.data.records
  951. })
  952. },
  953. async getSalesmanList() {
  954. const res = await getSalesmanList({
  955. pageNum: 1,
  956. pageSize: -1,
  957. isCustomer: 0,
  958. status: true
  959. })
  960. this.salesmanList = res.data.records
  961. },
  962. // 工程登录列表 - 获取列表
  963. getHomeLoginList() {
  964. getHomeLoginList({
  965. pageNum: this.dialogTable_currentPage,
  966. pageSize: this.dialogTable_pageSize,
  967. recordNo: this.screenForm.loginNum,
  968. projectName: this.screenForm.enginName,
  969. useUnit: this.screenForm.company,
  970. refEnginRecordNo: this.mainForm.loginNum,
  971. examineStatus: 'OK',
  972. }).then(res => {
  973. this.dialogTable_dataList = res.data.records
  974. this.dialogTable_listTotal = res.data.total
  975. this.dialogTable_listLoading = false
  976. })
  977. },
  978. // 工程登录列表 - 打开弹窗
  979. openShareDetail() {
  980. if (!this.mainForm.saleType) {
  981. return this.$errorMsg('请先选择销售类型')
  982. }
  983. this.isShowDialog = true
  984. this.dialogTable_currentPage = 1
  985. this.screenForm.loginNum = this.mainForm.loginNum
  986. this.getHomeLoginList()
  987. },
  988. // 工程登录列表 - 更改列表当前页
  989. dialogTableCurrentChange(val) {
  990. this.dialogTable_currentPage = val
  991. this.getHomeLoginList()
  992. },
  993. // 提交筛选表单
  994. submitScreenForm() {
  995. this.dialogTable_currentPage = 1
  996. this.getHomeLoginList()
  997. },
  998. // 重置筛选表单
  999. resetScreenForm() {
  1000. this.$refs.screenForm.resetFields()
  1001. this.dialogTable_currentPage = 1
  1002. this.getHomeLoginList()
  1003. },
  1004. // 选择工程登录
  1005. async chooseItem(id, uid, isChangeSaleType = false) {
  1006. const isCustomer = JSON.parse(localStorage.getItem('supply_user')).isCustomer
  1007. let customerId = JSON.parse(localStorage.getItem('supply_user')).customerId
  1008. if (!isCustomer) {
  1009. customerId = this.mainForm.customerId
  1010. }
  1011. getHomeLoginDetail({
  1012. recordNo: id,
  1013. saleTypeId: this.mainForm.saleType,
  1014. userId: uid,
  1015. enginOrderId: this.mainForm.orderNum,
  1016. customerId: customerId,
  1017. refEnginRecordNo: this.mainForm.loginNum
  1018. })
  1019. .then(async res => {
  1020. // 复制当前明细数据
  1021. const copyGoodsList = JSON.parse(JSON.stringify(this.goodsList))
  1022. console.log('未刷新前', copyGoodsList)
  1023. if (!isChangeSaleType) {
  1024. this.setMainAndItem(res.data)
  1025. } else {
  1026. // 找出不属于引用单上的产品
  1027. if (copyGoodsList && copyGoodsList.length > 0) {
  1028. const notInRefGoodsList = []
  1029. for (let i = 0; i < copyGoodsList.length; i++) {
  1030. const goods = copyGoodsList[i]
  1031. const index = res.data.items.findIndex(v => v.materialOldNumber === goods.materialOldNumber)
  1032. if (index < 0) {
  1033. notInRefGoodsList.push(goods)
  1034. }
  1035. }
  1036. if (notInRefGoodsList && notInRefGoodsList.length > 0) {
  1037. const oldNumbers = []
  1038. notInRefGoodsList.forEach(v => oldNumbers.push(v.materialOldNumber))
  1039. console.log('请求前可选机型接口', notInRefGoodsList, oldNumbers)
  1040. // 请求可选机型接口
  1041. await this.querySaleTypeGoods(oldNumbers)
  1042. console.log('返回新加明细', this.notInRefQueryGoodsList)
  1043. if (!this.notInRefQueryGoodsList) {
  1044. console.log('结束执行下去')
  1045. return
  1046. }
  1047. this.addRefItems(res.data.items, notInRefGoodsList)
  1048. }
  1049. // 数量和价格不变更
  1050. console.log('执行下去,数量和价格不变更')
  1051. }
  1052. console.log('替换前', res.data.items)
  1053. res.data.items = this.replaceHistoryItems(res.data.items, copyGoodsList)
  1054. console.log('替换后', res.data.items)
  1055. this.setMainAndItem(res.data)
  1056. }
  1057. })
  1058. .catch(() => {
  1059. this.mainForm.saleType = this.oldSaleType
  1060. })
  1061. },
  1062. // 选择销售类型
  1063. changeSaleType() {
  1064. if (this.mainForm.loginNum) {
  1065. this.chooseItem(this.mainForm.loginNum, this.mainForm.loginUserId, true)
  1066. }
  1067. },
  1068. // 删除产品
  1069. deleteItem(index) {
  1070. this.goodsList.splice(index, 1)
  1071. },
  1072. // 修改返利钱包
  1073. changeFlWallet(index) {
  1074. if (this.goodsList[index].customerWalletId2) {
  1075. const obj = this.goodsList[index].rebateWallets.find(
  1076. o => o.customerWalletId == this.goodsList[index].customerWalletId2
  1077. )
  1078. this.goodsList[index].rebateRate = obj.rebateRate
  1079. this.goodsList[index].customerWalletName2 = obj.customerWalletName
  1080. } else {
  1081. this.goodsList[index].rebateRate = ''
  1082. this.goodsList[index].customerWalletName2 = ''
  1083. }
  1084. },
  1085. // 修改现金钱包
  1086. changeXjWallet(index) {
  1087. if (this.goodsList[index].customerWalletId) {
  1088. const obj = this.goodsList[index].wallets.find(
  1089. o => o.customerWalletId == this.goodsList[index].customerWalletId
  1090. )
  1091. this.goodsList[index].customerWalletName = obj.customerWalletName
  1092. this.goodsList[index].serviceId = obj.serviceId
  1093. this.goodsList[index].serviceName = obj.serviceName
  1094. } else {
  1095. this.goodsList[index].customerWalletName = ''
  1096. this.goodsList[index].serviceId = ''
  1097. this.goodsList[index].serviceName = ''
  1098. }
  1099. },
  1100. // 获取详情
  1101. getDetail() {
  1102. getOrderDetail({ id: this.editId }).then(res => {
  1103. const data = res.data
  1104. this.mainForm.customerId = data.customerId
  1105. this.mainForm.orderNum = data.enginOrderId
  1106. this.mainForm.orderDate = data.orderDate
  1107. this.mainForm.type = data.mainId
  1108. this.mainForm.jxsNum = data.customerNumber
  1109. this.mainForm.jxsName = data.customerName
  1110. this.mainForm.loginNum = data.refEnginRecordNo
  1111. this.mainForm.enginName = data.refProjectCategory
  1112. this.mainForm.loginType = data.refTradeCategory
  1113. this.mainForm.promiseStatus = data.refPromiseStatus
  1114. this.mainForm.factoryNum = data.refFactoryNo
  1115. this.mainForm.company = data.refUseUnit
  1116. this.mainForm.saleType = data.saleTypeId
  1117. this.mainForm.contactMan = data.refLinkman
  1118. this.mainForm.tel = data.refTel
  1119. this.mainForm.phone = data.refPhone
  1120. this.mainForm.address = data.refInstallAddress
  1121. this.mainForm.declareNo = data.refDeclareNo
  1122. this.mainForm.refCount = data.refCount
  1123. this.mainForm.greeRemark = data.geLiInerNote
  1124. this.mainForm.greeReply = data.note1
  1125. this.mainForm.remark = data.remark
  1126. this.mainForm.createMan = data.createName
  1127. this.mainForm.createDate = data.createTime
  1128. this.mainForm.fileNum = data.fileNo
  1129. this.mainForm.salesMan = data.serviceId
  1130. this.mainForm.projectRemark = data.refProjectNote
  1131. this.mainForm.projectType = data.refProjectType
  1132. this.mainForm.examineRemark = data.examineNote
  1133. this.mainForm.loginUserId = data.loginUserId
  1134. this.mainForm.regionWork = data.refRegionWork
  1135. this.mainForm.examineStatus = data.examineStatus
  1136. this.mainForm.refBuyUnitName = data.refBuyUnitName
  1137. this.mainForm.refPromiseProvide = data.refPromiseProvide
  1138. data.items.forEach(item => {
  1139. item.status1 = ''
  1140. item.status2 = ''
  1141. item.rebateWallets = item.customerWalletList.filter(item => {
  1142. return item.type === 'REBATE'
  1143. })
  1144. item.wallets = item.customerWalletList.filter(item => {
  1145. return item.type === 'COMMONLY'
  1146. })
  1147. })
  1148. this.goodsList = data.items
  1149. })
  1150. },
  1151. // 获取商品列表
  1152. getGoodsList() {
  1153. getRetailProductList({
  1154. pageNum: this.currentPage,
  1155. pageSize: 10,
  1156. saleId: this.mainForm.saleType,
  1157. billType: 'HOME',
  1158. materialCode: this.goodsScreenForm.proNum,
  1159. materialName: this.goodsScreenForm.proName,
  1160. specification: this.goodsScreenForm.proModel,
  1161. price1: this.goodsScreenForm.price1,
  1162. price2: this.goodsScreenForm.price2,
  1163. refEnginRecordNo: this.mainForm.loginNum,
  1164. customerId: this.listItem ? this.listItem.customerId : ''
  1165. }).then(res => {
  1166. const oldGoodsList = this.goodsList
  1167. const newGoodsList = res.data.records
  1168. for (let i = 0; i < oldGoodsList.length; i++) {
  1169. const oldItem = oldGoodsList[i]
  1170. for (let j = 0; j < newGoodsList.length; j++) {
  1171. const newItem = newGoodsList[j]
  1172. if (newItem.id === oldItem.id) {
  1173. newGoodsList[j].selected = true
  1174. break
  1175. }
  1176. }
  1177. }
  1178. res.data.records.forEach(item => {
  1179. item.materialName = item.name
  1180. item.materialCode = item.number
  1181. item.saleTypeName = item.saleName
  1182. item.unit = item.baseUnit
  1183. item.enginNum = 0
  1184. item.qty = 0
  1185. item.price = item.batchPrice
  1186. item.tax = item.taxRate
  1187. item.isDirectTransfer = false
  1188. item.directTransferQty = ''
  1189. item.status1 = ''
  1190. item.status2 = ''
  1191. item.rebateAmount = ''
  1192. item.rebateRate = ''
  1193. item.productPriceId = item.id
  1194. item.customerWalletId = item.wallets && item.wallets.length ? item.wallets[0].customerWalletId : ''
  1195. })
  1196. this.leftGoodsList = res.data.records
  1197. this.listTotal = res.data.total
  1198. })
  1199. },
  1200. // 查询重复值并禁选
  1201. checkboxSelect(row, rowIndex) {
  1202. if (row.selected) {
  1203. return false // 禁用
  1204. } else {
  1205. return true // 不禁用
  1206. }
  1207. },
  1208. // 点击 选择商品
  1209. openDialog() {
  1210. if (!this.mainForm.saleType) {
  1211. return this.$errorMsg('请先选择销售类型')
  1212. }
  1213. this.isShowGoodsDialog = true
  1214. this.getGoodsList()
  1215. },
  1216. // 提交筛选表单
  1217. submitGoodsScreenForm() {
  1218. this.currentPage = 1
  1219. this.getGoodsList()
  1220. },
  1221. // 重置筛选表单
  1222. resetGoodsScreenForm() {
  1223. this.$refs.goodsScreenForm.resetFields()
  1224. this.currentRadio = ''
  1225. this.currentPage = 1
  1226. this.getGoodsList()
  1227. },
  1228. // 更改列表当前页
  1229. handleTableCurrentChange(val) {
  1230. this.currentPage = val
  1231. this.getGoodsList()
  1232. },
  1233. // 关闭 弹窗
  1234. closeDialog() {
  1235. this.isShowGoodsDialog = false
  1236. this.isSetMaterial = false
  1237. },
  1238. // 左侧列表选择
  1239. leftSelectionChange(val) {
  1240. this.leftSelection = val
  1241. },
  1242. // 右侧列表选择
  1243. rightSelectionChange(val) {
  1244. this.rightSelection = val
  1245. },
  1246. // 数组去重
  1247. delRepeat(arr1, arr2) {
  1248. const allArr = arr1.concat(arr2) // 两个数组对象合并
  1249. const newArr = [] // 存放去重后数据的新数组
  1250. for (let i = 0; i < allArr.length; i++) {
  1251. // 循环allArr数组对象的内容
  1252. let flag = true // 建立标记,判断数据是否重复,true为不重复
  1253. for (let j = 0; j < newArr.length; j++) {
  1254. // 循环新数组的内容
  1255. if (allArr[i].id == newArr[j].id) {
  1256. // 让allArr数组对象的内容与新数组的内容作比较,相同的话,改变标记为false
  1257. flag = false
  1258. }
  1259. }
  1260. if (flag) {
  1261. // 判断是否重复
  1262. newArr.push(allArr[i]) // 不重复的放入新数组。 新数组的内容会继续进行上边的循环。
  1263. }
  1264. }
  1265. return newArr
  1266. },
  1267. // 全部添加
  1268. addAllGoods() {
  1269. this.rightGoodsList = this.delRepeat(this.leftGoodsList, this.rightGoodsList)
  1270. },
  1271. // 添加
  1272. addGoods() {
  1273. this.rightGoodsList = this.delRepeat(this.leftSelection, this.rightGoodsList)
  1274. },
  1275. // 删除
  1276. deleteGoods() {
  1277. const rightGoodsList = this.rightGoodsList
  1278. const rightSelection = this.rightSelection
  1279. for (let i = 0; i < rightGoodsList.length; i++) {
  1280. for (let j = 0; j < rightSelection.length; j++) {
  1281. if (rightSelection[j].materialId == rightGoodsList[i].materialId) {
  1282. this.rightGoodsList.splice(i, 1)
  1283. }
  1284. }
  1285. }
  1286. },
  1287. // 全部删除
  1288. deleteAllGoods() {
  1289. this.rightGoodsList = []
  1290. },
  1291. // 确定 添加产品
  1292. submitAddGoods() {
  1293. // this.goodsList = this.delRepeat(this.rightGoodsList, this.goodsList);
  1294. this.goodsList = this.goodsList.concat(this.rightGoodsList)
  1295. this.goodsList.forEach((k, i) => {
  1296. this.$set(this.goodsList[i], 'realMaterialId', k.materialId)
  1297. this.$set(this.goodsList[i], 'realMaterialName', k.materialName)
  1298. this.$set(this.goodsList[i], 'realMaterialNumber', k.materialNumber)
  1299. this.$set(this.goodsList[i], 'realMaterialOldNumber', k.materialOldNumber)
  1300. this.$set(this.goodsList[i], 'realSpecification', k.specification)
  1301. if (!this.listItem) {
  1302. const str = `实装物料编号:${k.materialNumber}实装厂产品编码:${k.materialOldNumber}`
  1303. let remark
  1304. if (!this.goodsList[i].remark) {
  1305. remark = str
  1306. } else {
  1307. remark = this.goodsList[i].remark.replace(/str/g, str)
  1308. }
  1309. this.$set(this.goodsList[i], 'remark', remark)
  1310. }
  1311. })
  1312. this.isShowGoodsDialog = false
  1313. this.leftGoodsList = []
  1314. this.rightGoodsList = []
  1315. },
  1316. getRealMaterData(id) {
  1317. this.currentId = id
  1318. this.isSetMaterial = true
  1319. this.getGoodsList()
  1320. },
  1321. submitPushGoods() {
  1322. // realMaterialId
  1323. // 实装金蝶物料id
  1324. // realMaterialName
  1325. // 实装金蝶物料名称
  1326. // realMaterialNumber
  1327. // 实装金蝶物料编码
  1328. // realMaterialOldNumber
  1329. // 实装金蝶物料旧编码
  1330. // realSpecification
  1331. // 实装规格型号
  1332. const currentData = this.leftGoodsList.find(e => e.id === this.currentRadio)
  1333. this.$set(this.goodsList[this.currentId], 'realMaterialId', currentData.materialId)
  1334. this.$set(this.goodsList[this.currentId], 'realMaterialName', currentData.materialName)
  1335. this.$set(this.goodsList[this.currentId], 'realMaterialNumber', currentData.materialNumber)
  1336. this.$set(this.goodsList[this.currentId], 'realMaterialOldNumber', currentData.materialOldNumber)
  1337. this.$set(this.goodsList[this.currentId], 'realSpecification', currentData.specification)
  1338. if (!this.listItem) {
  1339. const str = `实装物料编号:${currentData.materialNumber}实装厂产品编码:${currentData.materialOldNumber}`
  1340. let remark
  1341. if (!this.goodsList[this.currentId].remark) {
  1342. remark = str
  1343. } else {
  1344. remark = this.goodsList[this.currentId].remark.replace(/str/g, str)
  1345. }
  1346. this.$set(this.goodsList[this.currentId], 'remark', remark)
  1347. }
  1348. this.isSetMaterial = false
  1349. },
  1350. // 检查库存
  1351. checkStock() {
  1352. if (!this.warehouseValue) {
  1353. return this.$errorMsg('请选择仓库')
  1354. }
  1355. if (!this.goodsList) {
  1356. return this.$errorMsg('请添加货品')
  1357. }
  1358. const ids = []
  1359. this.goodsList.forEach(item => {
  1360. ids.push(item.materialId)
  1361. })
  1362. checkStock({
  1363. correspondId: this.warehouseValue,
  1364. materialId: ids.join(',')
  1365. }).then(res => {
  1366. if (res.data) {
  1367. this.goodsList.forEach((item, index) => {
  1368. item.status1 = res.data[index].allStockNum
  1369. item.status2 = res.data[index].stockNum
  1370. })
  1371. }
  1372. })
  1373. },
  1374. status2Filter(item) {
  1375. if (item.status2 === '' || item.status2 === null || item.status2 === undefined) {
  1376. return '未检查'
  1377. } else if (item.status2 <= 0) return '无货'
  1378. if (item.status2 <= 0) {
  1379. return '无货'
  1380. } else if (item.status2 >= 1 && item.status2 <= 30) {
  1381. return item.status2
  1382. } else if (item.status2 >= 31 && item.status2 <= 1000) {
  1383. return '有货'
  1384. } else {
  1385. return '充足'
  1386. }
  1387. },
  1388. // 保存 / 提交审核
  1389. clickSubmitForm(type) {
  1390. this.$refs.mainForm.validate(valid => {
  1391. if (valid) {
  1392. for (let i = 0; i < this.goodsList.length; i++) {
  1393. if (!this.goodsList[i].customerWalletId) {
  1394. this.$errorMsg('请选择现金钱包')
  1395. return
  1396. }
  1397. if (!Number(this.goodsList[i].qty)) {
  1398. this.$errorMsg('不允许数量为0')
  1399. return
  1400. }
  1401. }
  1402. const goodsList = JSON.parse(JSON.stringify(this.goodsList))
  1403. goodsList.forEach(item => {
  1404. delete item.rebateWallets
  1405. delete item.wallets
  1406. })
  1407. const saleTypeItem = this.salesTypeList.find(o => o.id == this.mainForm.saleType)
  1408. const saleManItem = this.mainForm.salesMan
  1409. ? this.salesmanList.find(o => o.adminUserId == this.mainForm.salesMan)
  1410. : ''
  1411. const params = {
  1412. enginOrderId: this.mainForm.orderNum,
  1413. loginUserId: this.mainForm.loginUserId,
  1414. refEnginRecordNo: this.mainForm.loginNum || '',
  1415. refProjectCategory: this.mainForm.enginName || '',
  1416. refTradeCategory: this.mainForm.loginType || '',
  1417. refPromiseStatus: this.mainForm.promiseStatus || '',
  1418. refFactoryNo: this.mainForm.factoryNum || '',
  1419. refUseUnit: this.mainForm.company || '',
  1420. refLinkman: this.mainForm.contactMan || '',
  1421. refTel: this.mainForm.tel || '',
  1422. refPhone: this.mainForm.phone || '',
  1423. refInstallAddress: this.mainForm.address || '',
  1424. refDeclareNo: this.mainForm.declareNo || '',
  1425. refCount: this.mainForm.refCount || '',
  1426. saleTypeId: this.mainForm.saleType,
  1427. saleTypeCode: saleTypeItem.saleCode,
  1428. saleTypeName: saleTypeItem.saleName,
  1429. geLiInerNote: this.mainForm.greeRemark || '',
  1430. geLiNote: this.mainForm.greeReply || '',
  1431. remark: this.mainForm.remark || '',
  1432. fileNo: this.mainForm.fileNum || '',
  1433. serviceId: this.mainForm.salesMan,
  1434. serviceName: saleManItem ? saleManItem.nickName : goodsList[0].serviceName,
  1435. refProjectNote: this.mainForm.projectRemark,
  1436. refProjectType: this.mainForm.projectType,
  1437. refRegionWork: this.mainForm.regionWork,
  1438. refBuyUnitName: this.mainForm.refBuyUnitName,
  1439. refPromiseProvide: this.mainForm.refPromiseProvide,
  1440. refOtherAnnexIdea: this.mainForm.refOtherAnnexIdea,
  1441. items: goodsList
  1442. }
  1443. if (this.mainForm.examineStatus === 'WAIT') {
  1444. params.takeDeposit = false
  1445. }
  1446. this.formLoading = true
  1447. if (type === 1) {
  1448. if (this.listItem) {
  1449. editHome(params)
  1450. .then(res => {
  1451. this.$successMsg('编辑成功')
  1452. this.goBack()
  1453. this.$parent.getList()
  1454. })
  1455. .finally(res => {
  1456. this.formLoading = false
  1457. })
  1458. } else {
  1459. addHome(params)
  1460. .then(res => {
  1461. this.$successMsg('新增成功')
  1462. this.goBack()
  1463. this.$parent.getList()
  1464. })
  1465. .finally(res => {
  1466. this.formLoading = false
  1467. })
  1468. }
  1469. } else if (type === 2) {
  1470. submitHome(params)
  1471. .then(res => {
  1472. this.$successMsg('提交审核成功')
  1473. this.goBack()
  1474. this.$parent.getList()
  1475. })
  1476. .finally(res => {
  1477. this.formLoading = false
  1478. })
  1479. }
  1480. }
  1481. })
  1482. },
  1483. setMainAndItem(data) {
  1484. this.isShowDialog = false
  1485. this.mainForm.type = data.productCategory
  1486. this.mainForm.loginUserId = data.userid
  1487. // this.mainForm.saleType = '';
  1488. this.mainForm.loginNum = data.recordNo
  1489. this.mainForm.enginName = data.projectName
  1490. this.mainForm.loginType = data.tradeCategory
  1491. this.mainForm.factoryNum = data.factoryNo
  1492. this.mainForm.promiseStatus = data.promiseStatus
  1493. this.mainForm.company = data.useUnit
  1494. this.mainForm.contactMan = data.buyUnitCallMen
  1495. this.mainForm.tel = data.buyUnitTel
  1496. this.mainForm.phone = data.buyUnitPhone
  1497. this.mainForm.address = data.installAddress
  1498. this.mainForm.declareNo = data.declareNo
  1499. this.mainForm.projectRemark = data.buChonShuoMing
  1500. this.mainForm.projectType = data.govBuyType
  1501. this.mainForm.refCount = data.refCount
  1502. this.mainForm.regionWork = data.regionWork
  1503. this.mainForm.refBuyUnitName = data.buyUnitName
  1504. this.mainForm.refPromiseProvide = data.promiseProvide === 1 ? '已保证' : '未保证'
  1505. this.mainForm.refOtherAnnexIdea = data.otherAnnexIdea
  1506. const saleTypeItem = this.salesTypeList.find(o => o.id === this.mainForm.saleType)
  1507. this.goodsList = data.items.map(item => {
  1508. return {
  1509. useRefCount: item.useRefCount,
  1510. saleTypeId: saleTypeItem.id,
  1511. saleTypeCode: saleTypeItem.saleCode,
  1512. saleTypeName: saleTypeItem.saleName,
  1513. materialId: item.materialId,
  1514. materialNumber: item.materialNumber,
  1515. materialOldNumber: item.materialOldNumber,
  1516. materialName: item.materialName,
  1517. specification: item.machine,
  1518. enginNum: item.num,
  1519. enginPrice: item.price,
  1520. enginTotality: item.totality,
  1521. historyHasDeliverQty: item.hasDeliverQty,
  1522. unit: item.unit,
  1523. price: item.price,
  1524. qty: item.num,
  1525. customerWalletId2: '',
  1526. rebateRate: '',
  1527. discAmount: '',
  1528. customerWalletId: '',
  1529. isDirectTransfer: false,
  1530. directTransferQty: '',
  1531. hasSendQty: '',
  1532. remark: item.discri,
  1533. tax: '',
  1534. status1: '',
  1535. status2: '',
  1536. rebateWallets: item.customerWalletList.filter(item => {
  1537. return item.type === 'REBATE'
  1538. }),
  1539. wallets: item.customerWalletList.filter(item => {
  1540. return item.type === 'COMMONLY'
  1541. })
  1542. }
  1543. })
  1544. this.goodsList.forEach((k, i) => {
  1545. this.$set(this.goodsList[i], 'realMaterialId', k.materialId)
  1546. this.$set(this.goodsList[i], 'realMaterialName', k.materialName)
  1547. this.$set(this.goodsList[i], 'realMaterialNumber', k.materialNumber)
  1548. this.$set(this.goodsList[i], 'realMaterialOldNumber', k.materialOldNumber)
  1549. this.$set(this.goodsList[i], 'realSpecification', k.specification)
  1550. if (!this.listItem) {
  1551. const str = `实装物料编号:${k.materialNumber}实装厂产品编码:${k.materialOldNumber}`
  1552. let remark
  1553. if (!this.goodsList[i].remark) {
  1554. remark = str
  1555. } else {
  1556. remark = this.goodsList[i].remark.replace(/str/g, str)
  1557. }
  1558. this.$set(this.goodsList[i], 'remark', remark)
  1559. }
  1560. })
  1561. this.goodsList.forEach(item => {
  1562. item.customerWalletId = item.wallets && item.wallets.length ? item.wallets[0].customerWalletId : ''
  1563. item.serviceId = item.wallets && item.wallets.length ? item.wallets[0].serviceId : ''
  1564. item.serviceName = item.wallets && item.wallets.length ? item.wallets[0].serviceName : ''
  1565. })
  1566. },
  1567. async querySaleTypeGoods(oldNumbers) {
  1568. await getRetailProductList({
  1569. pageNum: 1,
  1570. pageSize: -1,
  1571. saleId: this.mainForm.saleType,
  1572. billType: 'HOME',
  1573. oldNumbers: oldNumbers.join(','),
  1574. customerId: this.mainForm.customerId
  1575. }).then(res => {
  1576. console.log('请求后可选机型接口', res.data.records)
  1577. if (!res.data.records || res.data.records.length === 0) {
  1578. this.mainForm.saleType = this.oldSaleType
  1579. console.log(1)
  1580. this.$errorMsg(oldNumbers.join(',') + ' 产品无此销售类型')
  1581. this.notInRefQueryGoodsList = ''
  1582. return
  1583. }
  1584. if (res.data.records.length < oldNumbers.length) {
  1585. const notInOldNumbers = []
  1586. for (let i = 0; i < oldNumbers.length; i++) {
  1587. const oldNumber = oldNumbers[i]
  1588. const index = res.data.records.findIndex(v => v.materialOldNumber === oldNumber)
  1589. if (index < 0) {
  1590. notInOldNumbers.push(oldNumber)
  1591. }
  1592. }
  1593. this.mainForm.saleType = this.oldSaleType
  1594. console.log(2)
  1595. this.$errorMsg(notInOldNumbers.join(',') + ' 产品无此销售类型')
  1596. this.notInRefQueryGoodsList = ''
  1597. return
  1598. }
  1599. this.notInRefQueryGoodsList = res.data.records
  1600. })
  1601. },
  1602. replaceHistoryItems(items, copyGoodsList) {
  1603. if (items && copyGoodsList) {
  1604. for (let i = 0; i < items.length; i++) {
  1605. const index = copyGoodsList.findIndex(v => v.materialOldNumber === items[i].materialOldNumber)
  1606. if (index >= 0) {
  1607. items[i].price = copyGoodsList[index].price
  1608. items[i].num = copyGoodsList[index].qty
  1609. items[i].discri = copyGoodsList[index].remark
  1610. }
  1611. }
  1612. }
  1613. return items
  1614. },
  1615. addRefItems(items, notInRefGoodsList) {
  1616. if (notInRefGoodsList && this.notInRefQueryGoodsList) {
  1617. for (let i = 0; i < notInRefGoodsList.length; i++) {
  1618. const index = this.notInRefQueryGoodsList.findIndex(
  1619. v => v.materialOldNumber === notInRefGoodsList[i].materialOldNumber
  1620. )
  1621. if (index >= 0) {
  1622. this.notInRefQueryGoodsList[index].batchPrice = notInRefGoodsList[i].price
  1623. this.notInRefQueryGoodsList[index].qty = notInRefGoodsList[i].qty
  1624. this.notInRefQueryGoodsList[index].remark = notInRefGoodsList[i].remark
  1625. }
  1626. }
  1627. console.log('非引用单产品', this.notInRefQueryGoodsList)
  1628. for (let i = 0; i < this.notInRefQueryGoodsList.length; i++) {
  1629. const goods = this.notInRefQueryGoodsList[i]
  1630. const customerWalletList = [].concat(goods.rebateWallets).concat(goods.wallets)
  1631. items.push({
  1632. saleTypeId: goods.saleTypeId,
  1633. saleTypeCode: goods.saleTypeCode,
  1634. saleTypeName: goods.saleTypeName,
  1635. materialId: goods.materialId,
  1636. materialNumber: goods.materialNumber,
  1637. materialOldNumber: goods.materialOldNumber,
  1638. materialName: goods.materialName,
  1639. machine: goods.specification,
  1640. num: goods.qty,
  1641. batchPrice: goods.batchPrice,
  1642. discri: goods.remark,
  1643. customerWalletList: customerWalletList
  1644. })
  1645. }
  1646. }
  1647. }
  1648. }
  1649. }
  1650. </script>
  1651. <style scoped lang="scss">
  1652. ::v-deep .input .el-input__inner {
  1653. color: blue;
  1654. }
  1655. .detail-container {
  1656. width: 100%;
  1657. height: 100%;
  1658. }
  1659. .main-title {
  1660. display: flex;
  1661. justify-content: space-between;
  1662. align-items: center;
  1663. margin-top: 20px;
  1664. height: 60px;
  1665. border-bottom: 1px solid #dcdfe6;
  1666. margin-bottom: 20px;
  1667. .title {
  1668. font-size: 16px;
  1669. font-weight: 600;
  1670. padding-left: 10px;
  1671. }
  1672. }
  1673. .tables {
  1674. display: flex;
  1675. margin-top: 10px;
  1676. .table {
  1677. width: 45%;
  1678. }
  1679. .buttons {
  1680. display: flex;
  1681. flex-direction: column;
  1682. justify-content: center;
  1683. align-items: center;
  1684. padding: 0 10px;
  1685. button {
  1686. margin: 0;
  1687. margin-top: 10px;
  1688. }
  1689. }
  1690. }
  1691. ::v-deep input::-webkit-outer-spin-button,
  1692. ::v-deep input::-webkit-inner-spin-button {
  1693. -webkit-appearance: none;
  1694. }
  1695. ::v-deep input[type='number'] {
  1696. -moz-appearance: textfield;
  1697. }
  1698. </style>