index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. <template>
  2. <div class="app-container personnelMr-table" :style="{'--q-height':qHeight}">
  3. <div class="app-container-query" ref="queryFormBox">
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
  5. <el-form-item label="分销商名称" label-width="90px">
  6. <el-input
  7. v-model="queryParams.name"
  8. placeholder="请输入分销商名称"
  9. clearable
  10. style="width: 240px;"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="分销商类型">
  15. <el-select
  16. v-model="queryParams.type"
  17. placeholder="分销商类型"
  18. clearable
  19. style="width: 140px"
  20. >
  21. <el-option
  22. v-for="dict in dict.type.distribution_type"
  23. :key="dict.value"
  24. :label="dict.label"
  25. :value="dict.value"
  26. />
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="分销商标签">
  30. <el-select
  31. v-model="queryParams.personsType"
  32. placeholder="分销商标签"
  33. clearable
  34. style="width: 140px"
  35. >
  36. <el-option
  37. v-for="dict in dict.type.persons_type"
  38. :key="dict.value"
  39. :label="dict.label"
  40. :value="dict.value"
  41. />
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="入驻银联主体名称" label-width="150px">
  45. <el-input
  46. v-model="queryParams.unionName"
  47. placeholder="请输入入驻银联主体名称"
  48. clearable
  49. style="width: 240px;"
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  55. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  56. </el-form-item>
  57. </el-form>
  58. </div>
  59. <div class="app-container-table-box">
  60. <el-row :gutter="10" class="mb8">
  61. <el-col :span="1.5">
  62. <el-button
  63. type="primary"
  64. plain
  65. icon="el-icon-plus"
  66. size="mini"
  67. @click="handleAdd"
  68. v-hasPermi="['personnelMr:personnelMr:add']"
  69. >新增</el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="success"
  74. plain
  75. icon="el-icon-setting"
  76. size="mini"
  77. @click="openSet"
  78. v-hasPermi="['personnelMr:personnelMr:set']"
  79. >提现设置</el-button>
  80. </el-col>
  81. <el-col :span="1.5">
  82. <el-button
  83. type="warning"
  84. plain
  85. icon="el-icon-s-tools"
  86. size="mini"
  87. @click="codeSet"
  88. v-hasPermi="['personnelMr:personnelMr:codeSet']"
  89. >推广码海报设置</el-button>
  90. </el-col>
  91. <el-col :span="1.5">
  92. <el-button
  93. type="success"
  94. plain
  95. icon="el-icon-s-tools"
  96. size="mini"
  97. @click="linkSet"
  98. v-hasPermi="['personnelMr:personnelMr:linkSet']"
  99. >推广链接内容设置</el-button>
  100. </el-col>
  101. <el-col :span="1.5">
  102. <el-button
  103. type="danger"
  104. plain
  105. icon="el-icon-s-tools"
  106. size="mini"
  107. @click="openRetailRate"
  108. v-hasPermi="['personnelMr:personnelMr:RetailRate']"
  109. >批量设置佣金税率</el-button>
  110. <el-button
  111. type="primary"
  112. size="mini"
  113. icon="el-icon-download"
  114. v-hasPermi="['personnelMr:personnelMr:downloadExcel']"
  115. @click="handleExport"
  116. v-loading.fullscreen.lock="handleExportLoading"
  117. element-loading-text="正在拼命生成数据中..."
  118. element-loading-spinner="el-icon-loading"
  119. element-loading-background="rgba(0, 0, 0, 0.5)"
  120. >导出excel</el-button>
  121. </el-col>
  122. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  123. </el-row>
  124. <div class="app-container-table-info">
  125. <el-table ref="tables" v-loading="loading" height="100%" :data="dataList" @selection-change="handleSelectionChange" border>
  126. <el-table-column type="selection" width="55">
  127. </el-table-column>
  128. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  129. <el-table-column label="分销商名称" align="center" prop="name" />
  130. <el-table-column label="分销商类型" align="center" prop="type">
  131. <template slot-scope="scope">
  132. <dict-tag :options="dict.type.distribution_type" :value="scope.row.type"/>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="分销商标签" align="center" prop="type">
  136. <template slot-scope="scope">
  137. <dict-tag :options="dict.type.persons_type" :value="scope.row.personsType"/>
  138. </template>
  139. </el-table-column>
  140. <el-table-column label="入驻银联主体名称" align="center" prop="unionName" />
  141. <el-table-column label="佣金税率" align="center" prop="type">
  142. <template slot-scope="scope">
  143. <span>{{ scope.row.retailRate }}%</span>
  144. </template>
  145. </el-table-column>
  146. <!-- <el-table-column label="佣金税率" align="center" prop="retailRate" /> -->
  147. <el-table-column label="负责人" align="center" prop="contact" />
  148. <el-table-column label="账号/联系电话" align="center" prop="mobile" />
  149. <el-table-column label="被扫次数" align="center" prop="scanCounts" />
  150. <el-table-column label="佣金总额" align="center" prop="brokerageTotal">
  151. <template slot-scope="scope">
  152. <span v-if="scope.row.brokerageTotal || scope.row.brokerageTotal==0">¥{{ scope.row.brokerageTotal }}</span>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="待提现" align="center" prop="withdrawTotal">
  156. <template slot-scope="scope">
  157. <span v-if="scope.row.withdrawTotal || scope.row.withdrawTotal ==0">¥{{ scope.row.withdrawTotal }}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="是否可提现" align="center" prop="allowWithdraw">
  161. <template slot-scope="scope">
  162. <dict-tag :options="dict.type.user_allow_withdraw" :value="scope.row.allowWithdraw"/>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="账号状态" align="center">
  166. <template slot-scope="scope">
  167. <el-switch
  168. @change="ionlineApi(scope.row)"
  169. v-model="scope.row.switchValue"
  170. :active-value="1"
  171. active-color="#13ce66"
  172. inactive-color="#ff4949">
  173. </el-switch>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="推广码状态" align="center">
  177. <template slot-scope="scope">
  178. <el-switch
  179. @change="updateQrStatusFun(scope.row)"
  180. v-model="scope.row.qrcodeStatus"
  181. :active-value="1"
  182. active-color="#13ce66"
  183. inactive-color="#ff4949">
  184. </el-switch>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="销售人员" align="center" prop="salePerson" />
  188. <el-table-column label="添加时间" align="center" prop="createTime" width="160">
  189. <template slot-scope="scope">
  190. <span>{{ parseTime(scope.row.createTime) }}</span>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  194. <template slot-scope="scope">
  195. <el-button
  196. size="mini"
  197. type="text"
  198. @click="handleUpdate(scope.row)"
  199. v-hasPermi="['personnelMr:personnelMr:edit']"
  200. >修改</el-button>
  201. <el-button
  202. size="mini"
  203. type="text"
  204. @click="resettingApi(scope.row)"
  205. v-hasPermi="['personnelMr:personnelMr:resetting']"
  206. >重置密码</el-button>
  207. <el-button
  208. size="mini"
  209. type="text"
  210. @click="handleCode(scope.row, 'img')"
  211. v-hasPermi="['personnelMr:personnelMr:code']"
  212. >推广码</el-button>
  213. <el-button
  214. size="mini"
  215. type="text"
  216. @click="handleDelete(scope.row,scope.index)"
  217. v-hasPermi="['personnelMr:personnelMr:delete']"
  218. >删除</el-button>
  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. </div>
  230. </div>
  231. <!-- 新增/编辑弹框 -->
  232. <add-and-edit
  233. ref="addAndEdit"
  234. :dict="dict"
  235. @getList="getList"
  236. />
  237. <!-- 海报设置 -->
  238. <promotion-code ref="promotionCode"></promotion-code>
  239. <el-dialog
  240. title="推广码"
  241. :visible.sync="visibleStatus"
  242. width="400px"
  243. :destroy-on-close="true"
  244. :close-on-click-modal="false"
  245. >
  246. <div style="display: flex;justify-content: center;">
  247. <div style="width: 300px; height: 544px; background-size: cover;background-repeat: no-repeat;box-shadow: 0px 0px 20px 2px rgba(221,221,221,0.5);border-radius: 10px;">
  248. <div id="capture" style="width: 100%;height: 100%;position: relative;border-radius: 10px;">
  249. <img style="width: 100%;height: 100%;" :src="newObj.posterImg" alt="">
  250. <el-image
  251. style="width: 80px; height: 80px; position: absolute; bottom: 10px; right: 10px;"
  252. :src="newObj.url"
  253. fit="fill"
  254. />
  255. </div>
  256. </div>
  257. </div>
  258. <div slot="footer" class="dialog-footer">
  259. <el-button @click="visibleStatus = false">取 消</el-button>
  260. <el-button :loading="getShareImgBase64Loading" type="primary" @click="getShareImgBase64(newObj)">
  261. {{ getShareImgBase64Loading ? '下载中':'下 载' }}</el-button>
  262. </div>
  263. </el-dialog>
  264. <el-dialog
  265. title="提现设置"
  266. :visible.sync="setStatus"
  267. width="650px"
  268. :destroy-on-close="true"
  269. :close-on-click-modal="false"
  270. >
  271. <el-form :model="setForm" ref="setForm" :rules="setFormRules" label-width="120px">
  272. <el-form-item label="类型:" prop="type">
  273. <el-radio-group v-model="setForm.type">
  274. <el-radio label="1">按实值</el-radio>
  275. <el-radio label="2">按比例</el-radio>
  276. </el-radio-group>
  277. </el-form-item>
  278. <el-form-item label="提现手续费" prop="serviceCharge">
  279. <el-input
  280. type="number"
  281. v-model="setForm.serviceCharge"
  282. placeholder="请输入提现手续费"
  283. clearable
  284. @change="changePriceAmount('serviceCharge')"
  285. style="width: 260px;"
  286. >
  287. <template slot="append">{{ setForm.type == 2 ? '%' : '元' }}</template>
  288. </el-input>
  289. </el-form-item>
  290. <!-- <el-form-item label="提现门槛" prop="withdrawMinMoney">
  291. <div>
  292. <el-input
  293. type="number"
  294. v-model="setForm.withdrawMinMoney"
  295. placeholder="请输入提现门槛,最低0.3元"
  296. clearable
  297. @change="changePriceAmount('withdrawMinMoney')"
  298. style="width: 260px;"
  299. >
  300. </el-input>
  301. <span style="margin-left: 5px">元以上方可提现</span>
  302. </div>
  303. <span style="font-size: 14px;color: #777;">注: 最低提现为0.3元</span>
  304. </el-form-item> -->
  305. </el-form>
  306. <div slot="footer" class="dialog-footer">
  307. <el-button @click="setStatus = false">取消</el-button>
  308. <el-button
  309. type="primary"
  310. @click="submitForm"
  311. v-loading.fullscreen.lock="setLoading"
  312. element-loading-text="请等待..."
  313. element-loading-spinner="el-icon-loading"
  314. element-loading-background="rgba(0, 0, 0, 0.8)"
  315. >
  316. <span v-if="loading">提交中...</span>
  317. <span v-else>保存</span>
  318. </el-button>
  319. </div>
  320. </el-dialog>
  321. <el-dialog
  322. title="佣金税率设置"
  323. :visible.sync="showRetailRate"
  324. width="650px"
  325. :destroy-on-close="true"
  326. :close-on-click-modal="false"
  327. >
  328. <el-form :model="retailRateForm" ref="retailRateForm" :rules="retailRateFormRules" label-width="120px">
  329. <el-form-item label="佣金税率设置" prop="retailRate">
  330. <el-input
  331. type="number"
  332. v-model="retailRateForm.retailRate"
  333. placeholder="请输入佣金税率"
  334. clearable
  335. @change="retailRateChange"
  336. style="width: 260px;"
  337. >
  338. <template slot="append">%</template>
  339. </el-input>
  340. </el-form-item>
  341. </el-form>
  342. <div slot="footer" class="dialog-footer">
  343. <el-button @click="showRetailRate = false">取消</el-button>
  344. <el-button
  345. type="primary"
  346. @click="submitRetailRateForm"
  347. v-loading.fullscreen.lock="loading"
  348. element-loading-text="请等待..."
  349. element-loading-spinner="el-icon-loading"
  350. element-loading-background="rgba(0, 0, 0, 0.8)"
  351. >
  352. <span v-if="loading">提交中...</span>
  353. <span v-else>保存</span>
  354. </el-button>
  355. </div>
  356. </el-dialog>
  357. <!-- 推广链接内容设置 -->
  358. <linkSetVue ref="linkSetVue" @refresh="getList" />
  359. </div>
  360. </template>
  361. <script>
  362. import {
  363. pageList,
  364. deleteById,
  365. updateStatus,
  366. configUpdate,
  367. getSetInfo,
  368. getRetailQrcode ,
  369. batchUpdateRetailRate,
  370. downOrderListXls,
  371. updateQrStatusApi
  372. } from '@/api/distribution/personnelMr'
  373. import addAndEdit from "./dialog/addAndEdit.vue";
  374. import promotionCode from "./dialog/promotionCode.vue";
  375. import { exportExcel } from '@/utils/exportexcel'
  376. import html2canvas from 'html2canvas'
  377. import linkSetVue from './dialog/linkSet.vue';
  378. export default {
  379. name: "agreement",
  380. computed: {
  381. url() {
  382. return url
  383. }
  384. },
  385. dicts: ['distribution_type','user_allow_withdraw','persons_type'],
  386. components: { addAndEdit, promotionCode, linkSetVue },
  387. data() {
  388. let validateNumber = (rule, value, callback) => {
  389. let regNumber=/^(([1-9]\d*)|([0][.]{1}[0-9]{0,2}[1-9]+)|([1-9]\d*[.]{1}[0-9]+))$/g;
  390. if (value === '') {
  391. callback(new Error('请输入数值!!!'));
  392. }else if (!regNumber.test(value)) {
  393. callback(new Error('只能输入大于0.3的数值!!!'));
  394. } else if(value < 0.3){
  395. callback(new Error('只能输入大于0.3的数值!!!'));
  396. }else {
  397. callback();
  398. }
  399. };
  400. let validateNumber1 = (rule, value, callback) => {
  401. let regNumber=/^(([1-9]\d*)|([0][.]{1}[0-9]{0,2}[1-9]+)|([1-9]\d*[.]{1}[0-9]+))$/g;
  402. if (value === '') {
  403. callback(new Error('请输入数值!!!'));
  404. } else if (value == 0) {
  405. callback();
  406. } else if (!regNumber.test(value)) {
  407. callback(new Error('只能输入>=0的数值!!!'));
  408. }else {
  409. callback();
  410. }
  411. };
  412. return {
  413. qHeight: '0px',
  414. resizeObserver: null,
  415. // 遮罩层
  416. loading: true,
  417. // 选中数组
  418. ids: [],
  419. // 非单个禁用
  420. single: true,
  421. // 非多个禁用
  422. multiple: true,
  423. // 显示搜索条件
  424. showSearch: true,
  425. // 总条数
  426. total: 0,
  427. // 用户表格数据
  428. dataList: null,
  429. // 弹出层标题
  430. title: "",
  431. // 是否显示弹出层
  432. open: false,
  433. // 日期范围
  434. dateRange: [],
  435. // 查询参数
  436. queryParams: {
  437. pageNum: 1,
  438. pageSize: 10,
  439. type: undefined
  440. },
  441. statusList: [
  442. {id: 1, name: '未发布', value: 0},
  443. {id: 2, name: '发布', value: 1},
  444. {id: 3, name: '下架', value: 2},
  445. ],
  446. visibleStatus: false,
  447. newObj: {},
  448. visibleType: '',
  449. setStatus: false,
  450. setForm: {},
  451. setFormRules: {
  452. type: [
  453. { required: true, message: '请选择类型', trigger: ['change','blur'] },
  454. ],
  455. serviceCharge: [
  456. { required: true, message: '请输入提现手续费', trigger: ['change','blur'] },
  457. { validator: validateNumber1, trigger: ["blur","change"]},
  458. ],
  459. withdrawMinMoney: [
  460. { required: true, message: '请输入提现门槛,最低0.3元', trigger: ['change','blur'] },
  461. { validator: validateNumber, trigger: ["blur","change"]},
  462. ],
  463. },
  464. setRules: [],
  465. setLoading: false,
  466. getShareImgBase64Loading: false,
  467. showRetailRate: false,//税率设置弹窗
  468. retailRateForm: {ids:[],retailRate:undefined},
  469. retailRateFormRules: {
  470. retailRate: [
  471. { required: true, message: '请输入佣金税率', trigger: ['change','blur'] },
  472. ],
  473. },
  474. handleExportLoading: false,
  475. };
  476. },
  477. created() {
  478. this.getList();
  479. },
  480. mounted() {
  481. this.resizeObserver = new ResizeObserver(entries => {
  482. for (let entry of entries) {
  483. const { width, height } = entry.contentRect;
  484. this.qHeight = height + 'px'
  485. }
  486. });
  487. this.resizeObserver.observe(this.$refs.queryFormBox);
  488. },
  489. methods: {
  490. /** 查询列表 */
  491. getList() {
  492. this.dataList = []
  493. this.loading = true;
  494. pageList(this.queryParams)
  495. .then(response => {
  496. let list = response.data.rows
  497. list.forEach(item =>{
  498. item.switchValue = item.status;
  499. })
  500. this.dataList = list
  501. this.total = response.data.total;
  502. this.loading = false;
  503. }
  504. ).catch(()=>{
  505. this.dataList = []
  506. this.loading = false;
  507. })
  508. },
  509. // 取消按钮
  510. cancel() {
  511. this.open = false;
  512. },
  513. /** 搜索按钮操作 */
  514. handleQuery() {
  515. this.queryParams.pageNum = 1;
  516. this.getList();
  517. },
  518. /** 重置按钮操作 */
  519. resetQuery() {
  520. this.dateRange = [];
  521. this.$set(this.queryParams, 'name', '');
  522. this.$set(this.queryParams, 'type', '');
  523. this.$set(this.queryParams, 'personsType', '');
  524. this.$set(this.queryParams, 'unionName', '');
  525. this.queryParams.pageNum = 1;
  526. this.handleQuery();
  527. },
  528. /** 价格输入事件 */
  529. changePriceAmount(key) {
  530. if(this.setForm[key] * 1 < 0){
  531. this.$message.error("输入需大于或等于0!");
  532. this.$set(this.setForm, key, '');
  533. return false
  534. }
  535. },
  536. /** 新增按钮操作 */
  537. handleAdd() {
  538. this.$refs["addAndEdit"].openDialog("新增数据", null);
  539. },
  540. /** 提现设置按钮操作 */
  541. openSet() {
  542. this.setStatus = true
  543. this.getSetApi();
  544. },
  545. /** 佣金税率设置 */
  546. openRetailRate() {
  547. if(this.ids.length == 0){
  548. this.$message.warning("请选择分销商");
  549. return;
  550. }
  551. console.log('ids',this.ids)
  552. this.showRetailRate = true;
  553. },
  554. /** 海报设置按钮操作 */
  555. codeSet() {
  556. this.$refs["promotionCode"].openDialog("海报设置", null);
  557. },
  558. /** 海报设置按钮操作 */
  559. linkSet() {
  560. this.$refs["linkSetVue"].initData("推广链接内容设置", null);
  561. },
  562. /** 修改按钮操作 */
  563. handleUpdate(row) {
  564. this.$refs["addAndEdit"].openDialog("修改数据", row);
  565. },
  566. /** 获取提现设置 */
  567. getSetApi(row) {
  568. getSetInfo().then(response => {
  569. const obj = response.data;
  570. this.$nextTick(() => {
  571. this.$set(this.setForm, 'id', obj.id ? obj.id : '');
  572. this.$set(this.setForm, 'withdrawMinMoney', obj.withdrawMinMoney);
  573. this.$set(this.setForm, 'serviceCharge', obj.serviceCharge);
  574. this.$set(this.setForm, 'type', obj.type ? (obj.type + '') : '1');
  575. });
  576. });
  577. },
  578. /** 获取推广码 */
  579. getRetailQrcodeApi(row) {
  580. getRetailQrcode({personsId: row.id}).then(response => {
  581. if(response.code == 200) {
  582. const obj = response.data;
  583. this.newObj = obj;
  584. this.newObj.name = row.name;
  585. this.visibleStatus = true
  586. }
  587. });
  588. },
  589. /**
  590. * 分析提现
  591. * @date 2023-11-22
  592. * @returns {any}
  593. */
  594. submitForm() {
  595. this.$refs["setForm"].validate(async (valid) => {
  596. if (valid) {
  597. try {
  598. this.setLoading = true;
  599. const { code } = await configUpdate({ ...this.setForm });
  600. if (code === 200) {
  601. this.setLoading = false;
  602. this.$message.success("操作成功!");
  603. this.getList();
  604. this.setStatus = false;
  605. }
  606. } catch (error) {
  607. } finally {
  608. this.setLoading = false;
  609. }
  610. }
  611. });
  612. },
  613. /** 佣金税率输入事件 */
  614. retailRateChange(value) {
  615. // 检查输入值是否大于0
  616. if (value <= 0) {
  617. // 如果小于等于0,则将输入值置为0
  618. this.retailRateForm.retailRate = 0;
  619. } else {
  620. // 如果大于0,则保留输入值
  621. this.retailRateForm.retailRate = value;
  622. }
  623. },
  624. // 佣金税率设置
  625. submitRetailRateForm(){
  626. this.retailRateForm.ids = this.ids;
  627. this.$refs["retailRateForm"].validate(async (valid) => {
  628. if (valid) {
  629. try {
  630. this.loading = true;
  631. const { code } = await batchUpdateRetailRate({ ...this.retailRateForm });
  632. if (code === 200) {
  633. this.setLoading = false;
  634. this.$message.success("操作成功!");
  635. this.getList();
  636. this.retailRateForm={ids:[],retailRate:undefined};
  637. this.showRetailRate = false;
  638. }
  639. } catch (error) {
  640. } finally {
  641. this.loading = false;
  642. }
  643. }
  644. });
  645. },
  646. /** 禁用或者启用发布按钮操作 */
  647. ionlineApi(row) {
  648. this.$confirm("是否对分销商名称为" + row.name + "的数据进行" + (row.status == 1 ? '禁用?' : '启用?'), '提示', {
  649. confirmButtonText: '确定',
  650. cancelButtonText: '取消',
  651. type: 'warning'
  652. }).then(() => {
  653. updateStatus({ id: row.id, status: row.status == 1 ? 0 : 1 }).then((res) => {
  654. if (res.code == 200) {
  655. this.$message({
  656. type: 'success',
  657. message: '操作成功!'
  658. });
  659. this.getList();
  660. }
  661. });
  662. }).catch(() => {
  663. this.getList();
  664. });
  665. },
  666. /** 置顶或者取消置顶按钮操作 */
  667. resettingApi(row) {
  668. this.$confirm("是否对分销商名称为" + row.name + "的数据进行密码重置?重置后的密码为123456", '提示', {
  669. confirmButtonText: '确定',
  670. cancelButtonText: '取消',
  671. type: 'warning'
  672. }).then(() => {
  673. updateStatus({ id: row.id, password: '123456' }).then((res) => {
  674. if (res.code == 200) {
  675. this.$message({
  676. type: 'success',
  677. message: '操作成功!'
  678. });
  679. this.getList();
  680. }
  681. });
  682. }).catch(() => {});
  683. },
  684. /** 删除按钮操作 */
  685. handleDelete(row) {
  686. this.$modal.confirm('是否确认删除数据分销商名称为"' + row.name + '"的数据项?').then(function() {
  687. return deleteById(row.id);
  688. }).then(() => {
  689. this.getList();
  690. this.$modal.msgSuccess("删除成功");
  691. }).catch(() => {});
  692. },
  693. /** 推广码按钮操作 */
  694. handleCode(obj, type) {
  695. this.getRetailQrcodeApi(obj);
  696. },
  697. // 推广码下载
  698. codeDownload(row) {
  699. let name = this.newObj.name + '的推广码' || ''
  700. if(row){
  701. let a = document.createElement("a");
  702. a.href = row;
  703. if(name.indexOf(".") > -1){
  704. a.download = name;
  705. } else {
  706. a.download = name + ".jpg";
  707. }
  708. a.style.display = "none";
  709. document.body.appendChild(a);
  710. a.click();
  711. a.remove();
  712. }
  713. },
  714. // 推广码 base64
  715. getShareImgBase64() {
  716. return new Promise((resolve) => {
  717. this.getShareImgBase64Loading = true
  718. setTimeout(() => {
  719. // #capture 就是我们要获取截图对应的 DOM 元素选择器
  720. html2canvas(document.querySelector('#capture'), {
  721. useCORS: true, // 【重要】开启跨域配置
  722. scale: window.devicePixelRatio < 3 ? window.devicePixelRatio : 2,
  723. allowTaint: true, // 允许跨域图片
  724. }).then((canvas) => {
  725. const imgData = canvas.toDataURL('image/jpeg', 1.0);
  726. this.codeDownload(imgData);
  727. resolve(imgData);
  728. this.getShareImgBase64Loading = false
  729. }).catch(()=>{
  730. this.getShareImgBase64Loading = false
  731. })
  732. }, 300); // 这里加上 300ms 的延迟是为了让 DOM 元素完全渲染完成后再进行图片的生成
  733. });
  734. },
  735. // 多选框选中数据
  736. handleSelectionChange(selection) {
  737. this.ids = selection.map(item => item.id)
  738. this.single = selection.length!=1
  739. this.multiple = !selection.length
  740. },
  741. /**
  742. * 导出报表
  743. * @date 2022-10-24
  744. * @returns {any}
  745. */
  746. handleExport() {
  747. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  748. confirmButtonText: '确定 ',
  749. cancelButtonText: '取消 ',
  750. type: 'warning'
  751. })
  752. .then(() => {
  753. this.handleExportLoading = true;
  754. // const { pageNum, pageSize} = this.params;
  755. let postMap = {}
  756. let params = JSON.parse(JSON.stringify(this.queryParams))
  757. for (let key in params) {
  758. if(key != 'pageNum' && key != 'pageSize' && key != 'time' && key != 'createTime' && key != 'performDate' && key != 'invoiceTime'){
  759. postMap[key] = params[key]
  760. }
  761. }
  762. downOrderListXls(postMap)
  763. .then((res) => {
  764. exportExcel(res, '分销人员', '.xlsx');
  765. this.handleExportLoading = false;
  766. })
  767. .catch((error) => {
  768. console.log("error===",error)
  769. this.handleExportLoading = false;
  770. });
  771. })
  772. .catch(() => {
  773. this.$message.info('您已取消导出!');
  774. });
  775. },
  776. /** 推广码 */
  777. updateQrStatusFun(row) {
  778. this.$confirm("是否" + (!row.qrcodeStatus ? '禁用' : '启用') + row.name + '的推广码?' , '提示', {
  779. confirmButtonText: '确定',
  780. cancelButtonText: '取消',
  781. type: 'warning'
  782. }).then(() => {
  783. updateQrStatusApi({ id: row.id, qrcodeStatus: !row.qrcodeStatus ? 0 : 1 }).then((res) => {
  784. if (res.code == 200) {
  785. this.$message({
  786. type: 'success',
  787. message: '操作成功!'
  788. });
  789. this.getList();
  790. }
  791. });
  792. }).catch(() => { this.getList()});
  793. }
  794. },
  795. beforeDestroy() {
  796. this.resizeObserver.unobserve(this.$refs.queryFormBox);
  797. this.resizeObserver.disconnect();
  798. },
  799. };
  800. </script>
  801. <style lang="scss" scoped>
  802. .app-container {
  803. height: calc( 100vh - 110px );
  804. box-sizing: border-box;
  805. }
  806. .app-container-query {
  807. }
  808. .app-container-table-box {
  809. height: calc( 100% - var(--q-height) );
  810. .app-container-table-info {
  811. height: calc( 100% - 100px );
  812. }
  813. }
  814. </style>