index.vue 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649
  1. <template>
  2. <div class="pageIndexClass">
  3. <div class="content">
  4. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
  5. highlight-current-row :action-list="[
  6. {
  7. text: '新建报价单',
  8. action: () => newPriceSheet(),
  9. },
  10. ]" @get-list="getList">
  11. <template #code="{ item }">
  12. <div style="width: 100%">
  13. <!-- <span style="color: #409eff; cursor: pointer; word-break: break-all" @click="getDtl(item,true)">{{ item.code }}</span> -->
  14. <span style="color: #409eff; cursor: pointer; word-break: break-all" @click="handleOpenDetail(item)">{{ item.code }}</span>
  15. </div>
  16. </template>
  17. <template #status="{ item }">
  18. <div style="width: 100%">
  19. <span :style="{color: item.status ==88? 'red' :''}">{{dictValueLabel(item.status, statusData)}}</span>
  20. </div>
  21. </template>
  22. <template #quotationStatus="{item}">
  23. <div style="width: 100%">
  24. <span
  25. :class="{ 'tag-active-1': item.quotationStatus==1, 'tag-active': item.quotationStatus==2 }">{{dictValueLabel(item.quotationStatus, quotationStatusData)}}</span>
  26. </div>
  27. </template>
  28. <template #amount="{ item }">
  29. <div>
  30. <span style="padding-right: 4px">{{ item.currency }}</span>
  31. <span>{{ moneyFormat(item.amount, 2) }}</span>
  32. </div>
  33. </template>
  34. <template #product="{ item }">
  35. <div style="width:100%;">
  36. <el-popover placement="bottom-start" title="" :width="300" trigger="hover">
  37. <div default>
  38. <div v-for="(product,index) in item.quotationProductList">
  39. {{index+1}}、{{product.productName}}
  40. <!-- <span v-if="index<item.quotationProductList.length-1">,</span> -->
  41. </div>
  42. </div>
  43. <template #reference>
  44. <div style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer">
  45. <span v-for="(product,index) in item.quotationProductList">
  46. {{product.productName}}
  47. <span v-if="index<item.quotationProductList.length-1"> , </span>
  48. </span>
  49. </div>
  50. </template>
  51. </el-popover>
  52. </div>
  53. </template>
  54. <template #btn="{item}">
  55. <div style="width: 100%">
  56. <span v-if="item.status == 0">
  57. <el-button type="primary" text v-debounce @click="getDtl(item, false)">修改</el-button>
  58. <el-button type="danger" text v-debounce @click="handleRepeal(item,'/saleQuotation/delete')">删除</el-button>
  59. </span>
  60. <span v-if="item.status !=88">
  61. <el-button type="primary" text v-debounce v-if="item.quotationStatus==2 && !item.extQuotationId"
  62. @click="handleBack(item)">退回</el-button>
  63. <el-button type="primary" text v-debounce v-if="item.status == 30 && item.quotationStatus==2"
  64. @click="getDtl(item, false,true)">变更</el-button>
  65. <el-button type="primary" text v-debounce v-if="item.quotationStatus==2 && !item.extQuotationId"
  66. @click="handleForeign(item)">转对外</el-button>
  67. <el-button type="danger" text v-debounce v-if="item.status !=0 && item.status !=88"
  68. @click="handleRepeal(item,'/saleQuotation/cancellation')">作废</el-button>
  69. </span>
  70. </div>
  71. </template>
  72. </byTable>
  73. </div>
  74. <el-dialog v-if="openAddDialog" v-model="openAddDialog" title="报价单" width="90%" append-to-body>
  75. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
  76. <template #chart>
  77. <div style="width:100%;padding-left:25px">
  78. <div ref="chartDom" style="height:300px"></div>
  79. </div>
  80. </template>
  81. <template #buyer>
  82. <div style="width: 100%">
  83. <el-form-item label="客户名称" prop="buyCorporationId" class="wid100">
  84. <el-select v-model="formData.data.buyCorporationId" filterable remote reserve-keyword placeholder="请输入关键字" remote-show-suffix
  85. :remote-method="remoteMethod" :loading="loadingSearch" @input="remoteMethod" style="width: 100%" @change="changeCustomer">
  86. <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
  87. </el-select>
  88. </el-form-item>
  89. <el-row style="width: 100%">
  90. <el-col :span="12">
  91. <el-form-item label="地址" class="wid100 margin-b-0">
  92. <el-row style="padding-right:5px;width:100%">
  93. <el-col :span="6">
  94. <el-form-item label="" prop="buyCountryId" class="margin-b-0 wid100" label-width="0px">
  95. <el-select v-model="formData.data.buyCountryId" placeholder="国家" style="width:100%" filterable
  96. @change="(val) => getCityData(val, '20', true)">
  97. <el-option v-for="item in countryData" :label="item.name" :value="item.id">
  98. </el-option>
  99. </el-select>
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="6">
  103. <el-form-item label="" prop="provinceName" class="margin-b-0 wid100" label-width="0px">
  104. <selectCity placeholder="省/洲" @change="(val) => getCityData(val, '30', true)" addressId="buyProvinceId"
  105. addressName="provinceName" v-model="formData.data" :data="provinceData">
  106. </selectCity>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="6">
  110. <el-form-item label="" prop="cityName" class="margin-b-0 wid100" label-width="0px">
  111. <selectCity placeholder="城市" addressId="buyCityId" addressName="cityName" v-model="formData.data" :data="cityData">
  112. </selectCity>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="6">
  116. <el-form-item label="" prop="buyPostalCode" class="margin-b-0" label-width="0px">
  117. <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" />
  118. </el-form-item>
  119. </el-col>
  120. </el-row>
  121. </el-form-item>
  122. </el-col>
  123. <el-col :span="12" style="padding-left:5px">
  124. <el-form-item label="详细地址" prop="buyAddress" class="margin-b-0 wid100">
  125. <el-input v-model="formData.data.buyAddress" type="text" placeholder="请输入详细地址">
  126. </el-input>
  127. </el-form-item>
  128. </el-col>
  129. </el-row>
  130. </div>
  131. </template>
  132. <template #commodity>
  133. <div style="width: 100%;padding-left:25px">
  134. <el-button type="primary" @click="openProductCompany = true" plain style="margin-bottom: 16px" v-if="!isDetail"
  135. :disabled="!formData.data.companyId">产品库</el-button>
  136. <el-table :data="formData.data.quotationProductList" style="width: 100%;" default-expand-all>
  137. <el-table-column type="expand" width="50" align="center">
  138. <template #default="scope">
  139. <div style="padding-left:50px">
  140. <div style="margin-bottom:10px; ">
  141. <TitleInfo content='BOM单:'></TitleInfo>
  142. </div>
  143. <el-table :data="scope.row.quotationProductBomList" style="width: 100%;" border class="bom-table">
  144. <el-table-column label="图片" width="80">
  145. <template #default="{ row }">
  146. <div v-if="row.fileUrl">
  147. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  148. </div>
  149. <div v-else></div>
  150. </template>
  151. </el-table-column>
  152. <el-table-column prop="productCode" label="物料编码" width="190" />
  153. <el-table-column prop="productName" label="物料名称" min-width="200" />
  154. <el-table-column label="尺寸 (cm)" width="150">
  155. <template #default="{ row, $index }">
  156. <div style="width: 100%">
  157. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  158. </div>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="数量" width="110">
  162. <template #default="{ row, $index }">
  163. <div style="width: 100%">
  164. <el-form-item :prop="'quotationProductList.' + scope.$index + '.quotationProductBomList.' + $index + '.quantity'"
  165. :rules="rules.quantity" :inline-message="true" class="margin-b-0 wid100">
  166. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%"
  167. :precision="0" :controls="false" :min="1" v-if="row.type==2" @change="changeQuantity()" />
  168. <span v-else>{{row.quantity}}</span>
  169. </el-form-item>
  170. </div>
  171. </template>
  172. </el-table-column>
  173. <el-table-column prop="allQuantity" label="总量" width="80" />
  174. <el-table-column label="单价" width="110">
  175. <template #default="{ row, $index }">
  176. <div style="width: 100%">
  177. <span v-if="row.price">¥ {{row.price}}</span>
  178. <span v-else>待报价</span>
  179. </div>
  180. </template>
  181. </el-table-column>
  182. <el-table-column prop="amount" label="小计" width="110">
  183. <template #default="{ row, $index }">
  184. <div style="width: 100%">
  185. <span v-if="row.amount">¥ {{row.amount}}</span>
  186. <span v-else>一</span>
  187. </div>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="备注" width="180">
  191. <template #default="{ row, $index }">
  192. <div style="width: 100%">
  193. <el-form-item :prop="'quotationProductList.' + scope.$index + '.quotationProductBomList.' + $index + '.remark'"
  194. :rules="rules.remark" :inline-message="true" class="margin-b-0 wid100">
  195. <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" :min="0" />
  196. </el-form-item>
  197. </div>
  198. </template>
  199. </el-table-column>
  200. <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!isDetail">
  201. <template #default="{ row,$index }">
  202. <el-button type="primary" link @click="handleDeleteMaterial(scope.$index,$index)" v-if="row.type==2">删除</el-button>
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. </div>
  207. </template>
  208. </el-table-column>
  209. <el-table-column label="图片" width="80">
  210. <template #default="{ row }">
  211. <div v-if="row.fileUrl">
  212. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  213. </div>
  214. <div v-else></div>
  215. </template>
  216. </el-table-column>
  217. <el-table-column prop="productCode" label="商品编码" width="190" />
  218. <el-table-column prop="productName" label="商品名称" min-width="200" />
  219. <el-table-column label="尺寸 (cm)" width="150">
  220. <template #default="{ row, $index }">
  221. <div style="width: 100%">
  222. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  223. </div>
  224. </template>
  225. </el-table-column>
  226. <el-table-column prop="productColor" label="颜色" width="100" />
  227. <el-table-column label="数量" width="110">
  228. <template #default="{ row, $index }">
  229. <div style="width: 100%">
  230. <el-form-item :prop="'quotationProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
  231. class="margin-b-0 wid100">
  232. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
  233. :controls="false" :min="1" @change="changeQuantity()" />
  234. </el-form-item>
  235. </div>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="单价" width="110">
  239. <template #default="{ row, $index }">
  240. <div style="width: 100%">
  241. <span v-if="row.price">¥ {{row.price}}</span>
  242. <span v-else>待报价</span>
  243. </div>
  244. </template>
  245. </el-table-column>
  246. <el-table-column prop="amount" label="小计" width="110">
  247. <template #default="{ row, $index }">
  248. <div style="width: 100%">
  249. <span v-if="row.amount">¥ {{row.amount}}</span>
  250. <span v-else>一</span>
  251. </div>
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="操作" width="140" align="center" fixed="right" v-if="!isDetail">
  255. <template #default="{ $index }">
  256. <el-button type="primary" link @click="handleClickSelectMaterial($index)">包材辅材</el-button>
  257. <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
  258. </template>
  259. </el-table-column>
  260. </el-table>
  261. </div>
  262. </template>
  263. </byForm>
  264. <template #footer v-if="!isDetail">
  265. <el-button @click="openAddDialog = false" size="default" v-debounce>关 闭</el-button>
  266. <el-button type="primary" @click="handleSubmit(0)" size="default" v-debounce v-if="!isChange">暂 存</el-button>
  267. <el-button type="primary" @click="handleSubmit(30)" size="default" v-debounce>提 交</el-button>
  268. </template>
  269. </el-dialog>
  270. <el-dialog v-if="foreignDialog" v-model="foreignDialog" title="转对外报价单" width="90%" append-to-body>
  271. <byForm :formConfig="formConfigOne" :formOption="formOptionOne" v-model="formData.data" :rules="rulesOne" ref="formDomOne"
  272. v-loading="submitLoading">
  273. <template #commodity>
  274. <div style="width: 100%;padding-left:25px">
  275. <el-table :data="formData.data.quotationProductList" style="width: 100%;" default-expand-all>
  276. <el-table-column type="expand" width="50" align="center">
  277. <template #default="scope">
  278. <div style="padding-left:50px">
  279. <div style="margin-bottom:10px; ">
  280. <TitleInfo content='BOM单:'></TitleInfo>
  281. </div>
  282. <el-table :data="scope.row.quotationProductBomList" style="width: 100%;" border class="bom-table">
  283. <el-table-column label="图片" width="80">
  284. <template #default="{ row }">
  285. <div v-if="row.fileUrl">
  286. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  287. </div>
  288. <div v-else></div>
  289. </template>
  290. </el-table-column>
  291. <el-table-column prop="productCode" label="物料编码" width="190" />
  292. <el-table-column prop="productName" label="物料名称" min-width="200" />
  293. <el-table-column label="尺寸 (cm)" width="150">
  294. <template #default="{ row, $index }">
  295. <div style="width: 100%">
  296. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  297. </div>
  298. </template>
  299. </el-table-column>
  300. <el-table-column label="数量" width="80" prop="quantity">
  301. </el-table-column>
  302. <el-table-column label="总数量" width="80" prop="allQuantity">
  303. </el-table-column>
  304. <el-table-column label="原本单价" width="110" prop="priceCopy">
  305. <template #default="{ row, $index }">
  306. <div style="width: 100%">
  307. ¥ {{row.priceCopy}}
  308. </div>
  309. </template>
  310. </el-table-column>
  311. <el-table-column label="利润点数" width="110">
  312. <template #default="{ row, $index }">
  313. <div style="width: 100%">
  314. <el-form-item :prop="'quotationProductList.' + scope.$index + '.quotationProductBomList.' + $index + '.coefficient'"
  315. :rules="rules.coefficient" :inline-message="true" class="margin-b-0 wid100">
  316. <el-input-number onmousewheel="return false;" v-model="row.coefficient" placeholder="请输入" style="width: 100%"
  317. :precision="2" :controls="false" :min="0" @change="totalAmount()" />
  318. </el-form-item>
  319. </div>
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="单价" width="110" prop="price">
  323. <template #default="{ row, $index }">
  324. <div style="width: 100%">
  325. ¥ {{row.price}}
  326. </div>
  327. </template>
  328. </el-table-column>
  329. <el-table-column prop="amount" label="小计" width="110">
  330. <template #default="{ row, $index }">
  331. <div style="width: 100%">
  332. ¥ {{row.amount}}
  333. </div>
  334. </template>
  335. </el-table-column>
  336. <el-table-column label="备注" width="180" prop="remark">
  337. </el-table-column>
  338. </el-table>
  339. </div>
  340. </template>
  341. </el-table-column>
  342. <el-table-column label="图片" width="80">
  343. <template #default="{ row }">
  344. <div v-if="row.fileUrl">
  345. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  346. </div>
  347. <div v-else></div>
  348. </template>
  349. </el-table-column>
  350. <el-table-column prop="productCode" label="商品编码" width="190" />
  351. <el-table-column prop="productName" label="商品名称" min-width="200" />
  352. <el-table-column label="尺寸 (cm)" width="150">
  353. <template #default="{ row, $index }">
  354. <div style="width: 100%">
  355. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  356. </div>
  357. </template>
  358. </el-table-column>
  359. <el-table-column prop="productColor" label="颜色" width="100" />
  360. <el-table-column label="数量" width="110" prop="quantity">
  361. </el-table-column>
  362. <el-table-column label="单价" width="110" prop="price">
  363. <template #default="{ row, $index }">
  364. <div style="width: 100%">
  365. ¥ {{row.price}}
  366. </div>
  367. </template>
  368. </el-table-column>
  369. <el-table-column prop="amount" label="小计" width="110">
  370. <template #default="{ row, $index }">
  371. <div style="width: 100%">
  372. ¥ {{row.amount}}
  373. </div>
  374. </template>
  375. </el-table-column>
  376. </el-table>
  377. </div>
  378. </template>
  379. </byForm>
  380. <template #footer>
  381. <el-button @click="foreignDialog = false" size="default" v-debounce>关 闭</el-button>
  382. <el-button type="primary" @click="handleSubmitOne()" size="default" v-debounce>提 交</el-button>
  383. </template>
  384. </el-dialog>
  385. <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="产品库" width="90%" append-to-body>
  386. <SelectProduct @selectProduct="selectProduct" :companyId="companyId" :isRawMaterial="'1'" :disablePerm="'1'"></SelectProduct>
  387. <template #footer>
  388. <el-button @click="openProductCompany = false" size="defualt" v-debounce>关 闭</el-button>
  389. </template>
  390. </el-dialog>
  391. <el-dialog :title="'物料选择'" v-model="openSelectMaterial" width="90%" destroy-on-close>
  392. <SelectMaterial :isNeRawMaterial="'1'" @selectMaterial="selectMaterial"></SelectMaterial>
  393. <template #footer>
  394. <el-button @click="openSelectMaterial = false" size="defualt" v-debounce>关 闭</el-button>
  395. </template>
  396. </el-dialog>
  397. <el-dialog v-if="detailDialog" v-model="detailDialog" title="报价详情" width="90%" append-to-body>
  398. <PriceSheetDetailList :rowData="detailRowData" dataType="1" @changeLeftData="changeLeftData"></PriceSheetDetailList>
  399. <template #footer>
  400. <el-button @click="detailDialog = false" size="defualt" v-debounce>关 闭</el-button>
  401. <el-button type="primary" v-debounce
  402. v-if="leftRowData.quotationStatus==2 && !leftRowData.extQuotationId &&leftRowData.status !=88 &&leftRowData.status !=70"
  403. @click="handleBack(leftRowData)">退回</el-button>
  404. <el-button type="primary" v-debounce
  405. v-if="leftRowData.status == 30 && leftRowData.quotationStatus==2 && leftRowData.status !=88 &&leftRowData.status !=70"
  406. @click="getDtl(leftRowData, false,true)">变更</el-button>
  407. <el-button type="primary" v-debounce
  408. v-if="leftRowData.quotationStatus==2 && !leftRowData.extQuotationId &&leftRowData.status !=88 &&leftRowData.status !=70"
  409. @click="handleForeign(leftRowData)">转对外</el-button>
  410. <el-button type="danger" v-debounce v-if="leftRowData.status !=0 && leftRowData.status !=88 &&leftRowData.status !=70"
  411. @click="handleRepeal(leftRowData,'/saleQuotation/cancellation')">作废</el-button>
  412. </template>
  413. </el-dialog>
  414. <el-dialog v-if="backDialog" v-model="backDialog" title="退回" width="50%" append-to-body>
  415. <byForm :formConfig="backFormConfig" :formOption="backFormOption" v-model="formData.backData" :rules="backRules" ref="backFormDom"
  416. v-loading="submitLoading">
  417. </byForm>
  418. <template #footer>
  419. <el-button @click="backDialog = false" size="default" v-debounce>关 闭</el-button>
  420. <el-button type="primary" @click="handleSubmitBack()" size="default" v-debounce>提 交</el-button>
  421. </template>
  422. </el-dialog>
  423. </div>
  424. </template>
  425. <script setup>
  426. import byTable from "@/components/byTable/index";
  427. import moment from "moment";
  428. import byForm from "@/components/byForm/index";
  429. import selectCity from "@/components/selectCity/index.vue";
  430. import SelectProduct from "@/components/product/SelectProduct.vue";
  431. import SelectMaterial from "@/components/product/SelectMaterial.vue";
  432. import * as echarts from "echarts";
  433. import PriceSheetDetailList from "@/views/EHSD/saleContract/PriceSheetDetailList";
  434. const { proxy } = getCurrentInstance();
  435. const companyId = ref("");
  436. const accountList = ref([]);
  437. const corporationList = ref([]);
  438. const tradeMethods = ref([]);
  439. const accountCurrency = ref([]);
  440. const companyData = ref([]);
  441. const statusData = ref([
  442. {
  443. label: "草稿",
  444. value: 0,
  445. },
  446. {
  447. label: "正常",
  448. value: 30,
  449. },
  450. {
  451. label: "作废",
  452. value: 88,
  453. },
  454. ]);
  455. const quotationStatusData = ref([
  456. {
  457. label: "未报价",
  458. value: 0,
  459. },
  460. {
  461. label: "报价中",
  462. value: 1,
  463. },
  464. {
  465. label: "已报价",
  466. value: 2,
  467. },
  468. ]);
  469. const typeData = ref([
  470. {
  471. label: "常规订单",
  472. value: 1,
  473. },
  474. {
  475. label: "外贸",
  476. value: 2,
  477. },
  478. ]);
  479. const sourceList = ref({
  480. data: [],
  481. pagination: {
  482. total: 0,
  483. pageNum: 1,
  484. pageSize: 10,
  485. keyword: "",
  486. status: "",
  487. type: "",
  488. quotationStatus: "",
  489. companyId: "",
  490. quotationTimeSta: "",
  491. quotationTimeEnd: "",
  492. beginTime: "",
  493. endTime: "",
  494. },
  495. });
  496. const loading = ref(false);
  497. const selectConfig = computed(() => {
  498. return [
  499. {
  500. label: "报价单状态",
  501. prop: "status",
  502. data: statusData.value,
  503. },
  504. {
  505. label: "报价单类型",
  506. prop: "type",
  507. data: typeData.value,
  508. },
  509. {
  510. label: "子公司报价状态",
  511. prop: "quotationStatus",
  512. data: quotationStatusData.value,
  513. },
  514. {
  515. label: "报价子公司",
  516. prop: "companyId",
  517. data: companyData.value,
  518. },
  519. {
  520. type: "time",
  521. label: "报价时间",
  522. placeholder: "开始日期",
  523. prop: "quotationTimeSta",
  524. placeholderOne: "结束日期",
  525. propOne: "quotationTimeEnd",
  526. },
  527. // {
  528. // type: "time",
  529. // label: "创建时间",
  530. // placeholder: "开始日期",
  531. // prop: "beginTime",
  532. // placeholderOne: "结束日期",
  533. // propOne: "endTime",
  534. // },
  535. ];
  536. });
  537. const config = computed(() => {
  538. return [
  539. {
  540. attrs: {
  541. label: "报价单号",
  542. slot: "code",
  543. width: 180,
  544. },
  545. },
  546. {
  547. attrs: {
  548. label: "报价单状态",
  549. slot: "status",
  550. width: 100,
  551. },
  552. },
  553. {
  554. attrs: {
  555. label: "报价单类型",
  556. prop: "type",
  557. width: 100,
  558. },
  559. render(val) {
  560. return proxy.dictValueLabel(val, typeData.value);
  561. },
  562. },
  563. {
  564. attrs: {
  565. label: "报价子公司",
  566. prop: "companyName",
  567. width: 100,
  568. },
  569. },
  570. {
  571. attrs: {
  572. label: "客户名称",
  573. prop: "buyCorporationName",
  574. "min-width": 150,
  575. },
  576. },
  577. {
  578. attrs: {
  579. label: "子公司报价状态",
  580. slot: "quotationStatus",
  581. width: 130,
  582. },
  583. },
  584. {
  585. attrs: {
  586. label: "报价金额",
  587. slot: "amount",
  588. width: 120,
  589. },
  590. },
  591. {
  592. attrs: {
  593. label: "报价时间",
  594. prop: "quotationTime",
  595. width: 160,
  596. },
  597. },
  598. {
  599. attrs: {
  600. label: "报价单产品",
  601. slot: "product",
  602. "min-width": 180,
  603. },
  604. },
  605. {
  606. attrs: {
  607. label: "创建时间",
  608. prop: "createTime",
  609. width: 160,
  610. },
  611. },
  612. {
  613. attrs: {
  614. label: "创建人",
  615. prop: "userName",
  616. width: 80,
  617. },
  618. },
  619. {
  620. attrs: {
  621. label: "操作",
  622. width: 200,
  623. slot: "btn",
  624. align: "right",
  625. fixed: "right",
  626. },
  627. },
  628. ];
  629. });
  630. const getDict = () => {
  631. proxy
  632. .post("/customer/selPage", {
  633. pageNum: 1,
  634. pageSize: 50,
  635. })
  636. .then((res) => {
  637. customerList.value = res.rows.map((x) => ({
  638. ...x,
  639. label: x.name,
  640. value: x.id,
  641. }));
  642. });
  643. proxy
  644. .get("/tenantDept/list", {
  645. pageNum: 1,
  646. pageSize: 9999,
  647. keyword: "",
  648. tenantId: proxy.useUserStore().user.tenantId,
  649. type: 0,
  650. })
  651. .then((res) => {
  652. companyData.value = res.data.map((x) => ({
  653. ...x,
  654. label: x.deptName,
  655. value: x.deptId,
  656. }));
  657. treeData.value = proxy.handleTree(res.data, "deptId");
  658. });
  659. };
  660. const getList = async (req) => {
  661. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  662. loading.value = true;
  663. proxy.post("/saleQuotation/page", sourceList.value.pagination).then((res) => {
  664. sourceList.value.data = res.rows;
  665. sourceList.value.pagination.total = res.total;
  666. setTimeout(() => {
  667. loading.value = false;
  668. }, 200);
  669. });
  670. };
  671. getDict();
  672. getList();
  673. const openAddDialog = ref(false);
  674. const submitLoading = ref(false);
  675. const modalType = ref("add");
  676. const newPriceSheet = () => {
  677. formOption.disabled = false;
  678. isDetail.value = false;
  679. isChange.value = false;
  680. isShowChart.value = false;
  681. modalType.value = "add";
  682. openAddDialog.value = true;
  683. formData.data = {
  684. type: 1,
  685. quotationProductList: [],
  686. };
  687. };
  688. const isDetail = ref(false);
  689. const isChange = ref(false);
  690. const getFileData = () => {
  691. let ids = [];
  692. formData.data.quotationProductList.map((x) => {
  693. // ids.push(x.productId);
  694. x.quotationProductBomList.map((y) => {
  695. ids.push(y.materialId);
  696. });
  697. });
  698. ids = Array.from(new Set(ids));
  699. proxy
  700. .post("/fileInfo/getList", {
  701. businessIdList: ids,
  702. })
  703. .then((fileObj) => {
  704. formData.data.quotationProductList.map((x) => {
  705. // x.fileList = fileObj[x.productId] || [];
  706. // if (x.fileList && x.fileList.length > 0) {
  707. // x.fileUrl = x.fileList[0].fileUrl;
  708. // }
  709. x.quotationProductBomList.map((y) => {
  710. y.fileList = fileObj[y.materialId] || [];
  711. if (y.fileList && y.fileList.length > 0) {
  712. y.fileUrl = y.fileList[0].fileUrl;
  713. }
  714. });
  715. });
  716. });
  717. };
  718. const getDtl = (row, flag, change = false) => {
  719. formOption.disabled = flag;
  720. modalType.value = "edit";
  721. isChange.value = change;
  722. isDetail.value = flag;
  723. isShowChart.value = flag;
  724. openAddDialog.value = true;
  725. proxy.post("/saleQuotation/detail", { id: row.id }).then((res) => {
  726. formData.data = res;
  727. // 城市数据回显
  728. if (formData.data.buyCountryId) {
  729. getCityData(formData.data.buyCountryId, "20");
  730. }
  731. if (formData.data.buyProvinceId) {
  732. getCityData(formData.data.buyProvinceId, "30");
  733. }
  734. // 文件数据回显
  735. getFileData();
  736. let productIds = formData.data.quotationProductList.map((x) => x.productId);
  737. proxy.getFileData({
  738. businessIdList: productIds,
  739. data: formData.data.quotationProductList,
  740. att: "productId",
  741. businessType: "0",
  742. fileAtt: "productFile",
  743. filePathAtt: "fileUrl",
  744. });
  745. // 价格计算
  746. changeQuantity();
  747. //折线图
  748. if (flag && res.quotationTrendList && res.quotationTrendList.length >= 2) {
  749. nextTick(() => {
  750. myChart = echarts.init(chartDom.value);
  751. window.addEventListener("resize", () => {
  752. myChart.resize();
  753. });
  754. chartData.value = res.quotationTrendList;
  755. chartOption.data.xAxis.data = chartData.value.map((item) => {
  756. return item.createTime.slice(0, 10);
  757. });
  758. chartOption.data.series[0].data = chartData.value.map((item, index) => {
  759. if (item.code == row.code) {
  760. return {
  761. value: item.amount || 0,
  762. itemStyle: { color: "red" },
  763. };
  764. } else {
  765. return item.amount || 0;
  766. }
  767. });
  768. myChart.setOption(chartOption.data);
  769. myChart.resize();
  770. });
  771. } else {
  772. isShowChart.value = false;
  773. }
  774. });
  775. };
  776. const openPrint = ref(false);
  777. const printDetails = ref({});
  778. const clickPrint = (row) => {
  779. printDetails.value = {};
  780. openPrint.value = true;
  781. proxy.post("/saleQuotation/detail", { id: row.id }).then((res) => {
  782. printDetails.value = res;
  783. if (printDetails.value.ehsdJson) {
  784. let ehsdJson = JSON.parse(printDetails.value.ehsdJson);
  785. printDetails.value.deliveryTime = ehsdJson.deliveryTime;
  786. }
  787. });
  788. };
  789. const clickDownload = () => {
  790. proxy.getPdf("报价单PDF文件");
  791. };
  792. const statistics = (label, index) => {
  793. let num = 0;
  794. if (
  795. printDetails.value.quotationProductList &&
  796. printDetails.value.quotationProductList.length > 0
  797. ) {
  798. printDetails.value.quotationProductList.map((item) => {
  799. if (item[label]) {
  800. num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
  801. }
  802. });
  803. }
  804. return num;
  805. };
  806. const getLabel = (key, list, label) => {
  807. let text = "";
  808. if (list && list.length > 0) {
  809. let data = list.filter((item) => item.id === key);
  810. if (data && data.length > 0) {
  811. text = data[0][label];
  812. }
  813. }
  814. return text;
  815. };
  816. const getAllMoney = (num) => {
  817. let money = num;
  818. if (
  819. printDetails.value.quotationPayList &&
  820. printDetails.value.quotationPayList.length > 0
  821. ) {
  822. printDetails.value.quotationPayList.map((item) => {
  823. if (item.amount) {
  824. money = parseFloat(Number(money) + Number(item.amount)).toFixed(2);
  825. }
  826. });
  827. }
  828. return money;
  829. };
  830. const currencyData = computed(
  831. () => proxy.useUserStore().allDict["account_currency"]
  832. );
  833. const fundsPaymentMethod = computed(
  834. () => proxy.useUserStore().allDict["funds_payment_method"]
  835. );
  836. const shippingMethod = computed(
  837. () => proxy.useUserStore().allDict["shipping_method"]
  838. );
  839. const treeData = ref([]);
  840. const customerList = ref([]);
  841. const customerUserList = ref([]);
  842. const countryData = ref([]);
  843. const provinceData = ref([]);
  844. const cityData = ref([]);
  845. const openProductCompany = ref(false);
  846. const copyType = ref(1);
  847. const copyContract = ref(false);
  848. const indexValue = ref(-1);
  849. const openSelectMaterial = ref(false);
  850. const formData = reactive({
  851. data: {
  852. type: "1",
  853. quotationProductList: [],
  854. },
  855. backData: {},
  856. });
  857. const formDom = ref(null);
  858. const formOption = reactive({
  859. inline: true,
  860. labelWidth: 100,
  861. itemWidth: 100,
  862. disabled: false,
  863. });
  864. let myChart = null;
  865. const chartDom = ref(null);
  866. const chartData = ref([]);
  867. const isShowChart = ref(false);
  868. const formConfig = computed(() => {
  869. return [
  870. {
  871. type: "title1",
  872. title: "报价趋势",
  873. isShow: isShowChart.value,
  874. },
  875. {
  876. type: "slot",
  877. slotName: "chart",
  878. isShow: isShowChart.value,
  879. },
  880. {
  881. type: "title1",
  882. title: "基本信息",
  883. },
  884. // {
  885. // type: "select",
  886. // prop: "type",
  887. // label: "报价类型",
  888. // data: typeData.value,
  889. // itemWidth: 50,
  890. // },
  891. {
  892. type: "treeSelect",
  893. prop: "companyId",
  894. label: "报价公司",
  895. data: treeData.value,
  896. propsTreeLabel: "deptName",
  897. propsTreeValue: "deptId",
  898. itemWidth: 50,
  899. fn: (val) => {
  900. companyId.value = val;
  901. formData.data.quotationProductList = [];
  902. },
  903. },
  904. {
  905. type: "title1",
  906. title: "贸易信息",
  907. },
  908. {
  909. type: "slot",
  910. slotName: "buyer",
  911. label: "",
  912. itemWidth: 100,
  913. },
  914. {
  915. type: "input",
  916. itemType: "text",
  917. label: "联系人",
  918. prop: "buyContactName",
  919. itemWidth: 50,
  920. },
  921. {
  922. type: "input",
  923. itemType: "text",
  924. label: "联系人电话",
  925. prop: "buyContactNumber",
  926. itemWidth: 50,
  927. },
  928. {
  929. type: "title1",
  930. title: "商品信息",
  931. },
  932. {
  933. type: "slot",
  934. slotName: "commodity",
  935. label: "",
  936. },
  937. {
  938. type: "title1",
  939. title: "报价总金额",
  940. },
  941. {
  942. type: "input",
  943. prop: "amount",
  944. label: "报价总金额",
  945. itemWidth: 25,
  946. disabled: true,
  947. },
  948. ];
  949. });
  950. const rules = ref({
  951. type: [{ required: true, message: "请选择报价类型", trigger: "change" }],
  952. companyId: [{ required: true, message: "请选择报价公司", trigger: "change" }],
  953. buyCorporationId: [
  954. { required: true, message: "请选择客户公司", trigger: "change" },
  955. ],
  956. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  957. });
  958. const getCityData = (id, type, isChange = false) => {
  959. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  960. if (type === "20") {
  961. provinceData.value = res;
  962. if (isChange) {
  963. formData.data.buyProvinceId = "";
  964. formData.data.provinceName = "";
  965. formData.data.buyCityId = "";
  966. formData.data.cityName = "";
  967. }
  968. } else if (type === "30") {
  969. cityData.value = res;
  970. if (isChange) {
  971. formData.data.buyCityId = "";
  972. formData.data.cityName = "";
  973. }
  974. } else {
  975. countryData.value = res;
  976. }
  977. });
  978. };
  979. getCityData("0");
  980. const changeCustomer = (val) => {
  981. formData.data.quotationProductList = [];
  982. if (val) {
  983. proxy.post("/customer/detail", { id: val }).then(
  984. (res) => {
  985. formData.data.buyCorporationName = res.name;
  986. if (res.customerUserList && res.customerUserList.length > 0) {
  987. formData.data.buyContactName = res.customerUserList[0].name;
  988. if (res.customerUserList[0].contactJson) {
  989. let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  990. if (contactJson && contactJson.length > 0) {
  991. formData.data.buyContactNumber = contactJson[0].contactNo;
  992. }
  993. }
  994. customerUserList.value = res.customerUserList.map((item) => {
  995. return {
  996. ...item,
  997. value: item.name,
  998. };
  999. });
  1000. }
  1001. // 回填客户的账户信息
  1002. // formData.data.beneficiaryName = res.beneficiaryName;
  1003. // formData.data.beneficiaryBank = res.beneficiaryBank;
  1004. // formData.data.beneficiaryBankAddress = res.beneficiaryBankAddress;
  1005. // formData.data.beneficiaryAccountNumber = res.beneficiaryAccountNumber;
  1006. // formData.data.swiftCode = res.swiftCode;
  1007. // formData.data.beneficiaryAddress = res.beneficiaryAddress;
  1008. formData.data.buyCountryId = res.countryId;
  1009. formData.data.buyProvinceId = res.provinceId;
  1010. formData.data.buyCityId = res.cityId;
  1011. formData.data.buyPostalCode = res.zipCode;
  1012. formData.data.buyAddress = res.address;
  1013. getCityData(formData.data.buyCountryId, "20");
  1014. if (formData.data.buyProvinceId) {
  1015. getCityData(formData.data.buyProvinceId, "30");
  1016. }
  1017. },
  1018. (err) => {
  1019. formData.data.buyCountryId = "";
  1020. formData.data.buyProvinceId = "";
  1021. formData.data.buyCityId = "";
  1022. formData.data.buyPostalCode = "";
  1023. formData.data.buyAddress = "";
  1024. }
  1025. );
  1026. } else {
  1027. formData.data.buyCountryId = "";
  1028. formData.data.buyProvinceId = "";
  1029. formData.data.buyCityId = "";
  1030. formData.data.buyPostalCode = "";
  1031. formData.data.buyAddress = "";
  1032. }
  1033. };
  1034. const handlePerson = (item) => {
  1035. if (item.contactJson) {
  1036. let data = JSON.parse(item.contactJson);
  1037. formData.data.buyContactNumber = data[0].contactNo;
  1038. }
  1039. };
  1040. const quotationProductBomList = ref([]);
  1041. const selectProduct = (goods) => {
  1042. if (goods && goods.id) {
  1043. let fileUrl = "";
  1044. if (goods.fileList && goods.fileList.length > 0) {
  1045. fileUrl = goods.fileList[0].fileUrl;
  1046. }
  1047. proxy.post("/productBomInfo/detail", { id: goods.id }).then((res) => {
  1048. if (res.productBomDetailList && res.productBomDetailList.length > 0) {
  1049. quotationProductBomList.value = res.productBomDetailList.map((x) => ({
  1050. fileUrl: "",
  1051. materialId: x.materialId,
  1052. productName: x.materialName,
  1053. productCode: x.materialCode,
  1054. productLength: x["length"],
  1055. productWidth: x.width,
  1056. productHeight: x.height,
  1057. quantity: x.quantity || null,
  1058. allQuantity: "",
  1059. price: null,
  1060. amount: "",
  1061. fileList: [],
  1062. type: x.type,
  1063. }));
  1064. formData.data.quotationProductList.push({
  1065. fileUrl: fileUrl,
  1066. productId: goods.id,
  1067. productName: goods.name,
  1068. productCode: goods.customCode,
  1069. productLength: goods["length"],
  1070. productWidth: goods.width,
  1071. productHeight: goods.height,
  1072. productColor: goods.color,
  1073. quantity: null,
  1074. price: null,
  1075. amount: "",
  1076. fileList: [],
  1077. quotationProductBomList: quotationProductBomList.value,
  1078. });
  1079. proxy.msgTip("添加成功", 1);
  1080. let ids = quotationProductBomList.value.map((x) => x.materialId);
  1081. proxy.getFile(
  1082. ids,
  1083. quotationProductBomList.value,
  1084. "materialId",
  1085. "fileList",
  1086. "fileUrl"
  1087. );
  1088. } else {
  1089. return proxy.msgTip("该产品未配置BOM", 2);
  1090. }
  1091. });
  1092. } else {
  1093. return proxy.msgTip("选择错误", 2);
  1094. }
  1095. };
  1096. const handleClickSelectMaterial = (index) => {
  1097. indexValue.value = index;
  1098. openSelectMaterial.value = true;
  1099. };
  1100. const selectMaterial = (goods) => {
  1101. let flag = formData.data.quotationProductList[
  1102. indexValue.value
  1103. ].quotationProductBomList.some((x) => x.materialId == goods.id);
  1104. if (!flag) {
  1105. let fileUrl = "";
  1106. if (goods.fileList && goods.fileList.length > 0) {
  1107. fileUrl = goods.fileList[0].fileUrl;
  1108. }
  1109. formData.data.quotationProductList[
  1110. indexValue.value
  1111. ].quotationProductBomList.push({
  1112. fileUrl: fileUrl,
  1113. materialId: goods.id,
  1114. productName: goods.name,
  1115. productCode: goods.customCode,
  1116. productLength: goods["length"],
  1117. productWidth: goods.width,
  1118. productHeight: goods.height,
  1119. quantity: null,
  1120. price: null,
  1121. amount: "",
  1122. fileList: [],
  1123. type: 2,
  1124. });
  1125. proxy.msgTip("选择成功");
  1126. } else {
  1127. proxy.msgTip("该物料已选择", 2);
  1128. }
  1129. };
  1130. const onPicture = (path) => {
  1131. window.open(path, "_blank");
  1132. };
  1133. const handleRemove = (index) => {
  1134. formData.data.quotationProductList.splice(index, 1);
  1135. changeQuantity();
  1136. };
  1137. const handleDeleteMaterial = (index, sonIndex) => {
  1138. formData.data.quotationProductList[index].quotationProductBomList.splice(
  1139. sonIndex,
  1140. 1
  1141. );
  1142. changeQuantity();
  1143. };
  1144. const loadingSearch = ref(false);
  1145. const remoteMethod = (keyword) => {
  1146. if (keyword && typeof keyword === "string") {
  1147. loadingSearch.value = true;
  1148. proxy.post("/customer/selPage", { keyword }).then((res) => {
  1149. customerList.value = res.rows.map((x) => ({
  1150. ...x,
  1151. label: x.name,
  1152. value: x.id,
  1153. }));
  1154. loadingSearch.value = false;
  1155. });
  1156. }
  1157. return;
  1158. };
  1159. const changeQuantity = () => {
  1160. let money = 0;
  1161. if (
  1162. formData.data.quotationProductList &&
  1163. formData.data.quotationProductList.length > 0
  1164. ) {
  1165. // 单个产品的价格
  1166. for (let i = 0; i < formData.data.quotationProductList.length; i++) {
  1167. let iele = formData.data.quotationProductList[i];
  1168. let productPrice = 0;
  1169. for (let j = 0; j < iele.quotationProductBomList.length; j++) {
  1170. const jele = iele.quotationProductBomList[j];
  1171. productPrice += Number(
  1172. parseFloat(Number(jele.quantity) * Number(jele.price)).toFixed(2)
  1173. );
  1174. }
  1175. iele.price = parseFloat(productPrice).toFixed(2);
  1176. }
  1177. // 计算数量以及小计
  1178. for (let i = 0; i < formData.data.quotationProductList.length; i++) {
  1179. let iele = formData.data.quotationProductList[i];
  1180. if (iele.quantity) {
  1181. if (iele.price) {
  1182. iele.amount = parseFloat(
  1183. Number(iele.quantity) * Number(iele.price)
  1184. ).toFixed(2);
  1185. money += Number(iele.amount);
  1186. }
  1187. for (let j = 0; j < iele.quotationProductBomList.length; j++) {
  1188. const jele = iele.quotationProductBomList[j];
  1189. jele.allQuantity = iele.quantity * jele.quantity;
  1190. if (jele.price) {
  1191. jele.amount = parseFloat(
  1192. Number(jele.allQuantity) * Number(jele.price)
  1193. ).toFixed(2);
  1194. }
  1195. }
  1196. }
  1197. }
  1198. formData.data.amount = parseFloat(money).toFixed(2);
  1199. }
  1200. };
  1201. const handleSubmit = (type) => {
  1202. formDom.value.handleSubmit(() => {
  1203. if (
  1204. formData.data.quotationProductList &&
  1205. formData.data.quotationProductList.length > 0
  1206. ) {
  1207. submitLoading.value = true;
  1208. formData.data.status = type;
  1209. if (isChange.value) {
  1210. proxy.post("/saleQuotation/change", formData.data).then(
  1211. (res) => {
  1212. proxy.msgTip("操作成功", 1);
  1213. openAddDialog.value = false;
  1214. submitLoading.value = false;
  1215. detailDialog.value = false;
  1216. getList();
  1217. },
  1218. (err) => {
  1219. submitLoading.value = false;
  1220. }
  1221. );
  1222. } else {
  1223. proxy.post("/saleQuotation/" + modalType.value, formData.data).then(
  1224. (res) => {
  1225. proxy.msgTip("操作成功", 1);
  1226. openAddDialog.value = false;
  1227. submitLoading.value = false;
  1228. detailDialog.value = false;
  1229. getList();
  1230. },
  1231. (err) => {
  1232. submitLoading.value = false;
  1233. }
  1234. );
  1235. }
  1236. } else {
  1237. return proxy.msgTip("请添加至少一件商品", 2);
  1238. }
  1239. });
  1240. };
  1241. const chartOption = reactive({
  1242. data: {
  1243. tooltip: {
  1244. trigger: "axis",
  1245. },
  1246. // legend: {
  1247. // data: ["价格"],
  1248. // },
  1249. grid: {
  1250. left: "3%",
  1251. right: "6%",
  1252. top: "10%",
  1253. bottom: "3%",
  1254. containLabel: true,
  1255. },
  1256. tooltip: {
  1257. show: true,
  1258. trigger: "axis",
  1259. // 格式化函数
  1260. // valueFormatter: (val) => {
  1261. // return val + "aaa";
  1262. // },
  1263. formatter: (params, ticket, callback) => {
  1264. return `
  1265. ${params[0].seriesName}:${params[0].value}
  1266. <br/>
  1267. 报价单号:${chartData.value[params[0].dataIndex].code}
  1268. `;
  1269. },
  1270. textStyle: {
  1271. fontSize: 12,
  1272. },
  1273. },
  1274. // toolbox: {
  1275. // feature: {
  1276. // saveAsImage: {},
  1277. // },
  1278. // },
  1279. xAxis: {
  1280. type: "category",
  1281. boundaryGap: false,
  1282. data: [],
  1283. },
  1284. yAxis: {
  1285. type: "value",
  1286. },
  1287. series: [
  1288. {
  1289. name: "报价金额",
  1290. type: "line",
  1291. data: [],
  1292. },
  1293. ],
  1294. },
  1295. });
  1296. const handleRepeal = (row, url) => {
  1297. proxy
  1298. .msgConfirm()
  1299. .then((res) => {
  1300. proxy
  1301. .post(url, {
  1302. id: row.id,
  1303. })
  1304. .then((res) => {
  1305. proxy.msgTip("操作成功", 1);
  1306. detailDialog.value = false;
  1307. getList();
  1308. });
  1309. })
  1310. .catch((err) => {});
  1311. };
  1312. const formDomOne = ref(null);
  1313. const foreignDialog = ref(false);
  1314. const formConfigOne = computed(() => {
  1315. return [
  1316. {
  1317. type: "title1",
  1318. title: "利润点数",
  1319. },
  1320. {
  1321. type: "number",
  1322. prop: "coefficient",
  1323. label: "利润点数",
  1324. precision: 2,
  1325. min: 0.01,
  1326. controls: false,
  1327. itemWidth: 25,
  1328. fn: (val) => {
  1329. publicTotalAmount(val);
  1330. },
  1331. },
  1332. {
  1333. type: "title1",
  1334. title: "商品信息",
  1335. },
  1336. {
  1337. type: "slot",
  1338. slotName: "commodity",
  1339. label: "",
  1340. },
  1341. {
  1342. type: "title1",
  1343. title: "报价总金额",
  1344. },
  1345. {
  1346. type: "input",
  1347. prop: "amount",
  1348. label: "报价总金额",
  1349. itemWidth: 25,
  1350. disabled: true,
  1351. },
  1352. ];
  1353. });
  1354. const formOptionOne = reactive({
  1355. inline: true,
  1356. labelWidth: 100,
  1357. itemWidth: 100,
  1358. disabled: false,
  1359. });
  1360. const rulesOne = ref({
  1361. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  1362. // coefficient: [{ required: true, message: "请输入系数", trigger: "blur" }],
  1363. });
  1364. const handleForeign = (row) => {
  1365. foreignDialog.value = true;
  1366. proxy.post("/saleQuotation/detail", { id: row.id }).then((res) => {
  1367. formData.data = res;
  1368. formData.data.saleQuotationId = res.id;
  1369. delete formData.data.code;
  1370. delete formData.data.id;
  1371. // 复制原本价格
  1372. for (let i = 0; i < formData.data.quotationProductList.length; i++) {
  1373. const iele = formData.data.quotationProductList[i];
  1374. iele.quotationProductId = iele.id;
  1375. delete iele.id;
  1376. for (let j = 0; j < iele.quotationProductBomList.length; j++) {
  1377. const jele = iele.quotationProductBomList[j];
  1378. jele.quotationProductBomId = jele.id;
  1379. delete jele.id;
  1380. jele.priceCopy = jele.price;
  1381. jele.price = Number(parseFloat(jele.price * 1.1)).toFixed(2);
  1382. // 默认系数
  1383. jele.coefficient = 1.1;
  1384. }
  1385. }
  1386. changeQuantity();
  1387. // 城市数据回显
  1388. if (formData.data.buyCountryId) {
  1389. getCityData(formData.data.buyCountryId, "20");
  1390. }
  1391. if (formData.data.buyProvinceId) {
  1392. getCityData(formData.data.buyProvinceId, "30");
  1393. }
  1394. // 文件数据回显
  1395. getFileData();
  1396. let productIds = formData.data.quotationProductList.map((x) => x.productId);
  1397. proxy.getFileData({
  1398. businessIdList: productIds,
  1399. data: formData.data.quotationProductList,
  1400. att: "productId",
  1401. businessType: "0",
  1402. fileAtt: "productFile",
  1403. filePathAtt: "fileUrl",
  1404. });
  1405. });
  1406. };
  1407. const totalAmount = () => {
  1408. let money = 0;
  1409. if (
  1410. formData.data.quotationProductList &&
  1411. formData.data.quotationProductList.length > 0
  1412. ) {
  1413. for (let i = 0; i < formData.data.quotationProductList.length; i++) {
  1414. let iele = formData.data.quotationProductList[i];
  1415. let productPrice = 0;
  1416. for (let j = 0; j < iele.quotationProductBomList.length; j++) {
  1417. const jele = iele.quotationProductBomList[j];
  1418. // 计算新单价
  1419. jele.price = parseFloat(
  1420. Number(jele.priceCopy) * Number(jele.coefficient)
  1421. ).toFixed(2);
  1422. // 计算物料总计
  1423. jele.amount = parseFloat(
  1424. Number(jele.allQuantity) *
  1425. Number(jele.priceCopy) *
  1426. Number(jele.coefficient)
  1427. ).toFixed(2);
  1428. // 单个产品的一个物料的钱
  1429. productPrice += Number(
  1430. parseFloat(
  1431. Number(jele.quantity) *
  1432. Number(jele.priceCopy) *
  1433. Number(jele.coefficient)
  1434. ).toFixed(2)
  1435. );
  1436. }
  1437. iele.price = parseFloat(productPrice).toFixed(2);
  1438. iele.amount = parseFloat(
  1439. Number(iele.quantity) * Number(iele.price)
  1440. ).toFixed(2);
  1441. money += Number(iele.amount);
  1442. }
  1443. }
  1444. formData.data.amount = parseFloat(money).toFixed(2);
  1445. };
  1446. const publicTotalAmount = (val) => {
  1447. if (val) {
  1448. let money = 0;
  1449. if (
  1450. formData.data.quotationProductList &&
  1451. formData.data.quotationProductList.length > 0
  1452. ) {
  1453. for (let i = 0; i < formData.data.quotationProductList.length; i++) {
  1454. let iele = formData.data.quotationProductList[i];
  1455. let productPrice = 0;
  1456. for (let j = 0; j < iele.quotationProductBomList.length; j++) {
  1457. const jele = iele.quotationProductBomList[j];
  1458. // 系数赋值
  1459. jele.coefficient = val;
  1460. // 计算新单价
  1461. jele.price = parseFloat(
  1462. Number(jele.priceCopy) * Number(jele.coefficient)
  1463. ).toFixed(2);
  1464. // 计算物料总计
  1465. jele.amount = parseFloat(
  1466. Number(jele.allQuantity) *
  1467. Number(jele.priceCopy) *
  1468. Number(jele.coefficient)
  1469. ).toFixed(2);
  1470. // 单个产品的一个物料的钱
  1471. productPrice += Number(
  1472. parseFloat(
  1473. Number(jele.quantity) *
  1474. Number(jele.priceCopy) *
  1475. Number(jele.coefficient)
  1476. ).toFixed(2)
  1477. );
  1478. }
  1479. iele.price = parseFloat(productPrice).toFixed(2);
  1480. iele.amount = parseFloat(
  1481. Number(iele.quantity) * Number(iele.price)
  1482. ).toFixed(2);
  1483. money += Number(iele.amount);
  1484. }
  1485. }
  1486. formData.data.amount = parseFloat(money).toFixed(2);
  1487. }
  1488. };
  1489. const handleSubmitOne = () => {
  1490. formDomOne.value.handleSubmit(() => {
  1491. proxy
  1492. .msgConfirm()
  1493. .then((res) => {
  1494. submitLoading.value = true;
  1495. proxy.post("/extQuotation/add", formData.data).then((res) => {
  1496. proxy.msgTip("操作成功", 1);
  1497. submitLoading.value = false;
  1498. foreignDialog.value = false;
  1499. getList();
  1500. });
  1501. })
  1502. .catch((err) => {
  1503. submitLoading.value = false;
  1504. });
  1505. });
  1506. };
  1507. const detailDialog = ref(false);
  1508. const detailRowData = ref({});
  1509. const handleOpenDetail = (item) => {
  1510. detailRowData.value = item;
  1511. detailDialog.value = true;
  1512. };
  1513. const leftRowData = ref({});
  1514. const changeLeftData = (i) => {
  1515. leftRowData.value = i;
  1516. };
  1517. const backFormDom = ref(null);
  1518. const backDialog = ref(false);
  1519. const backFormConfig = computed(() => {
  1520. return [
  1521. {
  1522. type: "input",
  1523. itemType: "textarea",
  1524. rows: 10,
  1525. prop: "backRemark",
  1526. label: "退回原因",
  1527. itemWidth: 100,
  1528. disabled: false,
  1529. },
  1530. ];
  1531. });
  1532. const backFormOption = reactive({
  1533. inline: true,
  1534. labelWidth: 100,
  1535. itemWidth: 100,
  1536. disabled: false,
  1537. });
  1538. const backRules = ref({
  1539. backRemark: [{ required: true, message: "请输入退回原因", trigger: "blur" }],
  1540. });
  1541. const handleBack = (row) => {
  1542. formData.backData = {
  1543. id: row.id,
  1544. quotationStatus: 1,
  1545. backRemark: "",
  1546. };
  1547. backDialog.value = true;
  1548. };
  1549. const handleSubmitBack = () => {
  1550. backFormDom.value.handleSubmit(() => {
  1551. submitLoading.value = true;
  1552. proxy
  1553. .msgConfirm()
  1554. .then((res) => {
  1555. proxy.post("/saleQuotation/edit", formData.backData).then((res) => {
  1556. proxy.msgTip("操作成功", 1);
  1557. submitLoading.value = false;
  1558. backDialog.value = false;
  1559. getList();
  1560. detailDialog.value = false;
  1561. });
  1562. })
  1563. .catch((err) => {
  1564. submitLoading.value = false;
  1565. });
  1566. });
  1567. };
  1568. </script>
  1569. <style lang="scss" scoped>
  1570. .tenant {
  1571. padding: 20px;
  1572. }
  1573. ::v-deep(.el-input-number .el-input__inner) {
  1574. text-align: left;
  1575. }
  1576. .baseRow {
  1577. min-height: 24px;
  1578. border-top: 1px solid black;
  1579. border-left: 1px solid black;
  1580. }
  1581. .contentRow {
  1582. border-right: 1px solid black;
  1583. line-height: 24px;
  1584. padding-left: 4px;
  1585. }
  1586. .pic {
  1587. object-fit: contain;
  1588. width: 50px;
  1589. height: 50px;
  1590. cursor: pointer;
  1591. vertical-align: middle;
  1592. }
  1593. :deep(.bom-table .el-table__body-wrapper .el-table__body .el-table__row) {
  1594. background: #f4f4f5 !important;
  1595. }
  1596. </style>