index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="商品名称" prop="goodsName">
  5. <el-input
  6. v-model="queryParams.goodsName"
  7. placeholder="请输入商品名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="商品分类" prop="goodsType">
  14. <el-select v-model="queryParams.goodsType" placeholder="请选择商品分类" clearable size="small">
  15. <el-option
  16. v-for="dict in goodsTypeOptions"
  17. :key="dict.dictValue"
  18. :label="dict.dictLabel"
  19. :value="dict.dictValue"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="状态" prop="status">
  24. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  25. <el-option
  26. v-for="dict in statusOptions"
  27. :key="dict.dictValue"
  28. :label="dict.dictLabel"
  29. :value="dict.dictValue"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="所属小程序" prop="appId">
  34. <el-select style="width: 240px" v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
  35. <el-option
  36. v-for="dict in appMallOptions"
  37. :key="dict.appid"
  38. :label="dict.name + '(' + dict.appid + ')'"
  39. :value="dict.appid"
  40. />
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  45. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  46. </el-form-item>
  47. </el-form>
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button
  51. type="primary"
  52. plain
  53. icon="el-icon-plus"
  54. size="mini"
  55. @click="handleAdd"
  56. v-hasPermi="['his:integralGoods:add']"
  57. >新增</el-button>
  58. </el-col>
  59. <el-col :span="1.5">
  60. <el-button
  61. type="success"
  62. plain
  63. icon="el-icon-edit"
  64. size="mini"
  65. :disabled="single"
  66. @click="handleUpdate"
  67. v-hasPermi="['his:integralGoods:edit']"
  68. >修改</el-button>
  69. </el-col>
  70. <el-col :span="1.5">
  71. <el-button
  72. type="danger"
  73. plain
  74. icon="el-icon-delete"
  75. size="mini"
  76. :disabled="multiple"
  77. @click="handleDelete"
  78. v-hasPermi="['his:integralGoods:remove']"
  79. >删除</el-button>
  80. </el-col>
  81. <el-col :span="1.5">
  82. <el-button
  83. type="warning"
  84. plain
  85. icon="el-icon-download"
  86. size="mini"
  87. :loading="exportLoading"
  88. @click="handleExport"
  89. v-hasPermi="['his:integralGoods:export']"
  90. >导出</el-button>
  91. </el-col>
  92. <el-col :span="1.5">
  93. <el-button
  94. type="info"
  95. plain
  96. icon="el-icon-upload2"
  97. size="mini"
  98. @click="handleImport"
  99. v-hasPermi="['his:integralGoods:handleImport']"
  100. >导入</el-button>
  101. </el-col>
  102. <el-col :span="1.5">
  103. <el-button
  104. type="primary"
  105. plain
  106. icon="el-icon-edit-outline"
  107. size="mini"
  108. :disabled="multiple"
  109. @click="handleBatchUpdate"
  110. v-hasPermi="['his:integralGoods:edit']"
  111. >批量修改积分和金额</el-button>
  112. </el-col>
  113. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  114. </el-row>
  115. <el-table v-loading="loading" border :data="integralGoodsList" @selection-change="handleSelectionChange">
  116. <el-table-column type="selection" width="55" align="center" />
  117. <el-table-column label="编号" align="center" prop="goodsId" />
  118. <el-table-column label="封面图" align="center" prop="imgUrl" >
  119. <template slot-scope="scope">
  120. <el-popover
  121. placement="right"
  122. title=""
  123. trigger="hover"
  124. >
  125. <img slot="reference" :src="scope.row.imgUrl" width="100">
  126. <img :src="scope.row.imgUrl" style="max-width: 150px;">
  127. </el-popover>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="商品名称" align="center" prop="goodsName" />
  131. <el-table-column label="原价" align="center" prop="otPrice" />
  132. <el-table-column label="商品分类" align="center" prop="goodsType">
  133. <template slot-scope="scope">
  134. <dict-tag :options="goodsTypeOptions" :value="scope.row.goodsType"/>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="状态" align="center" prop="status">
  138. <template slot-scope="scope">
  139. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="所需积分" align="center" prop="integral" />
  143. <el-table-column label="需支付金额" align="center" prop="cash" />
  144. <el-table-column label="排序" align="center" prop="sort" />
  145. <el-table-column label="库存" align="center" prop="stock" />
  146. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  147. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
  148. <template slot-scope="scope">
  149. <el-button
  150. size="mini"
  151. type="text"
  152. icon="el-icon-edit"
  153. @click="handleUpdate(scope.row)"
  154. v-hasPermi="['his:integralGoods:edit']"
  155. >修改</el-button>
  156. <el-button
  157. size="mini"
  158. type="text"
  159. @click="handledetails(scope.row)"
  160. >详情
  161. </el-button>
  162. <el-button
  163. size="mini"
  164. type="text"
  165. icon="el-icon-delete"
  166. @click="handleDelete(scope.row)"
  167. v-hasPermi="['his:integralGoods:remove']"
  168. >删除</el-button>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. <pagination
  173. v-show="total>0"
  174. :total="total"
  175. :page.sync="queryParams.pageNum"
  176. :limit.sync="queryParams.pageSize"
  177. @pagination="getList"
  178. />
  179. <!-- 添加或修改积分商品对话框 -->
  180. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  181. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  182. <el-form-item label="商品名称" prop="goodsName">
  183. <el-input v-model="form.goodsName" placeholder="请输入商品名称" />
  184. </el-form-item>
  185. <el-form-item label="商品分类" prop="goodsType">
  186. <el-select v-model="form.goodsType" placeholder="请选择商品分类">
  187. <el-option
  188. v-for="dict in goodsTypeOptions"
  189. :key="dict.dictValue"
  190. :label="dict.dictLabel"
  191. :value="parseInt(dict.dictValue)"
  192. ></el-option>
  193. </el-select>
  194. </el-form-item>
  195. <el-form-item label="商品图片" prop="imgUrl">
  196. <Material v-model="imageArr" type="image" :num="1" :width="150" :height="150" />
  197. </el-form-item>
  198. <el-form-item label="轮播图" prop="images">
  199. <Material v-model="photoArr" type="image" :num="10" :width="150" :height="150" />
  200. </el-form-item>
  201. <el-form-item label="原价" prop="otPrice">
  202. <el-input-number v-model="form.otPrice" :precision="2" :step="0.1" ></el-input-number>
  203. </el-form-item>
  204. <el-form-item label="所需积分" prop="integral">
  205. <el-input-number v-model="form.integral" :min="1" label="所需积分"></el-input-number>
  206. </el-form-item>
  207. <el-form-item label="支付金额" prop="cash">
  208. <el-input-number v-model="form.cash" :min="0" :precision="2" :step="0.1" label="需支付金额"></el-input-number>
  209. </el-form-item>
  210. <el-form-item label="商品编号" prop="barCode">
  211. <el-input v-model="form.barCode" placeholder="请输入商品编号" style="width: 200px;"/>
  212. </el-form-item>
  213. <el-form-item label="排序" prop="sort">
  214. <el-input-number v-model="form.sort" :min="0" label="排序"></el-input-number>
  215. </el-form-item>
  216. <el-form-item label="详情">
  217. <Editor ref="myeditor" @on-text-change="updateText"/>
  218. </el-form-item>
  219. <el-form-item label="库存" prop="stock">
  220. <el-input-number v-model="form.stock" :min="0" label="库存"></el-input-number>
  221. </el-form-item>
  222. <el-form-item label="状态">
  223. <el-radio-group v-model="form.status">
  224. <el-radio
  225. v-for="dict in statusOptions"
  226. :key="dict.dictValue"
  227. :label="parseInt(dict.dictValue)"
  228. >{{dict.dictLabel}}</el-radio>
  229. </el-radio-group>
  230. </el-form-item>
  231. <el-form-item label="可见范围" prop="visibleScopeArr">
  232. <el-select style="width: 240px" v-model="visibleScopeArr" placeholder="请选择可见范围" size="small" multiple>
  233. <el-option label="APP" value="app" />
  234. <el-option label="小程序" value="mini" />
  235. </el-select>
  236. </el-form-item>
  237. <el-form-item label="所属小程序" prop="appIds">
  238. <el-select style="width: 240px" v-model="appIds" placeholder="请选择所属小程序" clearable size="small" multiple>
  239. <el-option
  240. v-for="dict in appMallOptions"
  241. :key="dict.appid"
  242. :label="dict.name + '(' + dict.appid + ')'"
  243. :value="dict.appid"
  244. />
  245. </el-select>
  246. </el-form-item>
  247. </el-form>
  248. <div slot="footer" class="dialog-footer">
  249. <el-button type="primary" @click="submitForm">确 定</el-button>
  250. <el-button @click="cancel">取 消</el-button>
  251. </div>
  252. </el-dialog>
  253. <el-drawer
  254. :with-header="false"
  255. size="75%"
  256. :title="show.title" :visible.sync="show.open">
  257. <integralGoodsDetails ref="Details" />
  258. </el-drawer>
  259. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  260. <el-upload
  261. ref="upload"
  262. :limit="1"
  263. accept=".xlsx, .xls"
  264. :headers="upload.headers"
  265. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  266. :disabled="upload.isUploading"
  267. :on-progress="handleFileUploadProgress"
  268. :on-success="handleFileSuccess"
  269. :auto-upload="false"
  270. drag
  271. >
  272. <i class="el-icon-upload"></i>
  273. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  274. <div class="el-upload__tip text-center" slot="tip">
  275. <div class="el-upload__tip" slot="tip">
  276. <!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的数据 -->
  277. </div>
  278. <span>仅允许导入xls、xlsx格式文件。</span>
  279. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
  280. </div>
  281. </el-upload>
  282. <div slot="footer" class="dialog-footer">
  283. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  284. <el-button @click="upload.open = false">取 消</el-button>
  285. </div>
  286. </el-dialog>
  287. <!-- 批量修改积分和金额对话框 -->
  288. <el-dialog :title="batchTitle" :visible.sync="batchOpen" width="500px" append-to-body>
  289. <el-form ref="batchForm" :model="batchForm" :rules="batchRules" label-width="120px">
  290. <el-form-item label="所需积分" prop="integral">
  291. <el-input-number v-model="batchForm.integral" :min="1" placeholder="请输入所需积分"></el-input-number>
  292. </el-form-item>
  293. <el-form-item label="需支付金额" prop="cash">
  294. <el-input-number v-model="batchForm.cash" :min="0" :precision="2" :step="0.1" placeholder="请输入支付金额"></el-input-number>
  295. </el-form-item>
  296. <el-alert
  297. title="至少填写一项,留空项将不修改"
  298. type="info"
  299. :closable="false"
  300. show-icon
  301. />
  302. </el-form>
  303. <div slot="footer" class="dialog-footer">
  304. <el-button type="primary" @click="submitBatchForm" :loading="batchLoading">确 定</el-button>
  305. <el-button @click="batchOpen = false">取 消</el-button>
  306. </div>
  307. </el-dialog>
  308. </div>
  309. </template>
  310. <script>
  311. import { importTemplate,listIntegralGoods, getIntegralGoods, delIntegralGoods, addIntegralGoods, updateIntegralGoods, exportIntegralGoods, batchUpdateIntegralGoods } from "@/api/his/integralGoods";
  312. import Material from '@/components/Material';
  313. import Editor from '@/components/Editor/wang';
  314. import { getToken } from "@/utils/auth";
  315. import integralGoodsDetails from '../../components/his/integralGoodsDetails';
  316. import { list as getAppMallOptions } from '@/api/course/coursePlaySourceConfig'
  317. export default {
  318. name: "IntegralGoods",
  319. components: {Material,Editor,integralGoodsDetails},
  320. watch: {
  321. imageArr: function(val) {
  322. this.form.imgUrl = val.join(',')
  323. },
  324. photoArr: function(val) {
  325. this.form.images = val.join(',')
  326. }
  327. },
  328. data() {
  329. return {
  330. appIds:[], // 选择的小程序
  331. visibleScopeArr: ['app', 'mini'],
  332. // 小程序列表
  333. appMallOptions:[],
  334. show:{
  335. open:false,
  336. },
  337. upload: {
  338. // 是否显示弹出层
  339. open: false,
  340. // 弹出层标题
  341. title: "",
  342. // 是否禁用上传
  343. isUploading: false,
  344. // 是否更新已经存在的用户数据
  345. updateSupport: 0,
  346. // 设置上传的请求头部
  347. headers: { Authorization: "Bearer " + getToken() },
  348. // 上传的地址
  349. url: process.env.VUE_APP_BASE_API + "/his/integralGoods/importData"
  350. },
  351. // 批量修改
  352. batchOpen: false,
  353. batchTitle: "批量修改积分和金额",
  354. batchLoading: false,
  355. batchForm: {
  356. integral: null,
  357. cash: null
  358. },
  359. batchRules: {
  360. integral: [
  361. {
  362. validator: (rule, value, callback) => {
  363. if (this.batchForm.integral === null && this.batchForm.cash === null) {
  364. callback(new Error('至少需要填写所需积分或需支付金额中的一项'));
  365. } else {
  366. callback();
  367. }
  368. },
  369. trigger: 'change'
  370. }
  371. ],
  372. cash: [
  373. {
  374. validator: (rule, value, callback) => {
  375. if (this.batchForm.integral === null && this.batchForm.cash === null) {
  376. callback(new Error('至少需要填写所需积分或需支付金额中的一项'));
  377. } else {
  378. callback();
  379. }
  380. },
  381. trigger: 'change'
  382. }
  383. ]
  384. },
  385. photoArr:[],
  386. imageArr:[],
  387. // 遮罩层
  388. loading: true,
  389. // 导出遮罩层
  390. exportLoading: false,
  391. // 选中数组
  392. ids: [],
  393. // 非单个禁用
  394. single: true,
  395. // 非多个禁用
  396. multiple: true,
  397. // 显示搜索条件
  398. showSearch: true,
  399. // 总条数
  400. total: 0,
  401. // 积分商品表格数据
  402. integralGoodsList: [],
  403. // 弹出层标题
  404. title: "",
  405. // 是否显示弹出层
  406. open: false,
  407. // 商品分类字典
  408. goodsTypeOptions: [],
  409. // 状态字典
  410. statusOptions: [],
  411. // 查询参数
  412. queryParams: {
  413. pageNum: 1,
  414. pageSize: 10,
  415. goodsName: null,
  416. goodsType: null,
  417. status: null,
  418. appId: null,
  419. integral: null,
  420. createTime: null
  421. },
  422. // 表单参数
  423. form: {},
  424. // 表单校验
  425. rules: {
  426. imgUrl: [
  427. { required: true, message: "封面图不能为空", trigger: "submit" }
  428. ],
  429. goodsName: [
  430. { required: true, message: "商品名称不能为空", trigger: "submit" }
  431. ],
  432. barCode: [
  433. { required: true, message: "商品编号不能为空", trigger: "blur" }
  434. ]
  435. }
  436. };
  437. },
  438. created() {
  439. // 查询小程序
  440. this.getAppMallOptions();
  441. this.getList();
  442. this.getDicts("sys_integral_goods_type").then(response => {
  443. this.goodsTypeOptions = response.data;
  444. });
  445. this.getDicts("sys_company_status").then(response => {
  446. this.statusOptions = response.data;
  447. });
  448. },
  449. methods: {
  450. getAppMallOptions() {
  451. getAppMallOptions({pageNum:1,pageSize:100}).then(response => {
  452. this.appMallOptions = response.rows;
  453. })
  454. },
  455. handledetails(row){
  456. this.show.open=true;
  457. setTimeout(() => {
  458. this.$refs.Details.getDetails(row.goodsId);
  459. }, 1);
  460. },
  461. /** 导入按钮操作 */
  462. handleImport() {
  463. this.upload.title = "导入";
  464. this.upload.open = true;
  465. },
  466. /** 下载模板操作 */
  467. importTemplate() {
  468. importTemplate().then(response => {
  469. this.download(response.msg);
  470. });
  471. },
  472. // 文件上传中处理
  473. handleFileUploadProgress(event, file, fileList) {
  474. this.upload.isUploading = true;
  475. },
  476. // 文件上传成功处理
  477. handleFileSuccess(response, file, fileList) {
  478. this.upload.open = false;
  479. this.upload.isUploading = false;
  480. this.$refs.upload.clearFiles();
  481. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  482. this.getList();
  483. },
  484. // 提交上传文件
  485. submitFileForm() {
  486. this.$refs.upload.submit();
  487. },
  488. /** 查询积分商品列表 */
  489. getList() {
  490. this.loading = true;
  491. listIntegralGoods(this.queryParams).then(response => {
  492. this.integralGoodsList = response.rows;
  493. this.total = response.total;
  494. this.loading = false;
  495. });
  496. },
  497. updateText(text){
  498. this.form.descs=text
  499. },
  500. // 取消按钮
  501. cancel() {
  502. this.open = false;
  503. this.reset();
  504. },
  505. // 表单重置
  506. reset() {
  507. this.form = {
  508. goodsId: null,
  509. imgUrl: null,
  510. images: null,
  511. goodsName: null,
  512. otPrice: null,
  513. goodsType: null,
  514. status: 0,
  515. integral: null,
  516. cash: null,
  517. sort: null,
  518. stock: null,
  519. descs: null,
  520. createTime: null,
  521. visibleScope: 'app,mini'
  522. };
  523. this.appIds = [];
  524. this.visibleScopeArr = ['app', 'mini'];
  525. this.resetForm("form");
  526. },
  527. /** 搜索按钮操作 */
  528. handleQuery() {
  529. this.queryParams.pageNum = 1;
  530. this.getList();
  531. },
  532. /** 重置按钮操作 */
  533. resetQuery() {
  534. this.resetForm("queryForm");
  535. this.handleQuery();
  536. },
  537. // 多选框选中数据
  538. handleSelectionChange(selection) {
  539. this.ids = selection.map(item => item.goodsId)
  540. this.single = selection.length!==1
  541. this.multiple = !selection.length
  542. },
  543. /** 新增按钮操作 */
  544. handleAdd() {
  545. this.reset();
  546. this.open = true;
  547. this.title = "添加积分商品";
  548. //新增
  549. setTimeout(() => {
  550. this.$refs.myeditor.setText("");
  551. }, 500);
  552. },
  553. /** 修改按钮操作 */
  554. handleUpdate(row) {
  555. this.reset();
  556. const goodsId = row.goodsId || this.ids
  557. getIntegralGoods(goodsId).then(response => {
  558. this.form = response.data;
  559. this.open = true;
  560. this.title = "修改积分商品";
  561. if(this.form.imgUrl!=null){
  562. this.imageArr=this.form.imgUrl.split(",");
  563. }
  564. if(this.form.images!=null){
  565. this.photoArr=this.form.images.split(",");
  566. }
  567. this.appIds = this.form.appIds ? this.form.appIds.split(',') : [];
  568. this.visibleScopeArr = this.form.visibleScope ? this.form.visibleScope.split(',') : ['app', 'mini'];
  569. //修改按钮
  570. setTimeout(() => {
  571. if(this.form.descs==null){
  572. this.$refs.myeditor.setText("");
  573. }
  574. else{
  575. this.$refs.myeditor.setText(this.form.descs);
  576. }
  577. }, 1);
  578. });
  579. },
  580. /** 提交按钮 */
  581. submitForm() {
  582. this.$refs["form"].validate(valid => {
  583. if (valid) {
  584. if (!this.visibleScopeArr || this.visibleScopeArr.length === 0) {
  585. this.msgError("请选择可见范围");
  586. return;
  587. }
  588. // 小程序
  589. const params = {
  590. ...this.form,
  591. appIds: this.appIds.join(','),
  592. visibleScope: this.visibleScopeArr.join(',')
  593. };
  594. if (this.form.goodsId != null) {
  595. updateIntegralGoods(params).then(response => {
  596. this.msgSuccess("修改成功");
  597. this.open = false;
  598. this.reset();
  599. this.getList();
  600. });
  601. } else {
  602. addIntegralGoods(params).then(response => {
  603. this.msgSuccess("新增成功");
  604. this.open = false;
  605. this.reset();
  606. this.getList();
  607. });
  608. }
  609. }
  610. });
  611. },
  612. /** 删除按钮操作 */
  613. handleDelete(row) {
  614. const goodsIds = row.goodsId || this.ids;
  615. this.$confirm('是否确认删除积分商品编号为"' + goodsIds + '"的数据项?', "警告", {
  616. confirmButtonText: "确定",
  617. cancelButtonText: "取消",
  618. type: "warning"
  619. }).then(function() {
  620. return delIntegralGoods(goodsIds);
  621. }).then(() => {
  622. this.getList();
  623. this.msgSuccess("删除成功");
  624. }).catch(() => {});
  625. },
  626. /** 批量修改按钮操作 */
  627. handleBatchUpdate() {
  628. this.batchForm = {
  629. integral: null,
  630. cash: null
  631. };
  632. this.batchOpen = true;
  633. },
  634. /** 提交批量修改 */
  635. submitBatchForm() {
  636. this.$refs["batchForm"].validate(valid => {
  637. if (valid) {
  638. const params = {
  639. goodsIds: this.ids,
  640. integral: this.batchForm.integral,
  641. cash: this.batchForm.cash
  642. };
  643. this.batchLoading = true;
  644. batchUpdateIntegralGoods(params).then(response => {
  645. this.msgSuccess("批量修改成功");
  646. this.batchOpen = false;
  647. this.batchLoading = false;
  648. this.getList();
  649. }).catch(() => {
  650. this.batchLoading = false;
  651. });
  652. }
  653. });
  654. },
  655. /** 导出按钮操作 */
  656. handleExport() {
  657. const queryParams = this.queryParams;
  658. this.$confirm('是否确认导出所有积分商品数据项?', "警告", {
  659. confirmButtonText: "确定",
  660. cancelButtonText: "取消",
  661. type: "warning"
  662. }).then(() => {
  663. this.exportLoading = true;
  664. return exportIntegralGoods(queryParams);
  665. }).then(response => {
  666. this.download(response.msg);
  667. this.exportLoading = false;
  668. }).catch(() => {});
  669. }
  670. }
  671. };
  672. </script>