wallet.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template >
  2. <div class="app-container">
  3. <el-row>
  4. <el-col :xs="24" :sm="12" :lg="12">
  5. <div class="styl">现金钱包</div>
  6. </el-col>
  7. <el-col :xs="24" :sm="12" :lg="12">
  8. <div class="fr">
  9. <el-button size="small" type="primary" @click="generateFn"
  10. >一键生成钱包</el-button
  11. >
  12. </div>
  13. </el-col>
  14. </el-row>
  15. <el-divider></el-divider>
  16. <!-- 列表 -->
  17. <div class="mymain-container">
  18. <div class="table">
  19. <el-table
  20. v-loading="listLoading"
  21. :data="walletList"
  22. element-loading-text="Loading"
  23. border
  24. fit
  25. highlight-current-row
  26. stripe
  27. >
  28. <el-table-column
  29. align="center"
  30. label="经销商名称"
  31. prop="customerName"
  32. min-width="160"
  33. show-overflow-tooltip
  34. ></el-table-column>
  35. <el-table-column
  36. align="center"
  37. label="钱包类型"
  38. prop="mainName"
  39. min-width="160"
  40. show-overflow-tooltip
  41. ></el-table-column>
  42. <el-table-column
  43. align="center"
  44. label="钱包"
  45. prop="name"
  46. min-width="160"
  47. show-overflow-tooltip
  48. ></el-table-column>
  49. <el-table-column
  50. align="center"
  51. label="余额"
  52. prop="amount"
  53. min-width="160"
  54. show-overflow-tooltip
  55. ></el-table-column>
  56. <el-table-column
  57. align="center"
  58. label="可用信用额度"
  59. prop="freeCreditAmount"
  60. min-width="160"
  61. show-overflow-tooltip
  62. ></el-table-column>
  63. <el-table-column
  64. align="center"
  65. label="已用信用额度"
  66. prop="usedCreditAmount"
  67. min-width="160"
  68. show-overflow-tooltip
  69. ></el-table-column>
  70. <el-table-column
  71. align="center"
  72. label="更新时间"
  73. prop="updateTime"
  74. min-width="160"
  75. show-overflow-tooltip
  76. ></el-table-column>
  77. </el-table>
  78. </div>
  79. </div>
  80. <span>返利钱包</span>
  81. <el-divider></el-divider>
  82. <!-- 列表 -->
  83. <div class="mymain-container">
  84. <div class="table">
  85. <el-table
  86. v-loading="listLoading"
  87. :data="rebateList"
  88. element-loading-text="Loading"
  89. border
  90. fit
  91. highlight-current-row
  92. stripe
  93. >
  94. <el-table-column
  95. align="center"
  96. label="经销商名称"
  97. prop="customerName"
  98. min-width="160"
  99. show-overflow-tooltip
  100. ></el-table-column>
  101. <el-table-column
  102. align="center"
  103. label="返利钱包"
  104. prop="name"
  105. min-width="160"
  106. show-overflow-tooltip
  107. ></el-table-column>
  108. <el-table-column
  109. align="center"
  110. label="返利比例"
  111. prop="rebateRate"
  112. min-width="160"
  113. show-overflow-tooltip
  114. ></el-table-column>
  115. <el-table-column
  116. align="center"
  117. label="钱包余额"
  118. prop="amount"
  119. min-width="160"
  120. show-overflow-tooltip
  121. ></el-table-column>
  122. <el-table-column
  123. align="center"
  124. label="更新时间"
  125. prop="updateTime"
  126. min-width="160"
  127. show-overflow-tooltip
  128. ></el-table-column>
  129. <el-table-column
  130. align="center"
  131. label="操作"
  132. min-width="160"
  133. show-overflow-tooltip
  134. >
  135. <template v-slot="{ row }">
  136. <el-button type="text" class="textColor" @click="editFn(row)">
  137. 修改
  138. </el-button>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. </div>
  143. </div>
  144. <!-- 弹窗 -->
  145. <el-dialog
  146. title="配置返利比例"
  147. :visible.sync="dialogForm"
  148. width="30%"
  149. :show-close="false"
  150. :close-on-click-modal="false"
  151. >
  152. <el-form
  153. ref="addForm"
  154. :rules="rules"
  155. :model="addForm"
  156. label-width="100px"
  157. >
  158. <el-form-item label="返利比例" prop="rebateRate">
  159. <el-input
  160. v-model.number="addForm.rebateRate"
  161. oninput="if(value>100)value=100;if(value<0)value=0"
  162. ><i class="el-input__icon" slot="suffix">% </i></el-input
  163. >
  164. </el-form-item>
  165. </el-form>
  166. <div slot="footer" class="dialog-footer">
  167. <el-button @click="cancelFn">取 消</el-button>
  168. <el-button type="primary" @click="determineFn">确 定</el-button>
  169. </div>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import { mapGetters } from "vuex";
  175. import {
  176. getfinanceInit,
  177. getWalletRebateRateUpdate,
  178. } from "@/api/finance/wallet";
  179. import { getWalletCustomerList } from "@/api/finance/change_apply";
  180. export default {
  181. data() {
  182. return {
  183. listLoading: false, // 列表加载loading
  184. walletList: [],
  185. rebateList: [],
  186. addForm: {
  187. rebateRate: null,
  188. },
  189. dialogForm: false,
  190. rules: {
  191. rebateRate: [
  192. {
  193. required: true,
  194. message: "请输入返利比例",
  195. trigger: "blur",
  196. },
  197. ],
  198. },
  199. };
  200. },
  201. created() {
  202. console.log(this.$route.query.id, 11, this.customerId);
  203. if (this.$route.query.id) {
  204. this.getDataWallet({
  205. customerId: this.$route.query.id,
  206. type: "COMMONLY",
  207. });
  208. this.getDataRebate({
  209. customerId: this.$route.query.id,
  210. type: "REBATE",
  211. });
  212. } else {
  213. this.getDataWallet({
  214. customerId: this.customerId,
  215. type: "COMMONLY",
  216. });
  217. this.getDataRebate({
  218. customerId: this.customerId,
  219. type: "REBATE",
  220. });
  221. }
  222. },
  223. computed: {
  224. ...mapGetters(["customerId"]),
  225. },
  226. methods: {
  227. //取消
  228. async cancelFn() {
  229. this.dialogForm = false;
  230. await this.$refs.addForm.clearValidate();
  231. },
  232. //确定
  233. async determineFn() {
  234. await this.$refs.addForm.validate();
  235. const res = this.addForm.rebateRate / 100;
  236. this.addForm.rebateRate = res;
  237. await getWalletRebateRateUpdate({ ...this.addForm });
  238. if (this.$route.query.id) {
  239. this.getDataRebate({
  240. customerId: this.$route.query.id,
  241. type: "REBATE",
  242. });
  243. } else {
  244. this.getDataRebate({
  245. customerId: this.customerId,
  246. type: "REBATE",
  247. });
  248. }
  249. this.$message.success("修改成功");
  250. this.dialogForm = false;
  251. },
  252. //修改
  253. editFn(v) {
  254. this.addForm.customerWalletId = v.customerWalletId;
  255. this.addForm.rebateRate = v.rebateRate * 100;
  256. this.dialogForm = true;
  257. },
  258. //一键生成
  259. async generateFn() {
  260. await getfinanceInit({ customerId: this.customerId });
  261. this.getDataWallet();
  262. this.getDataRebate();
  263. this.$message.success("已生成");
  264. },
  265. //
  266. async getDataRebate(data) {
  267. let res = await getWalletCustomerList(data);
  268. this.rebateList = res.data;
  269. },
  270. async getDataWallet(data) {
  271. let res = await getWalletCustomerList(data);
  272. this.walletList = res.data;
  273. },
  274. },
  275. };
  276. </script>
  277. <style lang="scss" scoped>
  278. .styl {
  279. padding-top: 14px;
  280. }
  281. </style>