audit.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="店铺名称" prop="storeName">
  5. <el-input
  6. v-model="queryParams.storeName"
  7. placeholder="请输入店铺名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="地址" prop="address">
  14. <el-input
  15. v-model="queryParams.address"
  16. placeholder="请输入地址"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="店铺电话" prop="phone">
  23. <el-input
  24. v-model="queryParams.phone"
  25. placeholder="请输入店铺电话"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="状态" prop="status">
  32. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  33. <el-option
  34. v-for="dict in statusOptions"
  35. :key="dict.dictValue"
  36. :label="dict.dictLabel"
  37. :value="dict.dictValue"
  38. />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="登录帐号" prop="account">
  42. <el-input
  43. v-model="queryParams.account"
  44. placeholder="请输入登录帐号"
  45. clearable
  46. size="small"
  47. @keyup.enter.native="handleQuery"
  48. />
  49. </el-form-item>
  50. <el-form-item>
  51. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  52. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  53. </el-form-item>
  54. </el-form>
  55. <el-row :gutter="10" class="mb8">
  56. <el-col :span="1.5">
  57. <el-button
  58. type="warning"
  59. plain
  60. icon="el-icon-download"
  61. size="mini"
  62. :loading="exportLoading"
  63. @click="handleExport"
  64. v-hasPermi="['his:store:export']"
  65. >导出</el-button>
  66. </el-col>
  67. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  68. </el-row>
  69. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClickX">
  70. <el-tab-pane v-for="(item,index) in isAuditOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  71. </el-tabs>
  72. <el-table v-loading="loading" border :data="storeList" @selection-change="handleSelectionChange">
  73. <el-table-column type="selection" width="55" align="center" />
  74. <el-table-column label="店铺id" align="center" prop="storeId" width="120px"/>
  75. <el-table-column label="店铺名称" align="center" prop="storeName" width="120px"/>
  76. <el-table-column label="店铺LOGO" align="center" prop="logoUrl" width="100px">
  77. <template slot-scope="scope">
  78. <el-popover
  79. placement="right"
  80. title=""
  81. trigger="hover">
  82. <img slot="reference" :src="scope.row.logoUrl" width="80px">
  83. <img :src="scope.row.logoUrl" style="max-width: 150px;">
  84. </el-popover>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="地址" align="center" prop="address" width="200px"/>
  88. <el-table-column label="店铺电话" align="center" prop="phone" width="120px"/>
  89. <!-- <el-table-column label="资质证书" align="center" prop="licenseImages" width="100px">
  90. <template slot-scope="scope">
  91. <el-popover
  92. placement="right"
  93. title=""
  94. trigger="hover">
  95. <img slot="reference" :src="scope.row.licenseImages" width="80px">
  96. <img :src="scope.row.licenseImages" style="max-width: 150px;">
  97. </el-popover>
  98. </template>
  99. </el-table-column>-->
  100. <el-table-column label="审核状态" align="center" prop="isAudit">
  101. <template slot-scope="scope">
  102. <dict-tag :options="isAuditOptions" :value="scope.row.isAudit"/>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="商品总数" align="center" prop="productCount" />
  106. <el-table-column label="状态" align="center" prop="status">
  107. <template slot-scope="scope">
  108. <dict-tag :options="statusOptions" :value="scope.row.status"/>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="销量" align="center" prop="salesCount" />
  112. <el-table-column label="余额" align="center" prop="balance" />
  113. <el-table-column label="累计金额" align="center" prop="totalMoney" />
  114. <el-table-column label="登录帐号" align="center" prop="account" width="150px" />
  115. <el-table-column label="创建时间" align="center" prop="createTime" width="150px"/>
  116. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="130px" v-if="medicalMallConfig.isAudit">
  117. <template slot-scope="scope">
  118. <el-button
  119. size="mini"
  120. type="text"
  121. icon="el-icon-s-promotion"
  122. @click="handledetails(scope.row)"
  123. >
  124. <span v-if="scope.row.isAudit===0">审核</span>
  125. <span v-else>详情</span>
  126. </el-button>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="130px" v-else>
  130. <template slot-scope="scope">
  131. <el-button
  132. size="mini"
  133. type="text"
  134. icon="el-icon-s-promotion"
  135. @click="handleUpdate(scope.row)"
  136. >
  137. <span>审核</span>
  138. </el-button>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. <pagination
  143. v-show="total>0"
  144. :total="total"
  145. :page.sync="queryParams.pageNum"
  146. :limit.sync="queryParams.pageSize"
  147. @pagination="getList"
  148. />
  149. <el-drawer
  150. :with-header="false"
  151. size="75%"
  152. :title="show.title" :visible.sync="show.open" >
  153. <storeDetails ref="Details" @fresh="getList" @showClose="this.show.open = false"/>
  154. </el-drawer>
  155. </div>
  156. </template>
  157. <script>
  158. import { audit,listStore, exportStore } from "@/api/hisStore/store";
  159. import storeDetails from '../components/storeDetails.vue';
  160. import {getCitys} from "@/api/store/city";
  161. import { getConfigByKey } from '@/api/system/config'
  162. export default {
  163. name: "adutstore",
  164. components: { storeDetails },
  165. data() {
  166. return {
  167. show:{
  168. title:"店铺详情",
  169. open:false,
  170. },
  171. medicalMallConfig:{},
  172. citys:[],
  173. licenseuploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
  174. uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
  175. baseUrl: process.env.VUE_APP_BASE_API,
  176. shippingTypeOptions: [{
  177. "label": "配送",
  178. "value": "1"
  179. }, {
  180. "label": "自提",
  181. "value": "2"
  182. }, {
  183. "label": "配送自提",
  184. "value": "3"
  185. }],
  186. // 遮罩层
  187. loading: true,
  188. // 导出遮罩层
  189. exportLoading: false,
  190. // 选中数组
  191. ids: [],
  192. // 非单个禁用
  193. single: true,
  194. // 非多个禁用
  195. multiple: true,
  196. // 显示搜索条件
  197. showSearch: true,
  198. // 总条数
  199. total: 0,
  200. // 店铺管理表格数据
  201. storeList: [],
  202. // 弹出层标题
  203. title: "",
  204. // 是否显示弹出层
  205. open: false,
  206. // 状态字典
  207. statusOptions: [],
  208. // 审核状态字典
  209. isAuditOptions: [],
  210. // 查询参数
  211. queryParams: {
  212. pageNum: 1,
  213. pageSize: 10,
  214. storeName: null,
  215. address: null,
  216. phone: null,
  217. status: null,
  218. isAudit: 0,
  219. account: null,
  220. },
  221. // 表单参数
  222. form: {},
  223. // 表单校验
  224. rules: {
  225. storeName: [
  226. { required: true, message: "店铺名称不能为空", trigger: "blur" }
  227. ],
  228. logoUrl: [
  229. { required: true, message: "店铺LOGO不能为空", trigger: "blur" }
  230. ],
  231. cityIds: [
  232. { required: true, message: "所属城市不能为空", trigger: "blur" }
  233. ],
  234. address: [
  235. { required: true, message: "地址不能为空", trigger: "blur" }
  236. ],
  237. licenseImages: [
  238. { required: true, message: "资质证书不能为空", trigger: "blur" }
  239. ],
  240. shippingType: [
  241. { required: true, message: "配送方式不能为空", trigger: "blur" }
  242. ],
  243. phone: [
  244. { required: true, message: "店铺电话不能为空", trigger: "blur" }
  245. ],
  246. }
  247. };
  248. },
  249. created() {
  250. this.getCitys();
  251. this.getList();
  252. getConfigByKey("medicalMall.func.switch").then(response => {
  253. if(response.data && response.data.configValue) {
  254. this.medicalMallConfig = JSON.parse(response.data.configValue);
  255. }
  256. });
  257. this.getDicts("sys_company_status").then(response => {
  258. this.statusOptions = response.data;
  259. });
  260. this.getDicts("sys_company_isaudit").then(response => {
  261. this.isAuditOptions = response.data;
  262. });
  263. },
  264. methods: {
  265. handleUpdate(row){
  266. var that=this;
  267. var the=null;
  268. this.$confirm('是否确认审核?', "审核", {
  269. distinguishCancelAndClose: true,
  270. confirmButtonText: "确定",
  271. cancelButtonText: "驳回",
  272. type: "warning"
  273. }).then(function() {
  274. var data={
  275. storeId:row.storeId,
  276. isAudit:1
  277. }
  278. return audit(data);
  279. }).then(() => {
  280. this.msgSuccess("操作成功");
  281. this.getList();
  282. }).catch(function(action) {
  283. if (action === 'cancel') {
  284. var data={
  285. storeId:row.storeId,
  286. isAudit:-1
  287. }
  288. the='cancel';
  289. return audit(data);
  290. }
  291. }).then(() => {
  292. if(the==='cancel'){
  293. this.msgSuccess("操作成功");
  294. this.getList();
  295. }
  296. });
  297. },
  298. handledetails(row){
  299. this.show.open=true;
  300. setTimeout(() => {
  301. this.$refs.Details.getDetails(row.storeId);
  302. }, 1);
  303. },
  304. handleCityChange(value) {
  305. var nodes=this.$refs.citySelect.getCheckedNodes();
  306. this.form.address=nodes[0].pathLabels[0]+nodes[0].pathLabels[1]+nodes[0].pathLabels[2];
  307. this.form.cityIds=value.toString();
  308. },
  309. getCitys(){
  310. getCitys().then(res => {
  311. this.loading = false;
  312. this.citys=res.data;
  313. })
  314. },
  315. licensehandleAvatarSuccess(res, file) {
  316. if(res.code==200){
  317. this.form.licenseImages=res.url;
  318. this.$forceUpdate()
  319. }
  320. else{
  321. this.msgError(res.msg);
  322. }
  323. },
  324. handleAvatarSuccess(res, file) {
  325. if(res.code==200){
  326. this.form.logoUrl=res.url;
  327. this.$forceUpdate()
  328. }
  329. else{
  330. this.msgError(res.msg);
  331. }
  332. },
  333. beforeAvatarUpload(file) {
  334. const isLt1M = file.size / 1024 / 1024 < 1;
  335. if (!isLt1M) {
  336. this.$message.error('上传图片大小不能超过 1MB!');
  337. }
  338. return isLt1M;
  339. },
  340. handleClickX(){
  341. this.getList()
  342. },
  343. /** 查询店铺管理列表 */
  344. getList() {
  345. this.loading = true;
  346. listStore(this.queryParams).then(response => {
  347. this.storeList = response.rows;
  348. this.total = response.total;
  349. this.loading = false;
  350. });
  351. },
  352. // 取消按钮
  353. cancel() {
  354. this.open = false;
  355. this.reset();
  356. },
  357. // 表单重置
  358. reset() {
  359. this.form = {
  360. storeId: null,
  361. cityIds: null,
  362. storeName: null,
  363. descs: null,
  364. logoUrl: null,
  365. address: null,
  366. lng: null,
  367. lat: null,
  368. phone: null,
  369. licenseImages: null,
  370. productCount: null,
  371. status: 0,
  372. createTime: null,
  373. updateTime: null,
  374. salesCount: null,
  375. balance: null,
  376. totalMoney: null,
  377. isAudit: 0,
  378. account: null,
  379. password: null,
  380. shippingType: ["1"]
  381. };
  382. this.resetForm("form");
  383. },
  384. /** 搜索按钮操作 */
  385. handleQuery() {
  386. this.queryParams.pageNum = 1;
  387. this.getList();
  388. },
  389. /** 重置按钮操作 */
  390. resetQuery() {
  391. this.resetForm("queryForm");
  392. this.handleQuery();
  393. },
  394. // 多选框选中数据
  395. handleSelectionChange(selection) {
  396. this.ids = selection.map(item => item.storeId)
  397. this.single = selection.length!==1
  398. this.multiple = !selection.length
  399. },
  400. /** 导出按钮操作 */
  401. handleExport() {
  402. const queryParams = this.queryParams;
  403. this.$confirm('是否确认导出所有店铺管理数据项?', "警告", {
  404. confirmButtonText: "确定",
  405. cancelButtonText: "取消",
  406. type: "warning"
  407. }).then(() => {
  408. this.exportLoading = true;
  409. return exportStore(queryParams);
  410. }).then(response => {
  411. this.download(response.msg);
  412. this.exportLoading = false;
  413. }).catch(() => {});
  414. }
  415. }
  416. };
  417. </script>
  418. <style>
  419. .avatar-uploader .el-upload {
  420. border: 1px dashed #d9d9d9;
  421. border-radius: 6px;
  422. cursor: pointer;
  423. position: relative;
  424. overflow: hidden;
  425. }
  426. .avatar-uploader .el-upload:hover {
  427. border-color: #409EFF;
  428. }
  429. .avatar-uploader-icon {
  430. font-size: 28px;
  431. color: #8c939d;
  432. width: 150px;
  433. height: 150px;
  434. line-height: 150px;
  435. text-align: center;
  436. }
  437. </style>