setSampleCollection.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10" class="mb8">
  4. <el-col :span="1.5">
  5. <el-button
  6. type="primary"
  7. plain
  8. icon="el-icon-document-add"
  9. size="mini"
  10. @click="addNew"
  11. :loading="loadingAdd"
  12. >提交领样</el-button
  13. >
  14. </el-col>
  15. </el-row>
  16. <p>领样已提交数量:{{ sampleReceivedCount }}</p>
  17. <el-table
  18. v-loading="loading"
  19. :data="typeList"
  20. ref="multipleTable"
  21. @selection-change="handleSelectionChange"
  22. >
  23. <el-table-column type="selection" width="50" align="center" />
  24. <el-table-column label="商品名称" align="center" prop="itemId" width="300">
  25. <template slot-scope="scope">
  26. <div style="display: flex; width: 100%">
  27. <div style="width: 40%">
  28. <img :src="scope.row.itemImgUrl" alt="" style="width: 70px; height: auto" />
  29. </div>
  30. <div style="width: 60%" class="item-name-calss">
  31. <a
  32. style="
  33. text-overflow: ellipsis;
  34. white-space: nowrap;
  35. overflow: hidden;
  36. width: 100%;
  37. "
  38. :title="scope.row.itemTitle"
  39. >
  40. {{ scope.row.itemTitle }}
  41. </a>
  42. <p>商品Id: {{ scope.row.itemId }}</p>
  43. <p>商品单价: {{ scope.row.itemPrice / 100 }}元</p>
  44. <p>
  45. 佣金率:
  46. {{ scope.row.commissionRate ? scope.row.commissionRate / 10 + "%" : "-" }}
  47. </p>
  48. </div>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. label="达人名称"
  54. align="center"
  55. prop="promoterNickName"
  56. width="300"
  57. >
  58. <template slot-scope="scope">
  59. <div style="display: flex; width: 100%">
  60. <div style="width: 40%">
  61. <img
  62. :src="scope.row.promoterUrl"
  63. alt=""
  64. style="width: 70px; height: auto"
  65. />
  66. </div>
  67. <div style="width: 60%" class="item-name-calss">
  68. <a
  69. style="
  70. text-overflow: ellipsis;
  71. white-space: nowrap;
  72. overflow: hidden;
  73. width: 100%;
  74. "
  75. :title="scope.row.promoterNickName"
  76. >
  77. {{ scope.row.promoterNickName }}
  78. </a>
  79. <p>达人Id: {{ scope.row.promoterId }}</p>
  80. </div>
  81. </div>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="达人信息" align="center" prop="consignee" width="350px">
  85. <template slot-scope="scope">
  86. <div style="width: 100%" class="item-name-calss">
  87. <p style="margin-bottom: 5px">
  88. 收货人:
  89. <span v-if="!scope.row.consigneeEdit">{{ scope.row.consignee }}</span>
  90. <el-input
  91. v-else
  92. v-model="scope.row.consignee"
  93. placeholder="请输入内容"
  94. style="width: 200px"
  95. ></el-input>
  96. <a
  97. :class="!scope.row.consigneeEdit ? 'el-icon-edit' : 'el-icon-check'"
  98. @click="scope.row.consigneeEdit = !scope.row.consigneeEdit"
  99. style="color: deepskyblue; margin-left: 10px; display: inline"
  100. ></a>
  101. </p>
  102. <p style="margin-bottom: 5px">
  103. 手机号:
  104. <span v-if="!scope.row.promoterPhoneEdit">{{
  105. scope.row.promoterPhone
  106. }}</span>
  107. <el-input
  108. v-else
  109. v-model.number="scope.row.promoterPhone"
  110. placeholder="请输入内容"
  111. style="width: 200px"
  112. ></el-input>
  113. <a
  114. :class="!scope.row.promoterPhoneEdit ? 'el-icon-edit' : 'el-icon-check'"
  115. @click="scope.row.promoterPhoneEdit = !scope.row.promoterPhoneEdit"
  116. style="color: deepskyblue; margin-left: 10px; display: inline"
  117. ></a>
  118. </p>
  119. <p style="margin-bottom: 5px">
  120. 地址:
  121. <span v-if="!scope.row.promoterAddressEdit">{{
  122. scope.row.promoterAddress
  123. }}</span>
  124. <el-input
  125. v-else
  126. v-model="scope.row.promoterAddress"
  127. placeholder="请输入内容"
  128. style="width: 200px"
  129. ></el-input>
  130. <a
  131. :class="!scope.row.promoterAddressEdit ? 'el-icon-edit' : 'el-icon-check'"
  132. @click="scope.row.promoterAddressEdit = !scope.row.promoterAddressEdit"
  133. style="color: deepskyblue; margin-left: 10px; display: inline"
  134. ></a>
  135. </p>
  136. </div>
  137. </template>
  138. </el-table-column>
  139. <!-- <el-table-column label="收货人" align="center" prop="consignee" width="150px">
  140. <template slot-scope="scope">
  141. <div>
  142. <el-input v-model="scope.row.consignee" placeholder="请输入收货人"></el-input>
  143. </div>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. label="达人手机号"
  148. align="center"
  149. prop="promoterPhone"
  150. width="150px"
  151. >
  152. <template slot-scope="scope">
  153. <div>
  154. <el-input
  155. v-model="scope.row.promoterPhone"
  156. placeholder="请输入达人手机号"
  157. ></el-input>
  158. </div>
  159. </template>
  160. </el-table-column>
  161. <el-table-column
  162. label="达人地址"
  163. align="center"
  164. prop="promoterAddress"
  165. width="200px"
  166. >
  167. <template slot-scope="scope">
  168. <div>
  169. <el-input
  170. v-model="scope.row.promoterAddress"
  171. placeholder="请输入达人地址"
  172. ></el-input>
  173. </div>
  174. </template>
  175. </el-table-column> -->
  176. <el-table-column label="领样数量" align="center" prop="sampleCount" width="250px">
  177. <template slot-scope="scope">
  178. <div>
  179. <el-input v-model.number="scope.row.sampleCount"></el-input>
  180. </div>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. label="领样备注"
  185. align="center"
  186. prop="sampleRequirement"
  187. width="250px"
  188. >
  189. <template slot-scope="scope">
  190. <div>
  191. <el-input
  192. v-model="scope.row.sampleRequirement"
  193. placeholder="请输入领样备注"
  194. ></el-input>
  195. </div>
  196. </template>
  197. </el-table-column>
  198. <el-table-column
  199. label="操作"
  200. align="center"
  201. class-name="small-padding fixed-width"
  202. width="150px"
  203. fixed="right"
  204. >
  205. <template slot-scope="scope">
  206. <el-button size="mini" type="text" @click="copyInfomation(scope.row)"
  207. >一键同步</el-button
  208. >
  209. <el-button
  210. size="mini"
  211. type="text"
  212. @click="
  213. workVisible = true;
  214. noticeContent = '';
  215. ids = `${scope.row.itemId + '-' + scope.row.promoterId}`;
  216. "
  217. >上传凭证</el-button
  218. >
  219. </template>
  220. </el-table-column>
  221. </el-table>
  222. <pagination
  223. v-show="total > 0"
  224. :total="total"
  225. :page.sync="queryParams.pageNum"
  226. :limit.sync="queryParams.pageSize"
  227. @pagination="getList"
  228. />
  229. <!-- 添加直播 -->
  230. <el-dialog
  231. :title="!!ids ? '修改商品' : '新增商品'"
  232. :visible.sync="openAllocation"
  233. width="800px"
  234. append-to-body
  235. :close-on-click-modal="false"
  236. >
  237. <el-form
  238. ref="formBroadcast"
  239. :model="formBroadcast"
  240. :rules="rulesBroadcast"
  241. label-width="100px"
  242. :inline="true"
  243. >
  244. <el-form-item label="创建人" prop="userName" style="width: 100%">
  245. {{ $store.getters.name }}
  246. </el-form-item>
  247. <el-form-item label="活动ID" prop="activityId">
  248. <el-input
  249. placeholder="请输入活动ID"
  250. style="width: 240px"
  251. v-model="formBroadcast.activityId"
  252. :disabled="edit"
  253. >
  254. </el-input>
  255. </el-form-item>
  256. <el-form-item label="商品ID" prop="itemId">
  257. <el-input
  258. placeholder="请输入商品ID"
  259. style="width: 240px"
  260. v-model="formBroadcast.itemId"
  261. :disabled="edit"
  262. >
  263. </el-input>
  264. </el-form-item>
  265. <el-form-item label="发货地" prop="postArea">
  266. <selectTree
  267. :disabled="edit"
  268. style="width: 240px"
  269. v-model="formBroadcast.postArea"
  270. filterable
  271. :data="superiorList"
  272. :props="{
  273. value: 'id',
  274. label: 'name',
  275. }"
  276. />
  277. </el-form-item>
  278. <el-form-item label="不发货地区" prop="noPostArea">
  279. <selectTree
  280. style="width: 240px"
  281. v-model="formBroadcast.noPostArea"
  282. filterable
  283. :multiple="true"
  284. :data="superiorList"
  285. :props="{
  286. value: 'id',
  287. label: 'name',
  288. }"
  289. />
  290. </el-form-item>
  291. <el-form-item label="佣金比例" prop="commissionRate">
  292. <el-input
  293. placeholder="请输入佣金比例"
  294. style="width: 240px"
  295. v-model="formBroadcast.commissionRate"
  296. >
  297. </el-input>
  298. </el-form-item>
  299. <el-form-item label="服务费" prop="regimentalPromotion">
  300. <el-input
  301. placeholder="请输入服务费"
  302. style="width: 240px"
  303. v-model="formBroadcast.regimentalPromotion"
  304. >
  305. </el-input>
  306. </el-form-item>
  307. <el-form-item label="服务费率" prop="regimentalPromotionRate">
  308. <el-input
  309. placeholder="请输入服务费率"
  310. style="width: 240px"
  311. v-model="formBroadcast.regimentalPromotionRate"
  312. >
  313. </el-input>
  314. </el-form-item>
  315. <el-form-item label="领样要求" prop="sampleRequirement">
  316. <el-input
  317. placeholder="请输入领样要求"
  318. style="width: 240px"
  319. v-model="formBroadcast.sampleRequirement"
  320. >
  321. </el-input>
  322. </el-form-item>
  323. <el-form-item label="样品数量" prop="sampleCount">
  324. <el-input
  325. placeholder="请输入样品数量"
  326. style="width: 240px"
  327. v-model="formBroadcast.sampleCount"
  328. >
  329. </el-input>
  330. </el-form-item>
  331. <el-form-item label="商品链接" prop="detailUrl">
  332. <el-input
  333. placeholder="请输入商品链接"
  334. style="width: 240px"
  335. v-model="formBroadcast.detailUrl"
  336. >
  337. </el-input>
  338. </el-form-item>
  339. <el-form-item label="发货率" prop="deliveryRate">
  340. <el-input
  341. placeholder="请输入发货率"
  342. style="width: 240px"
  343. v-model="formBroadcast.deliveryRate"
  344. >
  345. </el-input>
  346. </el-form-item>
  347. <el-form-item
  348. label="手卡内容"
  349. prop="partnerRecommendText"
  350. style="width: 100%"
  351. class="entire-line"
  352. >
  353. <el-input
  354. placeholder="请输入手卡内容"
  355. style="width: 100%"
  356. type="textarea"
  357. :rows="2"
  358. v-model="formBroadcast.partnerRecommendText"
  359. >
  360. </el-input>
  361. </el-form-item>
  362. </el-form>
  363. <div slot="footer" class="dialog-footer">
  364. <el-button type="primary" @click="submitFormBroadcast" :loading="confirmLoading"
  365. >确 定</el-button
  366. >
  367. <el-button
  368. @click="
  369. confirmLoading = false;
  370. openAllocation = false;
  371. formBroadcast = {};
  372. "
  373. >取 消</el-button
  374. >
  375. </div>
  376. </el-dialog>
  377. <!-- 审核拒绝 -->
  378. <el-dialog
  379. title="拒绝原因"
  380. :visible.sync="refuseVisible"
  381. width="500px"
  382. :close-on-click-modal="false"
  383. append-to-body
  384. >
  385. <el-input
  386. placeholder="请输入拒绝原因"
  387. style="width: 100%"
  388. type="textarea"
  389. :rows="2"
  390. v-model="refuseInfo"
  391. >
  392. </el-input>
  393. <div slot="footer" class="dialog-footer">
  394. <el-button type="primary" @click="submitRefuse" :loading="refuseLoading"
  395. >确 定</el-button
  396. >
  397. <el-button
  398. @click="
  399. refuseLoading = false;
  400. refuseVisible = false;
  401. refuseInfo = null;
  402. "
  403. >取 消</el-button
  404. >
  405. </div>
  406. </el-dialog>
  407. <!-- 上传作业 -->
  408. <el-dialog
  409. title="上传"
  410. :visible.sync="workVisible"
  411. width="500px"
  412. append-to-body
  413. :close-on-click-modal="false"
  414. >
  415. <!-- <uploadEditor
  416. v-model="noticeContent"
  417. style="min-height: 100px"
  418. v-if="workVisible"
  419. /> -->
  420. <uploadCvImageVue ref="fileUpload" :multiple="false" />
  421. <div slot="footer" class="dialog-footer">
  422. <el-button type="primary" @click="workUpload" :loading="workLoading"
  423. >确 定</el-button
  424. >
  425. <el-button
  426. @click="
  427. workLoading = false;
  428. workVisible = false;
  429. noticeContent = '';
  430. "
  431. >取 消</el-button
  432. >
  433. </div>
  434. </el-dialog>
  435. </div>
  436. </template>
  437. <script>
  438. import { refreshCache } from "@/api/system/dict/type";
  439. import {
  440. getItemList,
  441. getAreaList,
  442. getCity,
  443. checkItem,
  444. editItem,
  445. preview,
  446. addPreview,
  447. } from "@/api/goodsManagement/goods";
  448. import selectTree from "./selectTree.vue";
  449. import uploadEditor from "./uploadEditor.vue";
  450. import uploadCvImageVue from "./uploadCvImage.vue";
  451. export default {
  452. name: "account-list",
  453. components: {
  454. uploadEditor,
  455. selectTree,
  456. uploadCvImageVue,
  457. },
  458. data() {
  459. const equalToPassword = (rule, value, callback) => {
  460. if (!!value && !this.edit) {
  461. checkItem({ itemId: value }).then((res) => {
  462. if (res.message == "true") {
  463. callback();
  464. } else {
  465. callback(new Error(res.message));
  466. }
  467. });
  468. } else {
  469. callback();
  470. }
  471. };
  472. return {
  473. api: "",
  474. limit: 2,
  475. fileList: [],
  476. dialogImageUrl: "",
  477. dialogVisible: false,
  478. workVisible: false,
  479. workLoading: false,
  480. noticeContent: undefined,
  481. // 遮罩层
  482. loading: true,
  483. loadingAdd: false,
  484. // 选中数组
  485. ids: null,
  486. okIds: null,
  487. // 非单个禁用
  488. single: true,
  489. // 非多个禁用
  490. multiple: true,
  491. // 显示搜索条件
  492. showSearch: true,
  493. // 总条数
  494. total: 0,
  495. // 字典表格数据
  496. typeList: [],
  497. sampleReceivedCount: 0,
  498. //上传文件类型
  499. fileType: [".doc", ".xls", ".xlsx", ".ppt", ".pdf", ".csv"],
  500. // 弹出层标题
  501. title: "",
  502. // 是否显示弹出层
  503. open: false,
  504. openFp: false,
  505. formFp: {},
  506. // 是否可编辑
  507. edit: false,
  508. // 分配销售
  509. openAllocation: false,
  510. // 选择的销售id
  511. saleId: undefined,
  512. // 销售列表
  513. saleList: [],
  514. // 分配销售确定loading
  515. confirmLoadingSale: false,
  516. // 日期范围
  517. dateRange: [],
  518. superiorList: [],
  519. // 查询参数
  520. queryParams: {
  521. pageNum: 1,
  522. pageSize: 10,
  523. itemTitle: undefined,
  524. itemId: undefined,
  525. examineStatus: "2",
  526. },
  527. //页面所有的下拉数据
  528. queryParamsList: {
  529. tagList: [
  530. { value: "2", label: "我的商品" },
  531. { value: "1", label: "待审核" },
  532. { value: "3", label: "审核拒绝" },
  533. ],
  534. },
  535. // 表单参数
  536. form: {},
  537. formBroadcast: {},
  538. //上传报表下拉数据
  539. formList: {},
  540. fileList: [],
  541. accept: "",
  542. //获取销售线索文件流
  543. dateFile: new FormData(),
  544. //销售线索上传loading
  545. confirmLoading: false,
  546. // 表单校验
  547. rules: {},
  548. rulesBroadcast: {
  549. itemId: [
  550. {
  551. required: true,
  552. message: "商品ID必填",
  553. trigger: "blur",
  554. },
  555. { required: true, validator: equalToPassword, trigger: "blur" },
  556. ],
  557. activityId: {
  558. required: true,
  559. message: "活动ID必填",
  560. trigger: "blur",
  561. },
  562. postArea: {
  563. required: true,
  564. message: "发货地必选",
  565. trigger: "change",
  566. },
  567. noPostArea: {
  568. required: true,
  569. message: "不发货地必选",
  570. trigger: "change",
  571. },
  572. commissionRate: {
  573. required: true,
  574. message: "佣金比例必填",
  575. trigger: "blur",
  576. },
  577. regimentalPromotion: {
  578. required: true,
  579. message: "服务费必填",
  580. trigger: "blur",
  581. },
  582. regimentalPromotionRate: {
  583. required: true,
  584. message: "服务费率必填",
  585. trigger: "blur",
  586. },
  587. sampleRequirement: {
  588. required: true,
  589. message: "领样要求必填",
  590. trigger: "blur",
  591. },
  592. sampleCount: {
  593. required: true,
  594. message: "样品数量必填",
  595. trigger: "blur",
  596. },
  597. partnerRecommendText: [
  598. {
  599. required: true,
  600. message: "手卡内容必填",
  601. trigger: "blur",
  602. },
  603. {
  604. min: 5,
  605. message: "手卡内容最少输入5个字符",
  606. trigger: "change",
  607. },
  608. ],
  609. },
  610. // 分配销售展示列表
  611. ksInfo: null,
  612. userId: null,
  613. refuseVisible: false,
  614. refuseLoading: false,
  615. refuseInfo: null,
  616. itemId: null,
  617. };
  618. },
  619. created() {
  620. this.userId = this.$store.getters.userId;
  621. this.getList();
  622. },
  623. filters: {
  624. activityItemStatusName(status) {
  625. const statusMap = {
  626. 1: "待审核",
  627. 2: "已上架",
  628. 3: "审核失败(拒绝)",
  629. 4: "活动结束",
  630. 5: "失效",
  631. };
  632. return statusMap[status];
  633. },
  634. },
  635. methods: {
  636. workUpload() {
  637. var index = this.typeList.findIndex((item) => {
  638. return this.ids == item.itemId + "-" + item.promoterId;
  639. });
  640. this.typeList[index].sampleVoucher = this.$refs.fileUpload.fileList[0].url
  641. // console.log(index);
  642. // console.log(this.$refs.fileUpload.fileList)
  643. // console.log(this.typeList)
  644. this.workVisible = false
  645. },
  646. handleSelectionChange(selection) {
  647. this.okIds = selection.map((item) => item.itemId + "-" + item.promoterId);
  648. },
  649. okInfomation(item) {
  650. this.$router.replace({
  651. path: "/goodsManagement/promoterSelect",
  652. query: {
  653. itemIds: item.itemId,
  654. },
  655. });
  656. },
  657. toDetail(item) {
  658. localStorage.setItem("addItemInfo", JSON.stringify({ ...item, type: "look" }));
  659. this.$router.replace({
  660. path: "/goodsManagement/goodsPreview",
  661. });
  662. },
  663. copyInfomation(item) {
  664. if (!!item.sampleRequirement && !!item.sampleCount) {
  665. this.typeList = [
  666. ...this.typeList.map((items) => {
  667. return {
  668. ...items,
  669. sampleRequirement: item.sampleRequirement,
  670. sampleCount: item.sampleCount,
  671. };
  672. }),
  673. ];
  674. } else {
  675. this.$message.error("请填写完成,方可同步");
  676. }
  677. },
  678. submitRefuse() {
  679. if (!!this.refuseInfo) {
  680. var params = {};
  681. params.itemId = this.itemId;
  682. params.examineStatus = 3;
  683. params.refuseDetail = this.refuseInfo;
  684. params.examineId = this.$store.getters.userId;
  685. params.examineName = this.$store.getters.name;
  686. editItem(params)
  687. .then((res) => {
  688. this.refuseVisible = false;
  689. this.refuseLoading = false;
  690. this.getList();
  691. this.$modal.msgSuccess("已拒绝");
  692. })
  693. .catch(() => {
  694. this.$message.error("失败");
  695. });
  696. } else {
  697. this.$message.error("请输入拒绝原因");
  698. }
  699. },
  700. getAreaList() {
  701. getAreaList().then((res) => {
  702. this.superiorList = res.map((item) => {
  703. return {
  704. id: item,
  705. name: item,
  706. disabled: true,
  707. };
  708. });
  709. });
  710. },
  711. loadNode(node, resolve) {
  712. if (node.level === 0) {
  713. return resolve([{ name: "region" }]);
  714. }
  715. if (node.level > 1) return resolve([]);
  716. console.log(node);
  717. getCity({ province: node.data.id }).then((res) => {
  718. const data = res.map((item) => {
  719. return {
  720. id: item,
  721. name: item,
  722. };
  723. });
  724. resolve(data);
  725. });
  726. // setTimeout(() => {
  727. // const data = [
  728. // {
  729. // name: "leaf",
  730. // leaf: true,
  731. // },
  732. // {
  733. // name: "zone",
  734. // },
  735. // ];
  736. // resolve(data);
  737. // }, 500);
  738. },
  739. handleNodeClick(val) {
  740. console.log(val);
  741. this.$set(this.formBroadcast, "postArea", val.id);
  742. this.$set(this.formBroadcast, "postAreaName", val.name);
  743. if (!val.children || val.children.length == 0) {
  744. this.$refs.selectReport.blur();
  745. }
  746. },
  747. /** 查询字典类型列表 */
  748. getList() {
  749. this.loading = true;
  750. preview({
  751. itemIds: this.$route.query.itemIds,
  752. ids: this.$route.query.promoterIds,
  753. userId: this.$store.getters.userId,
  754. }).then((response) => {
  755. this.$nextTick(() => {
  756. this.okIds = response.preview.samples.map((item) => {
  757. return item.itemId + "-" + item.promoterId;
  758. });
  759. this.typeList = response.preview.samples.map((item) => {
  760. return {
  761. ...item,
  762. sampleCount: null,
  763. sampleRequirement: null,
  764. consigneeEdit: false,
  765. promoterPhoneEdit: false,
  766. promoterAddressEdit: false,
  767. sampleVoucher:undefined,
  768. };
  769. });
  770. this.sampleReceivedCount = response.preview.sampleReceivedCount;
  771. this.$refs.multipleTable.toggleAllSelection();
  772. });
  773. // this.total = response.total;
  774. this.loading = false;
  775. });
  776. },
  777. // 取消按钮
  778. cancel() {
  779. this.open = false;
  780. this.confirmLoading = false;
  781. this.reset();
  782. },
  783. // 表单重置
  784. reset() {
  785. this.form = {};
  786. this.dateFile = null;
  787. this.resetForm("formBroadcast");
  788. },
  789. /** 搜索按钮操作 */
  790. handleQuery() {
  791. this.queryParams.pageNum = 1;
  792. this.getList();
  793. },
  794. /** 重置按钮操作 */
  795. resetQuery() {
  796. this.dateRange = [];
  797. this.resetForm("queryForm");
  798. this.handleQuery();
  799. },
  800. addNew() {
  801. console.log(this.okIds);
  802. if (this.okIds.length > 0) {
  803. var dataArr = [];
  804. for (let i = 0; i < this.okIds.length; i++) {
  805. for (let c = 0; c < this.typeList.length; c++) {
  806. if (
  807. this.okIds[i] ==
  808. this.typeList[c].itemId + "-" + this.typeList[c].promoterId
  809. ) {
  810. dataArr.push(this.typeList[c]);
  811. }
  812. }
  813. }
  814. var dataFind = dataArr.findIndex((v) => {
  815. return !v.sampleRequirement || !v.sampleCount;
  816. });
  817. if (dataFind > -1) {
  818. this.$message.error("请填写提交的领样");
  819. } else {
  820. this.loadingAdd = true;
  821. // console.log(dataArr);
  822. addPreview({ temCollectSamples: JSON.stringify(dataArr) }).then((res) => {
  823. this.loadingAdd = false;
  824. const obj = {
  825. path: "/goodsManagement/samplingList",
  826. };
  827. this.$tab.closeOpenPage(obj);
  828. this.$message.success("提交成功");
  829. localStorage.setItem("clearData", 1);
  830. });
  831. }
  832. } else {
  833. this.$message.error("请选择提交的领样");
  834. }
  835. // this.getAreaList();
  836. // this.openAllocation = true;
  837. // this.edit = false;
  838. // this.ids = null;
  839. // this.confirmLoading = false;
  840. // this.formBroadcast = {};
  841. // setTimeout(() => {
  842. // this.$refs.formBroadcast.clearValidate();
  843. // }, 0);
  844. },
  845. /** 修改按钮操作 */
  846. handleUpdate(row) {
  847. this.reset();
  848. },
  849. /** 新增直播确定按钮 */
  850. submitFormBroadcast: function () {
  851. this.$refs["formBroadcast"].validate((valid) => {
  852. if (valid) {
  853. if (!this.edit) {
  854. localStorage.setItem("addItemInfo", JSON.stringify(this.formBroadcast));
  855. this.$router.replace({
  856. path: "/goodsManagement/goodsPreview",
  857. });
  858. } else {
  859. this.confirmLoading = true;
  860. var params = { ...this.formBroadcast };
  861. params.examineStatus = 1;
  862. editItem(params)
  863. .then((res) => {
  864. this.confirmLoading = false;
  865. this.openAllocation = false;
  866. this.formBroadcast = {};
  867. this.getList();
  868. this.$modal.msgSuccess("修改成功");
  869. })
  870. .catch(() => {
  871. this.confirmLoading = false;
  872. this.$message.error("失败");
  873. });
  874. }
  875. }
  876. });
  877. },
  878. /** 提交按钮 */
  879. submitForm: function () {
  880. this.$refs["form"].validate((valid) => {
  881. if (valid) {
  882. var fileList = this.$refs.fileUploadDialog.fileList;
  883. var dapanUrls = this.$refs.fileUpload.fileList;
  884. var portraitUrls = this.$refs.fileUploadFx.fileList;
  885. if (fileList.length == 0 && dapanUrls.length == 0 && portraitUrls.length == 0) {
  886. this.$message.error("直播数据,数据大盘,画像分析必须最少上传一项");
  887. return;
  888. } else {
  889. this.confirmLoading = true;
  890. let formData = new FormData();
  891. this.ids;
  892. formData.append("id", this.ids);
  893. formData.append("actualGmv", this.delcommafy(this.form.actualGmv));
  894. formData.append(
  895. "dapanUrls",
  896. JSON.stringify(
  897. dapanUrls.map((item) => {
  898. return item.url;
  899. })
  900. )
  901. );
  902. formData.append(
  903. "portraitUrls",
  904. JSON.stringify(
  905. portraitUrls.map((item) => {
  906. return item.url;
  907. })
  908. )
  909. );
  910. fileList.forEach((file) => formData.append("files", file.raw));
  911. dataUpload(formData)
  912. .then((res) => {
  913. this.confirmLoading = false;
  914. this.$message.success("上传成功");
  915. this.open = false;
  916. this.ids = null;
  917. this.cancel();
  918. this.handleQuery();
  919. })
  920. .catch((err) => {
  921. this.confirmLoading = false;
  922. });
  923. }
  924. console.log(fileList, dapanUrls, portraitUrls);
  925. }
  926. });
  927. },
  928. },
  929. };
  930. </script>
  931. <style lang="scss" scoped>
  932. .entire-line {
  933. width: 100%;
  934. ::v-deep .el-form-item__content {
  935. width: 60%;
  936. }
  937. }
  938. ::v-deep .el-form-item__label {
  939. white-space: nowrap;
  940. }
  941. </style>
  942. <style scoped lang="scss">
  943. ::v-deep a {
  944. color: #409eff;
  945. display: block;
  946. text-align: left;
  947. }
  948. .item-name-calss p {
  949. margin: 0;
  950. text-align: left;
  951. }
  952. .tableBox {
  953. width: 100%;
  954. }
  955. ::v-deep .el-tabs__content {
  956. overflow: initial;
  957. }
  958. </style>