home_form.vue 74 KB

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