modify_list-apply.vue 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644
  1. <template>
  2. <div>
  3. <div>
  4. <el-page-header :content="!cid ? '存货调价单' : '编辑'" @back="goBack" />
  5. </div>
  6. <br><br>
  7. <div>
  8. <el-form
  9. ref="screenForm"
  10. label-width="100px"
  11. size="small"
  12. label-position="left"
  13. >
  14. <el-row :gutter="20">
  15. <el-col :xs="24" :sm="12" :lg="6">
  16. <el-form-item label="单据编号">
  17. <el-input size="mini"
  18. v-model="base.updPriceBillId"
  19. placeholder="系统自动生成"
  20. disabled
  21. />
  22. </el-form-item>
  23. </el-col>
  24. <!-- <el-col :xs="24" :sm="12" :lg="6">
  25. <el-form-item label="调价业务员">
  26. <el-select
  27. placeholder="请选择调价业务员"
  28. filterable
  29. @change="handleUser"
  30. v-model="serviceId"
  31. >
  32. <el-option
  33. v-for="(item, index) in userList"
  34. :label="item.nickName"
  35. :value="item.roleId"
  36. :key="index"
  37. ></el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :xs="24" :sm="12" :lg="6">
  42. <el-form-item label="调价部门">
  43. <el-input size="mini"
  44. placeholder="调价部门"
  45. disabled
  46. v-model="adminCompanyName"
  47. ></el-input>
  48. </el-form-item>
  49. </el-col> -->
  50. <!-- <el-col :xs="24" :sm="12" :lg="6">
  51. <el-form-item label="销售类型">
  52. <el-select
  53. placeholder="请选择销售类型"
  54. filterable
  55. v-model="saleTypeId"
  56. >
  57. <el-option
  58. v-for="item in typeList"
  59. :label="item.saleName"
  60. :value="item.id"
  61. ></el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col> -->
  65. <el-col :xs="24" :sm="12" :lg="6">
  66. <el-form-item label="备注">
  67. <el-input size="mini" v-model="base.remark" placeholder="请输入" />
  68. </el-form-item>
  69. </el-col>
  70. <el-col :xs="24" :sm="12" :lg="6">
  71. <el-form-item label="" class="fr" />
  72. </el-col>
  73. </el-row>
  74. </el-form>
  75. </div>
  76. <div class="btn-group clearfixs" v-if="!cid">
  77. <!-- <el-upload
  78. class="import-btn"
  79. :action="baseURL + 'student/import'"
  80. :http-request="handleImport"
  81. :file-list="importFileList"
  82. :show-file-list="false"
  83. >
  84. <el-button
  85. type="primary"
  86. size="small"
  87. >导入调价单</el-button>
  88. </el-upload>
  89. <el-button
  90. type="primary"
  91. size="small"
  92. @click="hanleDownloadFiles"
  93. >下载模板</el-button> -->
  94. </div>
  95. <div class="mymain-container">
  96. <!-- 列表 -->
  97. <el-form v-if="!detail.length" size="small" label-position="left">
  98. <div class="table">
  99. <el-table
  100. v-loading="listLoading"
  101. :data="items"
  102. element-loading-text="Loading"
  103. border
  104. fit
  105. highlight-current-row
  106. stripe
  107. >
  108. <el-table-column
  109. align="center"
  110. label="操作类型"
  111. prop="nname"
  112. fixed="right"
  113. min-width="160"
  114. show-overflow-tooltip
  115. >
  116. <!-- <el-button type="text" class="textColor">修改</el-button> -->
  117. <template slot-scope="scope">
  118. <el-button
  119. type="text"
  120. class="textColor"
  121. @click="hanleDeleInd(scope.$index, scope.row.cid,scope.row.materialId)"
  122. >删除</el-button>
  123. </template>
  124. </el-table-column>
  125. <el-table-column
  126. align="center"
  127. label="销售类型"
  128. prop="mainId"
  129. min-width="160"
  130. show-overflow-tooltip
  131. >
  132. <template slot-scope="scope">
  133. <el-form-item>
  134. <template v-if="!cid">
  135. <el-select
  136. size="mini"
  137. v-model="scope.row.mainId"
  138. placeholder="请选择销售类型"
  139. @change="
  140. handleSale($event, scope.$index, scope.row.saleTypes)
  141. "
  142. >
  143. <el-option
  144. v-for="item in scope.row.saleTypes"
  145. :label="item.saleName"
  146. :value="item.id"
  147. />
  148. </el-select>
  149. </template>
  150. <template v-else>
  151. <el-select
  152. size="mini"
  153. v-model="scope.row.saleTypeId"
  154. placeholder="请选择销售类型"
  155. @change="handleSale($event, scope.$index, scope.row.id)"
  156. >
  157. <el-option
  158. v-for="item in typeList"
  159. :label="item.saleName"
  160. :value="item.id"
  161. />
  162. </el-select>
  163. </template>
  164. </el-form-item>
  165. </template>
  166. </el-table-column>
  167. <el-table-column
  168. align="center"
  169. label="物料编码"
  170. prop="materialNumber"
  171. min-width="160"
  172. show-overflow-tooltip
  173. >
  174. <template slot-scope="scope">
  175. <el-form-item>
  176. <el-input size="mini"
  177. v-model="scope.row.materialNumber"
  178. disabled
  179. />
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. align="center"
  185. label="产品名称"
  186. prop="materialName"
  187. min-width="160"
  188. show-overflow-tooltip
  189. >
  190. <template slot-scope="scope">
  191. <el-form-item>
  192. <el-input size="mini"
  193. v-model="scope.row.materialName"
  194. disabled
  195. />
  196. </el-form-item>
  197. </template>
  198. </el-table-column>
  199. <el-table-column
  200. align="center"
  201. label="规格型号"
  202. prop="specification"
  203. min-width="160"
  204. show-overflow-tooltip
  205. >
  206. <template slot-scope="scope">
  207. <el-form-item>
  208. <el-input size="mini"
  209. v-model="scope.row.specification"
  210. disabled
  211. />
  212. </el-form-item>
  213. </template>
  214. </el-table-column>
  215. <el-table-column
  216. align="center"
  217. label="计量单位"
  218. prop="unit"
  219. min-width="160"
  220. show-overflow-tooltip
  221. >
  222. <template slot-scope="scope">
  223. <el-form-item>
  224. <el-input size="mini" v-model="scope.row.unit" disabled />
  225. </el-form-item>
  226. </template>
  227. </el-table-column>
  228. <el-table-column
  229. align="center"
  230. label="批发价"
  231. prop="batchPrice"
  232. min-width="160"
  233. show-overflow-tooltip
  234. >
  235. <template slot-scope="scope">
  236. <el-form-item>
  237. <el-input size="mini" v-model="scope.row.batchPrice" placeholder="请输入批发价" />
  238. </el-form-item>
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. align="center"
  243. label="格力折扣"
  244. prop="discAmount"
  245. min-width="160"
  246. show-overflow-tooltip
  247. ><template slot-scope="scope">
  248. <el-form-item>
  249. <el-input size="mini" v-model="scope.row.discAmount" placeholder="请输入格力折扣" />
  250. </el-form-item>
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. align="center"
  255. label="返利类型"
  256. prop="rebateUseRate"
  257. min-width="160"
  258. show-overflow-tooltip
  259. ><template slot-scope="scope">
  260. <el-form-item>
  261. <el-select
  262. size="mini"
  263. v-model="scope.row.walletRebateId"
  264. multiple
  265. :disabled="scope.row.fang"
  266. placeholder="请选择返利类型"
  267. @change="handelRebateList($event, scope.$index, scope.row)"
  268. @remove-tag="handleRemove2($event, scope.$index, scope.row)"
  269. >
  270. <el-option
  271. v-for="(item, index) in scope.row.rebateList"
  272. :key="item.index"
  273. :value="item.walletRebateId"
  274. :label="item.name"
  275. />
  276. </el-select>
  277. </el-form-item>
  278. </template>
  279. </el-table-column>
  280. <el-table-column
  281. align="center"
  282. label="生效日期"
  283. prop="startDate"
  284. min-width="160"
  285. show-overflow-tooltip
  286. ><template slot-scope="scope">
  287. <el-form-item>
  288. <el-date-picker
  289. size="mini"
  290. v-model="scope.row.startDate"
  291. type="date"
  292. placeholder="请输入调价日期"
  293. value-format="yyyy-MM-dd"
  294. />
  295. </el-form-item>
  296. </template>
  297. </el-table-column>
  298. <el-table-column
  299. align="center"
  300. label="失效日期"
  301. prop="endDate"
  302. min-width="160"
  303. show-overflow-tooltip
  304. ><template slot-scope="scope">
  305. <el-form-item>
  306. <el-date-picker
  307. v-model="scope.row.endDate"
  308. type="date"
  309. size="mini"
  310. placeholder="请输入调价日期"
  311. value-format="yyyy-MM-dd"
  312. />
  313. </el-form-item>
  314. </template>
  315. </el-table-column>
  316. <!-- <el-table-column
  317. align="center"
  318. label="是否促销价"
  319. prop="isPromote"
  320. min-width="160"
  321. show-overflow-tooltip
  322. ><template slot-scope="scope">
  323. <el-form-item>
  324. <el-select
  325. v-model="scope.row.isPromote"
  326. placeholder="请选择是否促销价"
  327. >
  328. <el-option
  329. v-for="item in scope.row.isPromoteArr"
  330. :key="item.bool"
  331. :value="item.bool"
  332. :label="item.value"
  333. />
  334. </el-select>
  335. </el-form-item>
  336. </template>
  337. </el-table-column> -->
  338. <el-table-column
  339. align="center"
  340. label="数量"
  341. prop="qty"
  342. min-width="160"
  343. show-overflow-tooltip
  344. ><template slot-scope="scope">
  345. <el-form-item>
  346. <el-input size="mini" v-model="scope.row.qty" placeholder="请输入数量" />
  347. </el-form-item>
  348. </template>
  349. </el-table-column>
  350. <el-table-column
  351. align="center"
  352. label="现金钱包"
  353. prop="wallets"
  354. min-width="160"
  355. show-overflow-tooltip
  356. ><template slot-scope="scope">
  357. <el-form-item>
  358. <template v-if="!cid">
  359. <el-select
  360. size="mini"
  361. v-model="scope.row.walletsId"
  362. multiple
  363. clearable
  364. placeholder="请选择现金钱包"
  365. @change="handelWallets($event, scope.$index, scope.row)"
  366. @remove-tag="
  367. handleRemove($event, scope.$index, scope.row)
  368. "
  369. >
  370. <el-option
  371. v-for="item in scope.row.walleList"
  372. :key="item.id"
  373. :value="item.id"
  374. :label="item.name"
  375. /> </el-select></template>
  376. <template v-else>
  377. <el-select
  378. v-model="scope.row.walletsId"
  379. multiple
  380. clearable
  381. size="mini"
  382. placeholder="请选择现金钱包"
  383. @change="handelWallets($event, scope.$index, scope.row)"
  384. @remove-tag="
  385. handleRemove($event, scope.$index, scope.row)
  386. "
  387. >
  388. <el-option
  389. v-for="item in scope.row.walleList"
  390. :key="item.walletId || item.id"
  391. :value="item.walletId || item.id"
  392. :label="item.walletName || item.name"
  393. /> </el-select></template>
  394. </el-form-item>
  395. </template>
  396. </el-table-column>
  397. <el-table-column
  398. align="center"
  399. label="发布"
  400. prop="isPublish"
  401. min-width="160"
  402. show-overflow-tooltip
  403. ><template slot-scope="scope">
  404. <el-form-item>
  405. <el-select
  406. size="mini"
  407. v-model="scope.row.isPublish"
  408. placeholder="请选择是否发布"
  409. >
  410. <el-option
  411. v-for="item in scope.row.isPublishArr"
  412. :key="item.bool"
  413. :value="item.bool"
  414. :label="item.value"
  415. />
  416. </el-select>
  417. </el-form-item>
  418. </template>
  419. </el-table-column>
  420. </el-table>
  421. </div>
  422. </el-form>
  423. <el-form v-else :model="detail" size="small" label-position="left">
  424. <el-table
  425. v-loading="listLoading"
  426. :data="detail"
  427. element-loading-text="Loading"
  428. border
  429. fit
  430. highlight-current-row
  431. stripe
  432. >
  433. <el-table-column
  434. align="center"
  435. label="操作类型"
  436. prop="nname"
  437. min-width="160"
  438. show-overflow-tooltip
  439. >
  440. <!-- <el-button type="text" class="textColor">修改</el-button> -->
  441. <template slot-scope="scope">
  442. <el-button
  443. type="text"
  444. class="textColor"
  445. @click="hanleDeleInd(scope.$index)"
  446. >删除</el-button>
  447. </template>
  448. </el-table-column>
  449. <el-table-column
  450. align="center"
  451. label="销售类型"
  452. prop="mainId"
  453. min-width="160"
  454. show-overflow-tooltip
  455. >
  456. <template slot-scope="scope">
  457. <el-form-item>
  458. <el-select
  459. v-model="scope.row.saleTypeId"
  460. placeholder="请选择销售类型"
  461. @change="handleSale($event, scope.$index, scope.row.id)"
  462. >
  463. <el-option
  464. v-for="item in typeList"
  465. :label="item.saleName"
  466. :value="item.id"
  467. />
  468. </el-select>
  469. </el-form-item>
  470. </template>
  471. </el-table-column>
  472. <el-table-column
  473. align="center"
  474. label="物料编码"
  475. prop="materialNumber"
  476. min-width="160"
  477. show-overflow-tooltip
  478. >
  479. <template slot-scope="scope">
  480. <el-form-item>
  481. <el-input size="mini" v-model="scope.row.materialNumber" />
  482. </el-form-item>
  483. </template>
  484. </el-table-column>
  485. <el-table-column
  486. align="center"
  487. label="产品名称"
  488. prop="materialName"
  489. min-width="160"
  490. show-overflow-tooltip
  491. >
  492. <template slot-scope="scope">
  493. <el-form-item>
  494. <el-input size="mini" v-model="scope.row.materialName" />
  495. </el-form-item>
  496. </template>
  497. </el-table-column>
  498. <el-table-column
  499. align="center"
  500. label="规格型号"
  501. prop="specification"
  502. min-width="160"
  503. show-overflow-tooltip
  504. >
  505. <template slot-scope="scope">
  506. <el-form-item>
  507. <el-input size="mini" v-model="scope.row.specification" />
  508. </el-form-item>
  509. </template>
  510. </el-table-column>
  511. <el-table-column
  512. align="center"
  513. label="计量单位"
  514. prop="unit"
  515. min-width="160"
  516. show-overflow-tooltip
  517. >
  518. <template slot-scope="scope">
  519. <el-form-item>
  520. <el-input size="mini" v-model="scope.row.SalesType" />
  521. </el-form-item>
  522. </template>
  523. </el-table-column>
  524. <el-table-column
  525. align="center"
  526. label="批发价"
  527. prop="batchPrice"
  528. min-width="160"
  529. show-overflow-tooltip
  530. >
  531. <template slot-scope="scope">
  532. <el-form-item>
  533. <el-input size="mini" v-model="scope.row.batchPrice" />
  534. </el-form-item>
  535. </template>
  536. </el-table-column>
  537. <el-table-column
  538. align="center"
  539. label="零售价"
  540. prop="retailPrice"
  541. min-width="160"
  542. show-overflow-tooltip
  543. ><template slot-scope="scope">
  544. <el-form-item>
  545. <el-input size="mini" v-model="scope.row.retailPrice" />
  546. </el-form-item>
  547. </template>
  548. </el-table-column>
  549. <el-table-column
  550. align="center"
  551. label="返利使用比例"
  552. prop="rebateUseRate"
  553. min-width="160"
  554. show-overflow-tooltip
  555. ><template slot-scope="scope">
  556. <el-form-item>
  557. <el-input size="mini" v-model="scope.row.rebateUseRate" />
  558. </el-form-item>
  559. </template>
  560. </el-table-column>
  561. <el-table-column
  562. align="center"
  563. label="返利类型"
  564. prop="rebateUseRate"
  565. min-width="160"
  566. show-overflow-tooltip
  567. ><template slot-scope="scope">
  568. <el-form-item>
  569. <el-select
  570. v-model="scope.row.walletRebateId"
  571. multiple
  572. :disabled="scope.row.fang"
  573. placeholder="请选择返利类型"
  574. @change="handelRebateList($event, scope.$index, scope.row)"
  575. @remove-tag="handleRemove2($event, scope.$index, scope.row)"
  576. >
  577. <el-option
  578. v-for="(item, index) in scope.row.rebateList"
  579. :key="item.index"
  580. :value="item.walletRebateId"
  581. :label="item.name"
  582. />
  583. </el-select>
  584. </el-form-item>
  585. </template>
  586. </el-table-column>
  587. <el-table-column
  588. align="center"
  589. label="生效日期"
  590. prop="startDate"
  591. min-width="160"
  592. show-overflow-tooltip
  593. ><template slot-scope="scope">
  594. <el-form-item>
  595. <el-date-picker
  596. v-model="scope.row.startDate"
  597. type="date"
  598. placeholder="请输入调价日期"
  599. value-format="yyyy-MM-dd"
  600. />
  601. </el-form-item>
  602. </template>
  603. </el-table-column>
  604. <el-table-column
  605. align="center"
  606. label="失效日期"
  607. prop="endDate"
  608. min-width="160"
  609. show-overflow-tooltip
  610. ><template slot-scope="scope">
  611. <el-form-item>
  612. <el-date-picker
  613. v-model="scope.row.endDate"
  614. type="date"
  615. placeholder="请输入调价日期"
  616. value-format="yyyy-MM-dd"
  617. />
  618. </el-form-item>
  619. </template>
  620. </el-table-column>
  621. <el-table-column
  622. align="center"
  623. label="是否促销价"
  624. prop="isPromote"
  625. min-width="160"
  626. show-overflow-tooltip
  627. ><template slot-scope="scope">
  628. <el-form-item>
  629. <el-select
  630. v-model="scope.row.isPromote"
  631. placeholder="请选择是否促销价"
  632. >
  633. <el-option
  634. v-for="item in scope.row.isPromoteArr"
  635. :key="item.bool"
  636. :value="item.bool"
  637. :label="item.value"
  638. />
  639. </el-select>
  640. </el-form-item>
  641. </template>
  642. </el-table-column>
  643. <el-table-column
  644. align="center"
  645. label="数量"
  646. prop="qty"
  647. min-width="160"
  648. show-overflow-tooltip
  649. ><template slot-scope="scope">
  650. <el-form-item>
  651. <el-input size="mini" v-model="scope.row.qty" />
  652. </el-form-item>
  653. </template>
  654. </el-table-column>
  655. <el-table-column
  656. align="center"
  657. label="支付钱包类型"
  658. prop="wallets"
  659. min-width="160"
  660. show-overflow-tooltip
  661. ><template slot-scope="scope">
  662. <el-form-item>
  663. <el-select
  664. v-model="scope.row.isPublish"
  665. placeholder="请选择支付钱包类型"
  666. >
  667. <el-option
  668. v-for="item in scope.row.rebateList"
  669. :key="item.walletRebateId"
  670. :value="item.walletRebateId"
  671. :label="item.name"
  672. />
  673. </el-select>
  674. </el-form-item>
  675. </template>
  676. </el-table-column>
  677. <el-table-column
  678. align="center"
  679. label="发布"
  680. prop="isPublish"
  681. min-width="160"
  682. show-overflow-tooltip
  683. ><template slot-scope="scope">
  684. <el-form-item>
  685. <el-select
  686. v-model="scope.row.isPublish"
  687. placeholder="请选择是否发布"
  688. >
  689. <el-option
  690. v-for="item in scope.row.isPublishArr"
  691. :key="item.bool"
  692. :value="item.bool"
  693. :label="item.value"
  694. />
  695. </el-select>
  696. </el-form-item>
  697. </template>
  698. </el-table-column>
  699. </el-table>
  700. </el-form>
  701. <el-dialog
  702. title="提示"
  703. :visible.sync="centerDialogVisible"
  704. width="50%"
  705. center
  706. class="dia"
  707. >
  708. <el-form
  709. ref="form"
  710. :model="form"
  711. label-width="80px"
  712. :inline="false"
  713. size="normal"
  714. >
  715. <el-form-item label="产品类型">
  716. <el-select v-model="materialId" placeholder="请选择" width="100%">
  717. <el-option
  718. v-for="item in materialLis"
  719. :key="item.id"
  720. :label="item.name"
  721. :value="item.id"
  722. />
  723. </el-select>
  724. </el-form-item>
  725. </el-form>
  726. <span slot="footer" class="dialog-footer">
  727. <el-button @click="centerDialogVisible = false">取 消</el-button>
  728. <el-button type="primary" @click="hanleAdd">确 定</el-button>
  729. </span>
  730. </el-dialog>
  731. </div>
  732. <div class="btn-group clearfix">
  733. <template v-if="!cid">
  734. <el-button size="small" @click="handleReseat">重置</el-button>
  735. <el-button
  736. size="small"
  737. type="primary"
  738. @click="hanleSbumit"
  739. >提交</el-button>
  740. </template>
  741. <template v-else>
  742. <el-button
  743. size="small"
  744. type="primary"
  745. @click="hanleSave"
  746. >保存</el-button>
  747. </template>
  748. <el-button
  749. style="float: right"
  750. type="primary"
  751. size="small"
  752. @click="centerDialogVisible = true"
  753. >添加</el-button>
  754. </div>
  755. <el-dialog title="" :visible.sync="centerDialogVisible" width="80%" center>
  756. <div>
  757. <el-form
  758. ref="screenForm"
  759. :model="screenForm"
  760. label-width="70px"
  761. size="small"
  762. label-position="left"
  763. >
  764. <el-row :gutter="20">
  765. <el-col :xs="24" :sm="12" :lg="6">
  766. <el-form-item label="名称" prop="keyword">
  767. <el-input size="mini"
  768. v-model="screenForm.keyword"
  769. placeholder="请输入名称"
  770. />
  771. </el-form-item>
  772. </el-col>
  773. <el-col :xs="24" :sm="12" :lg="6">
  774. <el-form-item label="物料编码" prop="materialNumber">
  775. <el-input size="mini"
  776. v-model="screenForm.materialNumber"
  777. placeholder="请输入物料编码"
  778. />
  779. </el-form-item>
  780. </el-col>
  781. <el-col :xs="24" :sm="12" :lg="6">
  782. <el-form-item label="规格" prop="specification">
  783. <el-input size="mini"
  784. v-model="screenForm.specification"
  785. placeholder="请输入规格"
  786. />
  787. </el-form-item>
  788. </el-col>
  789. <el-col :xs="24" :sm="12" :lg="12" class="tr">
  790. <el-form-item label="">
  791. <el-button
  792. size="small"
  793. @click="resetScreenForm"
  794. >清空</el-button>
  795. <el-button
  796. size="small"
  797. type="primary"
  798. @click="submitScreenForm"
  799. >搜索</el-button>
  800. </el-form-item>
  801. </el-col>
  802. </el-row>
  803. </el-form>
  804. </div>
  805. <div class="mymain-container">
  806. <div class="table">
  807. <el-table
  808. ref="multipleTable"
  809. v-loading="listLoading"
  810. :data="dataList"
  811. element-loading-text="Loading"
  812. border
  813. fit
  814. highlight-current-row
  815. stripe
  816. @select-all="handleSelectionAllChange"
  817. @selection-change="handleSelectionChange"
  818. >
  819. <!-- :selectable="selectable"-->
  820. <el-table-column
  821. align="center"
  822. type="selection"
  823. width="55"
  824. />
  825. <el-table-column
  826. align="center"
  827. label="使用组织"
  828. prop="useOrgName"
  829. min-width="100"
  830. />
  831. <el-table-column
  832. align="center"
  833. label="物料编码"
  834. prop="number"
  835. min-width="100"
  836. label-class-name="bianma"
  837. class-name="fontstyle"
  838. />
  839. <el-table-column
  840. align="center"
  841. label="名称"
  842. prop="name"
  843. min-width="100"
  844. />
  845. <el-table-column
  846. align="center"
  847. label="规格型号"
  848. prop="specification"
  849. min-width="100"
  850. />
  851. <el-table-column
  852. align="center"
  853. label="数据状态"
  854. prop="forbidStatus"
  855. min-width="100"
  856. >
  857. <template slot-scope="scope">
  858. <el-tag
  859. v-if="scope.row.forbidStatus == 'A'"
  860. type="success"
  861. >正常</el-tag>
  862. <el-tag v-else type="danger">禁用</el-tag>
  863. </template>
  864. </el-table-column>
  865. <el-table-column
  866. align="center"
  867. label="是否维护商城资料"
  868. prop="maintainData"
  869. min-width="100"
  870. />
  871. <el-table-column
  872. align="center"
  873. label="是否维护内外机档案"
  874. prop="maintainFiles"
  875. min-width="100"
  876. />
  877. <el-table-column
  878. align="center"
  879. label="基本单位"
  880. prop="baseUnitId"
  881. min-width="100"
  882. />
  883. <el-table-column
  884. align="center"
  885. label="已使用"
  886. prop="used"
  887. min-width="100"
  888. />
  889. </el-table>
  890. </div>
  891. <!-- 分页 -->
  892. <div class="fr">
  893. <el-pagination
  894. :current-page="currentPage"
  895. :page-sizes="[10]"
  896. :page-size="10"
  897. layout="total, sizes, prev, pager, next, jumper"
  898. :total="listTotal"
  899. @size-change="handleSizeChange"
  900. @current-change="handleCurrentChange"
  901. />
  902. </div>
  903. </div>
  904. <span slot="footer" class="dialog-footer">
  905. <el-button @click="centerDialogVisible = false">取 消</el-button>
  906. <el-button type="primary" @click="handleDetermine">确 定</el-button>
  907. </span>
  908. </el-dialog>
  909. </div>
  910. </template>
  911. <script>
  912. import {
  913. getMaterialList,
  914. getProductRriceAdd,
  915. getProductRriceDetail,
  916. getRebate,
  917. getTypeList,
  918. getUserList,
  919. getWalletList,
  920. handleEdit
  921. } from '@/api/basic_data/material'
  922. import { downloadFiles, handleImport } from '@/utils/util'
  923. import Mixin from '@/mixin/index'
  924. export default {
  925. mixins: [Mixin],
  926. props: ['cid'],
  927. data() {
  928. return {
  929. baseURL: '',
  930. importFileList: [],
  931. listLoading: false,
  932. importLoading:false,
  933. screenForm: {
  934. keyword: '',
  935. specification: '',
  936. materialNumber:''
  937. },
  938. base: {
  939. adminCompanyId: '',
  940. adminWebsitId: '',
  941. billId: '',
  942. examineNote: '',
  943. examineResult: true,
  944. examineStatus: '',
  945. id: null,
  946. serviceId: '',
  947. serviceName: '',
  948. remark: '',
  949. saleTypeId: ''
  950. },
  951. items: [],
  952. materialLis: [],
  953. materialId: '',
  954. rebateList: [],
  955. typeList: [],
  956. saleTypeId: '',
  957. serviceId: '',
  958. adminCompanyId: '',
  959. serviceName: '',
  960. adminCompanyName: '',
  961. adminWebsitId: '',
  962. detail: [],
  963. form: {},
  964. startDate: '',
  965. userList: [],
  966. centerDialogVisible: false,
  967. selectData: [],
  968. walleList: [],
  969. fang: true,
  970. wall1: [],
  971. wall2: []
  972. }
  973. },
  974. mounted() {
  975. },
  976. methods: {
  977. handleSale(e, index, saleTypes) {
  978. // console.log(this.rebateList);
  979. this.$set(this.items[index], 'rebateList', [])
  980. const linshi = []
  981. let saleArr = []
  982. const rebateList = []
  983. this.rebateList.forEach((k) => {
  984. k.saleTypes.forEach((j) => {
  985. if (!linshi.includes(j.saleTypeId) && j.saleTypeId == e) {
  986. rebateList.push(k)
  987. }
  988. })
  989. })
  990. saleArr = this.typeList.filter((i) => {
  991. return e == i.id
  992. })
  993. console.log(rebateList, '4444', this.rebateList, e)
  994. // this.items[index].mainName = saleArr[0].mainName;
  995. this.items[index].saleTypeId = e
  996. this.items[index].fang = false
  997. this.items[index].saleTypeName = saleArr[0].saleName
  998. this.$set(this.items[index], 'rebateList', rebateList)
  999. // this.fang = false;
  1000. },
  1001. resArr(arr1, arr2) {
  1002. return arr1.filter((v) => arr2.every((val) => val.id != v.id))
  1003. },
  1004. // xua
  1005. handelWallets(e, index, row) {
  1006. // const id = row.cid || row.updPriceBillId
  1007. // // if (e && e.length) {
  1008. // for (let i = 0; i < e.length; i++) {
  1009. // // if (!this.wall1.includes(e[e.length - 1])) {
  1010. // this.$set(row, 'wallets', [
  1011. // ...row.wallets,
  1012. // {
  1013. // type: 'COMMONLY',REBATE
  1014. // id: '',
  1015. // updPriceBillId: id,
  1016. // updPriceBillItemId: id,
  1017. // walletId: e[e.length - 1]
  1018. // }
  1019. // ])
  1020. // // this.wall1.push(e[e.length - 1])
  1021. // }
  1022. // // }
  1023. // // }
  1024. },
  1025. handelRebateList(e, index, row) {
  1026. // const id = row.cid || row.updPriceBillId
  1027. // if (e && e.length) {
  1028. // for (let i = 0; i < e.length; i++) {
  1029. // if (!this.wall2.includes(e[e.length - 1])) {
  1030. // console.log(44544)
  1031. // this.$set(row, 'wallets', [
  1032. // ...row.wallets,
  1033. // {
  1034. // type: 'REBATE',
  1035. // id: '',
  1036. // updPriceBillId: id,
  1037. // updPriceBillItemId: id,
  1038. // walletId: e[e.length - 1]
  1039. // }
  1040. // ])
  1041. // this.wall2.push(e[e.length - 1])
  1042. // }
  1043. // }
  1044. // }
  1045. },
  1046. handleRemove(e, index, row) {
  1047. // const copxyWall = JSON.parse(JSON.stringify(row.wallets))
  1048. // if (row.wallets[0].walletId === e) {
  1049. // copxyWall.splice(0, 1)
  1050. // }
  1051. // for (let i = 0; i < row.wallets.length; i++) {
  1052. // if (this.wall1.includes(e) && row.wallets[i].walletId === e) {
  1053. // this.wall1.splice(i, 1)
  1054. // copxyWall.splice(i, 1)
  1055. // }
  1056. // }
  1057. // this.$set(row, 'wallets', copxyWall)
  1058. },
  1059. handleRemove2(e, index, row) {
  1060. // const copxyWall = JSON.parse(JSON.stringify(row.wallets))
  1061. // for (let i = 0; i < row.wallets.length; i++) {
  1062. // if (this.wall2.includes(e) && row.wallets[i].walletId == e) {
  1063. // copxyWall.splice(i, 1)
  1064. // this.wall2.splice(i, 1)
  1065. // }
  1066. // }
  1067. // this.$set(row, 'wallets', copxyWall)
  1068. },
  1069. handleUser(e) {
  1070. const adminCompany = this.userList.filter((k) => {
  1071. return e == k.roleId
  1072. })[0]
  1073. this.adminWebsitId = adminCompany.adminUserId
  1074. this.adminCompanyName = adminCompany.adminCompanyName
  1075. this.serviceName = adminCompany.nickName || 'd'
  1076. this.serviceId = adminCompany.roleId
  1077. },
  1078. goBack() {
  1079. this.$parent.cid = ''
  1080. this.$parent.show = 1
  1081. // 更新父组件数据
  1082. this.$parent.getList()
  1083. },
  1084. indexMethod(index) {
  1085. console.log(index)
  1086. },
  1087. hanleDeleInd(index, id,materialId) {
  1088. if (id || materialId) {
  1089. const dataArr = JSON.parse(JSON.stringify(this.dataList))
  1090. for (let j = 0; j < dataArr.length; j++) {
  1091. if ((id || materialId) === dataArr[j].id) {
  1092. // dataArr[j].disabled = false
  1093. console.log(747)
  1094. this.$set(dataArr[j], 'disabled', false)
  1095. }
  1096. }
  1097. this.dataList = dataArr
  1098. }
  1099. this.items.splice(index, 1)
  1100. },
  1101. handleDetermine() {
  1102. if (this.selectData.length) {
  1103. for (let i = 0; i < this.selectData.length; i++) {
  1104. for (let j = 0; j < this.dataList.length; j++) {
  1105. if (this.selectData[i].id == this.dataList[j].id) {
  1106. this.dataList[j].disabled = true
  1107. }
  1108. }
  1109. this.items.push({
  1110. baseUnitId: '',
  1111. batchPrice: '',
  1112. unit: this.selectData[i].baseUnitId,
  1113. billId: '',
  1114. endDate: '',
  1115. isPromote: '',
  1116. isPublish: '',
  1117. materialId: this.selectData[i].id,
  1118. materialName: this.selectData[i].name,
  1119. materialNumber: this.selectData[i].number,
  1120. discAmount: '',
  1121. saleTypes: this.selectData[i].saleTypes,
  1122. materialOldNumber: this.selectData[i].oldNumber,
  1123. parentId: '',
  1124. walletRebateName: '',
  1125. walletRebateId: [],
  1126. rebateRate: '',
  1127. qty: '',
  1128. rebateUseRate: '',
  1129. retailPrice: '' || 0,
  1130. saleTypeId: '',
  1131. specification: this.selectData[i].specification,
  1132. startDate: this.selectData[i].startDate,
  1133. wallets: [],
  1134. rebateWallets: [],
  1135. rebateList: [],
  1136. walletsId: [this.selectData[i].wallets[0].id],
  1137. walleList: this.selectData[i].wallets,
  1138. isPublishArr: [
  1139. {
  1140. value: '是',
  1141. bool: true
  1142. },
  1143. {
  1144. value: '否',
  1145. bool: false
  1146. }
  1147. ],
  1148. isPromoteArr: [
  1149. {
  1150. value: '是',
  1151. bool: true
  1152. },
  1153. {
  1154. value: '否',
  1155. bool: false
  1156. }
  1157. ],
  1158. cid: this.selectData[i].id,
  1159. fang: true
  1160. })
  1161. }
  1162. this.selectData = []
  1163. this.$refs.multipleTable.clearSelection()
  1164. this.centerDialogVisible = false
  1165. } else {
  1166. this.$errorMsg('请选择内容')
  1167. }
  1168. },
  1169. getMaterialList() {
  1170. const params = {
  1171. pageNum: 1,
  1172. pageSize: 10,
  1173. keyword: '',
  1174. bindMain: true
  1175. }
  1176. getMaterialList(params).then((res) => {
  1177. this.materialLis = res.data.records
  1178. })
  1179. },
  1180. handleSelectionAllChange(e) {
  1181. this.selectData = e
  1182. },
  1183. handleSelectionChange(e) {
  1184. this.selectData = e
  1185. },
  1186. hanleAdd() {
  1187. if (this.materialId) {
  1188. this.centerDialogVisible = false
  1189. } else {
  1190. this.$errorMsg('请选择产品')
  1191. }
  1192. },
  1193. async getList() {
  1194. const params1 = {
  1195. pageNum: 1,
  1196. pageSize: -1,
  1197. saleCode: '',
  1198. saleName: '',
  1199. status: ''
  1200. }
  1201. getTypeList(params1).then((res) => {
  1202. this.typeList = res.data.records
  1203. })
  1204. getUserList({
  1205. pageNum: 1,
  1206. pageSize: -1,
  1207. adminWebsitId: '',
  1208. isCustomer: 0,
  1209. roleId: '',
  1210. status: '',
  1211. userName: ''
  1212. }).then((res) => {
  1213. this.userList = res.data.records
  1214. })
  1215. this.listLoading = true
  1216. const params = {
  1217. pageNum: this.currentPage,
  1218. pageSize: 10 || this.pageSize,
  1219. keyword: this.screenForm.keyword,
  1220. specification: this.screenForm.specification,
  1221. number:this.screenForm.materialNumber,
  1222. bindMain: true,
  1223. }
  1224. getMaterialList(params).then((res) => {
  1225. this.dataList = res.data.records
  1226. this.listTotal = res.data.total
  1227. this.listLoading = false
  1228. })
  1229. const rebateParams = {
  1230. pageNum: 1,
  1231. pageSize: -1,
  1232. mainName: '',
  1233. saleTypeCode: '',
  1234. saleTypeName: '',
  1235. status: ''
  1236. }
  1237. const ress = await getRebate(rebateParams)
  1238. this.rebateList = ress.data.records
  1239. const wall = await getWalletList({ mainId: '', walletName: '' })
  1240. for (let u = 0; u < wall.data.length; u++) {
  1241. wall.data[u].walletId = wall.data[u].id
  1242. wall.data[u].walletName = wall.data[u].name
  1243. }
  1244. this.walleList = wall.data
  1245. if (this.$parent.show === 5) {
  1246. getProductRriceDetail({ id: this.cid }).then((res) => {
  1247. for (let i = 0; i < res.data.items.length; i++) {
  1248. const linshi = []
  1249. const rebateList = []
  1250. const walletIds = []
  1251. const walletRebateIds = []
  1252. res.data.items[i].isPublishArr = [
  1253. {
  1254. value: '是',
  1255. bool: true
  1256. },
  1257. {
  1258. value: '否',
  1259. bool: false
  1260. }
  1261. ]
  1262. res.data.items[i].isPromoteArr = [
  1263. {
  1264. value: '是',
  1265. bool: true
  1266. },
  1267. {
  1268. value: '否',
  1269. bool: false
  1270. }
  1271. ]
  1272. res.data.items[i].wallets = []
  1273. res.data.items[i].walletsId = []
  1274. res.data.items[i].walletRebateId = []
  1275. res.data.items[i].rebateWallets = []
  1276. for (let p = 0; p < res.data.items[i].wallets2.length; p++) {
  1277. if (res.data.items[i].wallets2[p].type === 'COMMONLY') {
  1278. walletIds.push(res.data.items[i].wallets2[p].walletId)
  1279. this.$set(res.data.items[i], 'wallets', [
  1280. ...res.data.items[i].wallets,
  1281. {
  1282. type: 'COMMONLY',
  1283. id: '',
  1284. updPriceBillId: res.data.items[i].updPriceBillId,
  1285. updPriceBillItemId: res.data.items[i].updPriceBillId,
  1286. walletId: res.data.items[i].wallets2[p].walletId
  1287. }
  1288. ])
  1289. } else if (res.data.items[i].wallets2[p].type === 'REBATE') {
  1290. walletRebateIds.push(res.data.items[i].wallets2[p].walletId)
  1291. this.$set(res.data.items[i], 'wallets', [
  1292. ...res.data.items[i].wallets,
  1293. {
  1294. type: 'REBATE',
  1295. id: '',
  1296. updPriceBillId: res.data.items[i].updPriceBillId,
  1297. updPriceBillItemId: res.data.items[i].updPriceBillId,
  1298. walletId: res.data.items[i].wallets2[p].walletId
  1299. }
  1300. ])
  1301. }
  1302. }
  1303. console.log(res.data.items[i].wallets)
  1304. this.rebateList.forEach((k) => {
  1305. k.saleTypes.forEach((j) => {
  1306. if (
  1307. !linshi.includes(j.saleTypeId) &&
  1308. j.saleTypeId === res.data.items[i].saleTypeId
  1309. ) {
  1310. for (let w = 0; w < walletRebateIds.length; w++) {
  1311. if (walletRebateIds[w] !== k.walletRebateId) {
  1312. // walletRebateIds.splice(w, 1)
  1313. }
  1314. }
  1315. rebateList.push(k)
  1316. }
  1317. })
  1318. })
  1319. if (this.dataList.length) {
  1320. for (let j = 0; j < res.data.items.length; j++) {
  1321. for (let k = 0; k < this.dataList.length; k++) {
  1322. if (res.data.items[j].materialId === this.dataList[k].id) {
  1323. this.dataList[k].disabled = true
  1324. }
  1325. }
  1326. }
  1327. // console.log(this.dataList)
  1328. }
  1329. this.$set(res.data.items[i], 'walletsId', walletIds)
  1330. this.$set(res.data.items[i], 'walletRebateId', walletRebateIds)
  1331. res.data.items[i].walleList = this.walleList
  1332. res.data.items[i].rebateList = rebateList
  1333. res.data.items[i].fang = false
  1334. }
  1335. this.items = res.data.items
  1336. this.base = res.data
  1337. this.listLoading = false
  1338. })
  1339. } else {
  1340. }
  1341. },
  1342. /**
  1343. * 根据条件禁用行复选框
  1344. * 函数返回值为false则禁用选择(反之亦然)
  1345. * @param {Object} row - 行数据
  1346. * @param {String} index - 索引值
  1347. * @return Boolean
  1348. */
  1349. // selectable: function(row, index) {
  1350. // // row.disabled == undefined 才能被选中
  1351. // if (row.disabled == undefined || row.disabled == false) {
  1352. // return true
  1353. // } else {
  1354. // return false
  1355. // }
  1356. // // 函数必须有返回值且是布尔值
  1357. // // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
  1358. // // 如果没有返回值则默认返回false(全部无法选中)
  1359. // },
  1360. hanleSbumit() {
  1361. this.filterWallets(this.items)
  1362. // return
  1363. const params = {
  1364. ...this.base,
  1365. items: this.items,
  1366. saleTypeId: this.saleTypeId,
  1367. adminWebsitId: this.adminWebsitId,
  1368. serviceId: this.serviceId,
  1369. adminCompanyName: this.adminCompanyName,
  1370. serviceName: this.nickName
  1371. }
  1372. // console.log(this.filterWallets(this.items),params);
  1373. getProductRriceAdd(params).then((res) => {
  1374. console.log(res.code,'klkk');
  1375. this.$successMsg('成功')
  1376. this.$parent.show = 1
  1377. this.$parent.getList()
  1378. }).catch((err)=>{
  1379. console.log(err);
  1380. for (let j = 0; j < this.items.length; j++) {
  1381. this.$set(this.items[j],'wallets',[])
  1382. }
  1383. })
  1384. },
  1385. hanleSave() {
  1386. this.filterWallets(this.items)
  1387. handleEdit({
  1388. ...this.base,
  1389. items: this.items,
  1390. saleTypeId: this.saleTypeId,
  1391. adminWebsitId: this.adminWebsitId,
  1392. serviceId: this.serviceId,
  1393. adminCompanyName: this.adminCompanyName,
  1394. serviceName: this.nickName
  1395. }).then((res) => {
  1396. this.$successMsg('成功')
  1397. this.$parent.cid = ''
  1398. this.$parent.show = 1
  1399. this.$parent.getList()
  1400. }).catch((err)=>{
  1401. for (let j = 0; j < this.items.length; j++) {
  1402. this.$set(this.items[j],'wallets',[])
  1403. }
  1404. })
  1405. },
  1406. handleReseat() {
  1407. this.base = {
  1408. adminCompanyId: '',
  1409. adminWebsitId: '',
  1410. billId: '',
  1411. examineNote: '',
  1412. examineResult: true,
  1413. examineStatus: '',
  1414. id: null,
  1415. serviceId: '',
  1416. serviceName: '',
  1417. remark: '',
  1418. saleTypeId: ''
  1419. }
  1420. this.saleTypeId = ''
  1421. this.items = []
  1422. },
  1423. // 导入
  1424. async handleImport(param) {
  1425. this.importLoading = true
  1426. const file = param.file
  1427. const formData = new FormData()
  1428. formData.append('file', file)
  1429. const result = await handleImport('/product-upd-price/material/import', formData)
  1430. this.importLoading = false
  1431. this.importFileList = []
  1432. if (result.code === 200) {
  1433. this.$alert(result.message, '导入成功', {
  1434. confirmButtonText: '确定'
  1435. })
  1436. for (let i = 0; i < result.data.length; i++) {
  1437. const linshi = []
  1438. const rebateList = []
  1439. const walletIds = []
  1440. const walletRebateIds = []
  1441. // result.data[i].id = result.data[i].materialId
  1442. result.data[i].isPublishArr = [
  1443. {
  1444. value: '是',
  1445. bool: true
  1446. },
  1447. {
  1448. value: '否',
  1449. bool: false
  1450. }
  1451. ]
  1452. result.data[i].isPromoteArr = [
  1453. {
  1454. value: '是',
  1455. bool: true
  1456. },
  1457. {
  1458. value: '否',
  1459. bool: false
  1460. }
  1461. ]
  1462. result.data[i].wallets = []
  1463. result.data[i].walletsId = []
  1464. result.data[i].walletRebateId = []
  1465. result.data[i].rebateWallets = []
  1466. result.data[i].saleTypes = this.typeList
  1467. result.data[i].mainId = result.data[i].saleTypeId
  1468. for (let p = 0; p < result.data[i].wallets2.length; p++) {
  1469. if (result.data[i].wallets2[p].type === 'COMMONLY') {
  1470. walletIds.push(result.data[i].wallets2[p].walletId)
  1471. this.$set(result.data[i], 'wallets', [
  1472. ...result.data[i].wallets,
  1473. {
  1474. type: 'COMMONLY',
  1475. id: '',
  1476. updPriceBillId: result.data[i].updPriceBillId,
  1477. updPriceBillItemId: result.data[i].updPriceBillId,
  1478. walletId: result.data[i].wallets2[p].walletId
  1479. }
  1480. ])
  1481. } else if (result.data[i].wallets2[p].type === 'REBATE') {
  1482. walletRebateIds.push(result.data[i].wallets2[p].walletId)
  1483. this.$set(result.data[i], 'wallets', [
  1484. ...result.data[i].wallets,
  1485. {
  1486. type: 'REBATE',
  1487. id: '',
  1488. updPriceBillId: result.data[i].updPriceBillId,
  1489. updPriceBillItemId: result.data[i].updPriceBillId,
  1490. walletId: result.data[i].wallets2[p].walletId
  1491. }
  1492. ])
  1493. }
  1494. }
  1495. this.rebateList.forEach((k) => {
  1496. k.saleTypes.forEach((j) => {
  1497. if (
  1498. !linshi.includes(j.saleTypeId) &&
  1499. j.saleTypeId === result.data[i].saleTypeId
  1500. ) {
  1501. for (let w = 0; w < walletRebateIds.length; w++) {
  1502. if (walletRebateIds[w] !== k.walletRebateId) {
  1503. // walletRebateIds.splice(w, 1)
  1504. }
  1505. }
  1506. rebateList.push(k)
  1507. }
  1508. })
  1509. })
  1510. this.$set(result.data[i], 'walletsId', walletIds)
  1511. this.$set(result.data[i], 'walletRebateId', walletRebateIds)
  1512. result.data[i].walleList = this.walleList
  1513. result.data[i].rebateList = rebateList
  1514. result.data[i].fang = false
  1515. }
  1516. // if (this.dataList.length) {
  1517. // for (let j = 0; j < result.data.length; j++) {
  1518. // for (let k = 0; k < this.dataList.length; k++) {
  1519. // if (result.data[j].materialId === this.dataList[k].id) {
  1520. // this.dataList[k].disabled = true
  1521. // }
  1522. // }
  1523. // }
  1524. // }
  1525. // this.items = [...this.items,...result.data]
  1526. // let newArr = [];
  1527. // let obj = {};
  1528. // for (var i = 0; i < this.items.length; i++) {
  1529. // if (!obj[this.items[i].materialId]) {
  1530. // newArr.push(this.items[i])
  1531. // obj[this.items[i].materialId] = true
  1532. // }
  1533. // }
  1534. // console.log(newArr,454 ,obj)
  1535. this.items = [...this.items,...result.data]
  1536. // console.log(resArrs(result.data,this.dataList),'55555')
  1537. } else {
  1538. this.$alert(result.message, '导入失败', {
  1539. confirmButtonText: '确定'
  1540. })
  1541. }
  1542. },
  1543. // 下载经销商模板
  1544. hanleDownloadFiles() {
  1545. downloadFiles('/product-upd-price/download')
  1546. },
  1547. filterWallets(array){
  1548. for (let i = 0; i < array.length; i++) {
  1549. const wallets = []
  1550. if (array[i].walletsId.length){
  1551. for (let j = 0; j < array[i].walleList.length; j++) {
  1552. for (let k = 0; k < array[i].walletsId.length; k++) {
  1553. if (array[i].walleList[j].id === array[i].walletsId[k]) {
  1554. wallets.push({
  1555. type: 'COMMONLY',
  1556. id: '',
  1557. updPriceBillId: array[i].cid || array[i].updPriceBillId,
  1558. updPriceBillItemId: array[i].cid || array[i].updPriceBillId,
  1559. walletId: array[i].walletsId[k]
  1560. })
  1561. }
  1562. }
  1563. }
  1564. array[i].wallets = wallets
  1565. }
  1566. if(array[i].walletRebateId.length){
  1567. for (let k = 0; k < array[i].rebateList.length; k++) {
  1568. if (!array[i].walletRebateId.length) return
  1569. for (let j = 0; j < array[i].walletRebateId.length; j++) {
  1570. if (array[i].rebateList[k].walletRebateId === array[i].walletRebateId[j]) {
  1571. wallets.push({
  1572. type: 'REBATE',
  1573. id: '',
  1574. updPriceBillId: array[i].cid || array[i].updPriceBillId,
  1575. updPriceBillItemId: array[i].cid || array[i].updPriceBillId,
  1576. walletId: array[i].walletRebateId[j]
  1577. })
  1578. }
  1579. }
  1580. array[i].wallets = wallets
  1581. }
  1582. }
  1583. }
  1584. return array
  1585. }
  1586. }
  1587. }
  1588. </script>
  1589. <style lang="scss" scoped>
  1590. ::v-deep .el-date-editor--date {
  1591. width: 100%;
  1592. }
  1593. .dia .el-select--normal {
  1594. width: 100%;
  1595. }
  1596. .clearfixs{
  1597. display: flex;
  1598. }
  1599. .import-btn{
  1600. margin-right: 10px;
  1601. }
  1602. </style>