index.vue 53 KB

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