1
0

index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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="shopSn">
  5. <el-input
  6. v-model="queryParams.shopSn"
  7. placeholder="请输入门店编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="商户编号" prop="merchSn">
  14. <el-input
  15. v-model="queryParams.merchSn"
  16. placeholder="请输入商户编号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="商户名称" prop="merchName">
  23. <el-input
  24. v-model="queryParams.merchName"
  25. placeholder="请输入商户名称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="三方商户号" prop="thirdMerchSn">
  32. <el-input
  33. v-model="queryParams.thirdMerchSn"
  34. placeholder="请输入三方商户号"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <!--<el-form-item label="门店编码" prop="shopCode">
  41. <el-input
  42. v-model="queryParams.shopCode"
  43. placeholder="请输入门店编码"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item label="门店所在省" prop="shopProvince">
  50. <el-input
  51. v-model="queryParams.shopProvince"
  52. placeholder="请输入门店所在省"
  53. clearable
  54. size="small"
  55. @keyup.enter.native="handleQuery"
  56. />
  57. </el-form-item>
  58. <el-form-item label="门店所在市" prop="shopCity">
  59. <el-input
  60. v-model="queryParams.shopCity"
  61. placeholder="请输入门店所在市"
  62. clearable
  63. size="small"
  64. @keyup.enter.native="handleQuery"
  65. />
  66. </el-form-item>
  67. <el-form-item label="门店所在区县" prop="shopDistrict">
  68. <el-input
  69. v-model="queryParams.shopDistrict"
  70. placeholder="请输入门店所在区县"
  71. clearable
  72. size="small"
  73. @keyup.enter.native="handleQuery"
  74. />
  75. </el-form-item>
  76. <el-form-item label="联系人" prop="shopContactName">
  77. <el-input
  78. v-model="queryParams.shopContactName"
  79. placeholder="请输入联系人"
  80. clearable
  81. size="small"
  82. @keyup.enter.native="handleQuery"
  83. />
  84. </el-form-item>
  85. <el-form-item label="联系人电话" prop="shopContactTel">
  86. <el-input
  87. v-model="queryParams.shopContactTel"
  88. placeholder="请输入联系人电话"
  89. clearable
  90. size="small"
  91. @keyup.enter.native="handleQuery"
  92. />
  93. </el-form-item> -->
  94. <el-form-item label="是否有效" prop="isValid">
  95. <el-select v-model="queryParams.isValid" placeholder="请选择是否有效" clearable size="small">
  96. <el-option
  97. v-for="dict in isValidOptions"
  98. :key="dict.dictValue"
  99. :label="dict.dictLabel"
  100. :value="dict.dictValue"
  101. />
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item>
  105. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  106. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  107. </el-form-item>
  108. </el-form>
  109. <el-row :gutter="10" class="mb8">
  110. <el-col :span="1.5">
  111. <el-button
  112. type="primary"
  113. icon="el-icon-plus"
  114. size="mini"
  115. @click="handleAdd"
  116. v-hasPermi="['biz:shopBase:add']"
  117. >新增</el-button>
  118. </el-col>
  119. <el-col :span="1.5">
  120. <el-button
  121. type="success"
  122. icon="el-icon-edit"
  123. size="mini"
  124. :disabled="single"
  125. @click="handleUpdate"
  126. v-hasPermi="['biz:shopBase:edit']"
  127. >修改</el-button>
  128. </el-col>
  129. <el-col :span="1.5">
  130. <el-button
  131. type="danger"
  132. icon="el-icon-delete"
  133. size="mini"
  134. :disabled="multiple"
  135. @click="handleDelete"
  136. v-hasPermi="['biz:shopBase:remove']"
  137. >删除</el-button>
  138. </el-col>
  139. <el-col :span="1.5">
  140. <el-button
  141. type="warning"
  142. icon="el-icon-download"
  143. size="mini"
  144. @click="handleExport"
  145. v-hasPermi="['biz:shopBase:export']"
  146. >导出</el-button>
  147. </el-col>
  148. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  149. </el-row>
  150. <el-table v-loading="loading" :data="shopBaseList" @selection-change="handleSelectionChange">
  151. <el-table-column type="selection" width="55" align="center" />
  152. <el-table-column label="门店编号" align="center" prop="shopSn" />
  153. <el-table-column label="商户编号" align="center" prop="merchSn" />
  154. <el-table-column label="商户名称" align="center" prop="merchName" />
  155. <el-table-column label="三方商户号" align="center" prop="thirdMerchSn" />
  156. <el-table-column label="门店编码" align="center" prop="shopCode" />
  157. <el-table-column label="门店名称" align="center" prop="shopName" />
  158. <el-table-column label="门店所在省" align="center" prop="shopProvince" />
  159. <el-table-column label="门店所在市" align="center" prop="shopCity" />
  160. <el-table-column label="门店所在区县" align="center" prop="shopDistrict" />
  161. <el-table-column label="门店详细地址" align="center" prop="shopAddress" />
  162. <el-table-column label="联系人" align="center" prop="shopContactName" />
  163. <el-table-column label="联系人电话" align="center" prop="shopContactTel" />
  164. <el-table-column label="是否有效" align="center" prop="isValid" :formatter="isValidFormat" />
  165. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  166. <template slot-scope="scope">
  167. <el-button
  168. size="mini"
  169. type="text"
  170. icon="el-icon-edit"
  171. @click="handleUpdate(scope.row)"
  172. v-hasPermi="['biz:shopBase:edit']"
  173. >修改</el-button>
  174. <el-button
  175. size="mini"
  176. type="text"
  177. icon="el-icon-delete"
  178. @click="handleDelete(scope.row)"
  179. v-hasPermi="['biz:shopBase:remove']"
  180. >删除</el-button>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. <pagination
  185. v-show="total>0"
  186. :total="total"
  187. :page.sync="queryParams.pageNum"
  188. :limit.sync="queryParams.pageSize"
  189. @pagination="getList"
  190. />
  191. <!-- 添加或修改商户门店基本信息对话框 -->
  192. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  193. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  194. <el-form-item label="门店编号" prop="shopSn">
  195. <el-input v-model="form.merchSn" placeholder="请输入门店编号" />
  196. </el-form-item>
  197. <el-form-item label="商户编号" prop="merchSn">
  198. <el-input v-model="form.merchSn" placeholder="请输入商户编号" />
  199. </el-form-item>
  200. <el-form-item label="商户名称" prop="merchName">
  201. <el-input v-model="form.merchName" placeholder="请输入商户名称" />
  202. </el-form-item>
  203. <el-form-item label="三方商户号" prop="thirdMerchSn">
  204. <el-input v-model="form.thirdMerchSn" placeholder="请输入三方商户号" />
  205. </el-form-item>
  206. <el-form-item label="门店编码" prop="shopCode">
  207. <el-input v-model="form.shopCode" placeholder="请输入门店编码" />
  208. </el-form-item>
  209. <el-form-item label="门店名称" prop="shopName">
  210. <el-input v-model="form.shopName" type="textarea" placeholder="请输入内容" />
  211. </el-form-item>
  212. <el-form-item label="门店所在省" prop="shopProvince">
  213. <el-input v-model="form.shopProvince" placeholder="请输入门店所在省" />
  214. </el-form-item>
  215. <el-form-item label="门店所在市" prop="shopCity">
  216. <el-input v-model="form.shopCity" placeholder="请输入门店所在市" />
  217. </el-form-item>
  218. <el-form-item label="门店所在区县" prop="shopDistrict">
  219. <el-input v-model="form.shopDistrict" placeholder="请输入门店所在区县" />
  220. </el-form-item>
  221. <el-form-item label="门店详细地址" prop="shopAddress">
  222. <el-input v-model="form.shopAddress" type="textarea" placeholder="请输入内容" />
  223. </el-form-item>
  224. <el-form-item label="联系人" prop="shopContactName">
  225. <el-input v-model="form.shopContactName" placeholder="请输入联系人" />
  226. </el-form-item>
  227. <el-form-item label="联系人电话" prop="shopContactTel">
  228. <el-input v-model="form.shopContactTel" placeholder="请输入联系人电话" />
  229. </el-form-item>
  230. <el-form-item label="是否有效" prop="isValid">
  231. <el-select v-model="form.isValid" placeholder="请选择是否有效">
  232. <el-option
  233. v-for="dict in isValidOptions"
  234. :key="dict.dictValue"
  235. :label="dict.dictLabel"
  236. :value="dict.dictValue"
  237. ></el-option>
  238. </el-select>
  239. </el-form-item>
  240. </el-form>
  241. <div slot="footer" class="dialog-footer">
  242. <el-button type="primary" @click="submitForm">确 定</el-button>
  243. <el-button @click="cancel">取 消</el-button>
  244. </div>
  245. </el-dialog>
  246. </div>
  247. </template>
  248. <script>
  249. import { listShopBase, getShopBase, delShopBase, addShopBase, updateShopBase, exportShopBase } from "@/api/store/shopBase";
  250. export default {
  251. name: "ShopBase",
  252. components: {
  253. },
  254. data() {
  255. return {
  256. // 遮罩层
  257. loading: true,
  258. // 选中数组
  259. ids: [],
  260. // 非单个禁用
  261. single: true,
  262. // 非多个禁用
  263. multiple: true,
  264. // 显示搜索条件
  265. showSearch: true,
  266. // 总条数
  267. total: 0,
  268. // 商户门店基本信息表格数据
  269. shopBaseList: [],
  270. // 弹出层标题
  271. title: "",
  272. // 是否显示弹出层
  273. open: false,
  274. // 是否有效,0:有效,1:无效字典
  275. isValidOptions: [],
  276. // 查询参数
  277. queryParams: {
  278. pageNum: 1,
  279. pageSize: 10,
  280. shopSn: null,
  281. merchSn: null,
  282. merchName: null,
  283. thirdMerchSn: null,
  284. shopCode: null,
  285. shopName: null,
  286. shopProvince: null,
  287. shopCity: null,
  288. shopDistrict: null,
  289. shopAddress: null,
  290. shopContactName: null,
  291. shopContactTel: null,
  292. isValid: null,
  293. },
  294. // 表单参数
  295. form: {},
  296. // 表单校验
  297. rules: {
  298. shopSn: [
  299. { required: true, message: "门店编号不能为空", trigger: "blur" }
  300. ],
  301. merchSn: [
  302. { required: true, message: "商户编号不能为空", trigger: "blur" }
  303. ],
  304. }
  305. };
  306. },
  307. created() {
  308. this.getList();
  309. this.getDicts("valid").then(response => {
  310. this.isValidOptions = response.data;
  311. });
  312. },
  313. methods: {
  314. /** 查询商户门店基本信息列表 */
  315. getList() {
  316. this.loading = true;
  317. listShopBase(this.queryParams).then(response => {
  318. this.shopBaseList = response.rows;
  319. this.total = response.total;
  320. this.loading = false;
  321. });
  322. },
  323. // 是否有效,0:有效,1:无效字典翻译
  324. isValidFormat(row, column) {
  325. return this.selectDictLabel(this.isValidOptions, row.isValid);
  326. },
  327. // 取消按钮
  328. cancel() {
  329. this.open = false;
  330. this.reset();
  331. },
  332. // 表单重置
  333. reset() {
  334. this.form = {
  335. shopSn: null,
  336. merchSn: null,
  337. merchName: null,
  338. thirdMerchSn: null,
  339. merchChnlCode: null,
  340. merchChnlName: null,
  341. shopCode: null,
  342. shopName: null,
  343. shopProvince: null,
  344. shopCity: null,
  345. shopDistrict: null,
  346. shopAddress: null,
  347. shopContactName: null,
  348. shopContactTel: null,
  349. isValid: null,
  350. createrSn: null,
  351. createTime: null,
  352. moderSn: null,
  353. modTime: null,
  354. tstm: null
  355. };
  356. this.resetForm("form");
  357. },
  358. /** 搜索按钮操作 */
  359. handleQuery() {
  360. this.queryParams.pageNum = 1;
  361. this.getList();
  362. },
  363. /** 重置按钮操作 */
  364. resetQuery() {
  365. this.resetForm("queryForm");
  366. this.handleQuery();
  367. },
  368. // 多选框选中数据
  369. handleSelectionChange(selection) {
  370. this.ids = selection.map(item => item.shopSn)
  371. this.single = selection.length!==1
  372. this.multiple = !selection.length
  373. },
  374. /** 新增按钮操作 */
  375. handleAdd() {
  376. this.reset();
  377. this.open = true;
  378. this.title = "添加商户门店基本信息";
  379. },
  380. /** 修改按钮操作 */
  381. handleUpdate(row) {
  382. this.reset();
  383. const shopSn = row.shopSn || this.ids
  384. getShopBase(shopSn).then(response => {
  385. this.form = response.data;
  386. this.open = true;
  387. this.title = "修改商户门店基本信息";
  388. });
  389. },
  390. /** 提交按钮 */
  391. submitForm() {
  392. this.$refs["form"].validate(valid => {
  393. if (valid) {
  394. if (this.form.shopSn != null) {
  395. updateShopBase(this.form).then(response => {
  396. this.msgSuccess("修改成功");
  397. this.open = false;
  398. this.getList();
  399. });
  400. } else {
  401. addShopBase(this.form).then(response => {
  402. this.msgSuccess("新增成功");
  403. this.open = false;
  404. this.getList();
  405. });
  406. }
  407. }
  408. });
  409. },
  410. /** 删除按钮操作 */
  411. handleDelete(row) {
  412. const shopSns = row.shopSn || this.ids;
  413. this.$confirm('是否确认删除商户门店基本信息编号为"' + shopSns + '"的数据项?', "警告", {
  414. confirmButtonText: "确定",
  415. cancelButtonText: "取消",
  416. type: "warning"
  417. }).then(function() {
  418. return delShopBase(shopSns);
  419. }).then(() => {
  420. this.getList();
  421. this.msgSuccess("删除成功");
  422. })
  423. },
  424. /** 导出按钮操作 */
  425. handleExport() {
  426. const queryParams = this.queryParams;
  427. this.$confirm('是否确认导出所有商户门店基本信息数据项?', "警告", {
  428. confirmButtonText: "确定",
  429. cancelButtonText: "取消",
  430. type: "warning"
  431. }).then(function() {
  432. return exportShopBase(queryParams);
  433. }).then(response => {
  434. this.download(response.msg);
  435. })
  436. }
  437. }
  438. };
  439. </script>