wallet_list.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div>
  5. <Collapse :screen-form="searchForm">
  6. <template #right_btn>
  7. <el-button size="mini" @click="clearFn">清空</el-button>
  8. <el-button size="mini" type="primary" @click="searchFn">搜索</el-button>
  9. </template>
  10. <template #search>
  11. <el-form ref="searchForm" :model="searchForm" label-width="100px" size="mini" label-position="left">
  12. <el-row :gutter="20">
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="名称" prop="walletName">
  15. <el-input v-model="searchForm.walletName" placeholder="请输入"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <!-- <el-col :xs="24" :sm="12" :lg="6">
  19. <el-form-item label="产品大类" prop="mainId">
  20. <el-select
  21. class="selectStyle"
  22. filterable
  23. v-model="searchForm.mainId"
  24. placeholder="名称"
  25. >
  26. <el-option
  27. v-for="item in categoryList"
  28. :key="item.productCategoryNumber"
  29. :label="item.productCategoryName"
  30. :value="item.productCategoryNumber"
  31. >
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col> -->
  36. </el-row>
  37. </el-form>
  38. </template>
  39. </Collapse>
  40. </div>
  41. <!-- 按钮 -->
  42. <div class="btn-group clearfix">
  43. <div class="fl">
  44. <el-button type="primary" v-if="false" size="mini">更新</el-button>
  45. </div>
  46. <div class="fr">
  47. <el-button type="primary" v-if="false" size="mini">导出</el-button>
  48. </div>
  49. </div>
  50. <!-- 列表 -->
  51. <div class="mymain-container">
  52. <div class="table">
  53. <el-table
  54. v-loading="listLoading"
  55. :data="dataList"
  56. element-loading-text="Loading"
  57. border
  58. fit
  59. highlight-current-row
  60. stripe
  61. >
  62. <el-table-column align="left" label="编码" prop="number" min-width="160" show-overflow-tooltip>
  63. <template slot-scope="scope">
  64. <CopyButton :copyText="scope.row.number" />
  65. <span>{{ scope.row.number }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column align="left" label="现金钱包名称" prop="name" min-width="160" show-overflow-tooltip>
  69. <template slot-scope="scope">
  70. <CopyButton :copyText="scope.row.name" />
  71. <span>{{ scope.row.name }}</span>
  72. </template>
  73. </el-table-column>
  74. <!-- <el-table-column
  75. align="center"
  76. label="对应产品大类"
  77. prop="mainName"
  78. min-width="160"
  79. show-overflow-tooltip
  80. ></el-table-column> -->
  81. <el-table-column align="center" label="操作" prop="caozuo" min-width="160" show-overflow-tooltip>
  82. <template slot-scope="scope">
  83. <el-button
  84. type="text"
  85. class="textColor"
  86. v-if="$checkBtnRole('edit', $route.meta.roles)"
  87. @click="setFn(scope.row)"
  88. >设置</el-button
  89. >
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. </div>
  94. </div>
  95. <!-- 弹窗 -->
  96. <el-dialog title="钱包" :visible.sync="dialogForm" width="30%" :show-close="false" :close-on-click-modal="false">
  97. <el-form ref="addForm" :model="addForm" label-width="120px">
  98. <el-form-item label="现金钱包名称" prop="customerId">
  99. <el-input disabled v-model="addForm.name"></el-input>
  100. </el-form-item>
  101. <el-form-item label="编码" prop="customerId">
  102. <el-input disabled v-model="addForm.number"></el-input>
  103. </el-form-item>
  104. <!-- <el-form-item label="对应产品大类" prop="customerId">
  105. <el-select
  106. class="selectStyle"
  107. v-model="addForm.mainId"
  108. placeholder="名称"
  109. >
  110. <el-option
  111. v-for="item in categoryList"
  112. :key="item.productCategoryNumber"
  113. :label="item.productCategoryName"
  114. :value="item.productCategoryNumber"
  115. >
  116. </el-option>
  117. </el-select>
  118. </el-form-item> -->
  119. <el-form-item label="折让钱包" prop="customerId">
  120. <el-radio-group v-model="addForm.isZr">
  121. <el-radio :label="true">是</el-radio>
  122. <el-radio :label="false">否</el-radio>
  123. </el-radio-group>
  124. </el-form-item>
  125. <el-form-item label="是否使用返利" prop="customerId">
  126. <el-radio-group v-model="addForm.isRebate">
  127. <el-radio :label="true">是</el-radio>
  128. <el-radio :label="false">否</el-radio>
  129. </el-radio-group>
  130. </el-form-item>
  131. </el-form>
  132. <div slot="footer" class="dialog-footer">
  133. <el-button @click="cancelFn">取 消</el-button>
  134. <el-button type="primary" @click="btnOK">确 定</el-button>
  135. </div>
  136. </el-dialog>
  137. </div>
  138. <!-- <template-page
  139. ref="pageRef"
  140. :getList="getList"
  141. :operation="operation()"
  142. :optionsEvensGroup="optionsEvensGroup"
  143. :exportList="exportList"
  144. :columnParsing="columnParsing"
  145. :tableAttributes="tableAttributes"
  146. :tableEvents="tableEvents"
  147. >
  148. </template-page> -->
  149. </template>
  150. <script>
  151. import TemplatePage from '@/components/template/template-page-1.vue'
  152. import { getWalletList, getProductCategory, getWalletBiandMain, getWalletDetail } from '@/api/basic_data/wallet_list'
  153. export default {
  154. components: {
  155. TemplatePage
  156. },
  157. data() {
  158. return {
  159. // 事件组合
  160. optionsEvensGroup: [],
  161. // 表格属性
  162. tableAttributes: {
  163. // 启用勾选列
  164. selectColumn: true
  165. },
  166. // 表格事件
  167. tableEvents: {
  168. 'selection-change': this.selectionChange
  169. },
  170. recordSelected: [],
  171. //
  172. listLoading: false, // 列表加载loading
  173. searchForm: {
  174. walletName: '',
  175. mainId: ''
  176. },
  177. listTotal: 0, // 列表总数
  178. dataList: [],
  179. dialogForm: false,
  180. // categoryList: [],
  181. addForm: {
  182. id: '',
  183. isRebate: null,
  184. isZr: null,
  185. // mainId: "",
  186. // mainName: "",
  187. name: '',
  188. number: ''
  189. },
  190. walletId: null //钱包ID
  191. }
  192. },
  193. created() {
  194. this.getDataList()
  195. // this.getCategoryList();
  196. },
  197. methods: {
  198. // 列表请求函数
  199. // getList: levelList,
  200. // 列表导出函数
  201. // exportList: exportLevelList,
  202. // 表格列解析渲染数据更改
  203. columnParsing(item, defaultData) {
  204. return defaultData
  205. },
  206. // 监听勾选变化
  207. selectionChange(data) {
  208. this.recordSelected = data
  209. },
  210. operation() {
  211. return (h, { row, index, column }) => {
  212. return (
  213. <div class="operation-btns">
  214. <el-button size="mini" type="text" onClick={async () => {}}>
  215. 详情
  216. </el-button>
  217. </div>
  218. )
  219. }
  220. },
  221. //确定
  222. async btnOK() {
  223. console.log(this.addForm)
  224. // console.log(this.categoryList);
  225. // const res = this.categoryList.filter(
  226. // (v) => v.productCategoryNumber == this.addForm.mainId
  227. // );
  228. let data = {
  229. id: this.walletId,
  230. isRebate: this.addForm.isRebate,
  231. isZr: this.addForm.isZr
  232. // mainId: this.addForm.mainId,
  233. // mainName: res[0].productCategoryName,
  234. }
  235. await getWalletBiandMain(data)
  236. this.addForm.isRebate = null
  237. this.addForm.isZr = null
  238. // this.addForm.mainId = "";
  239. this.getDataList()
  240. this.$message.success('设置成功')
  241. this.dialogForm = false
  242. },
  243. //取消
  244. cancelFn() {
  245. // this.addForm.isRebate = null;
  246. // this.addForm.isZr = null;
  247. // this.addForm.mainId = "";
  248. this.dialogForm = false
  249. },
  250. //清空
  251. async clearFn() {
  252. await this.$refs.searchForm.resetFields()
  253. },
  254. //搜索
  255. searchFn() {
  256. this.getDataList({ ...this.searchForm })
  257. },
  258. // //获取产品类别列表
  259. // async getCategoryList() {
  260. // const res = await getProductCategory();
  261. // this.categoryList = res.data;
  262. // },
  263. //设置产品大类
  264. async setFn(value) {
  265. this.walletId = value.id
  266. // this.addForm.name = value.name;
  267. // this.addForm.number = value.number;
  268. let res = await getWalletDetail({ walletId: value.id })
  269. // console.log(res);
  270. this.addForm.name = res.data.name
  271. this.addForm.number = res.data.number
  272. // this.addForm.mainId = res.data.mainId;
  273. this.addForm.isRebate = res.data.isRebate
  274. this.addForm.isZr = res.data.isZr
  275. this.dialogForm = true
  276. },
  277. //获取列表数据
  278. async getDataList(data) {
  279. const res = await getWalletList(data)
  280. this.dataList = res.data
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped>
  286. .selectStyle {
  287. width: 100%;
  288. }
  289. </style>