index.vue 50 KB

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