金币系统前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1600 lines
46 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
4 months ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
4 months ago
1 month ago
  1. <script setup>
  2. import { ref, onMounted, reactive, computed, watch, nextTick } from 'vue'
  3. import { ElMessage } from 'element-plus'
  4. import { Plus } from '@element-plus/icons-vue'
  5. import axios from 'axios'
  6. import { ElMessageBox } from 'element-plus'
  7. import API from '@/util/http'
  8. import moment from 'moment'
  9. import { range, re } from 'mathjs'
  10. import { utils, read } from 'xlsx'
  11. import throttle from 'lodash/throttle'
  12. // 精网号去空格
  13. const trimJwCode = () => {
  14. if (addRecharge.value.jwcode) {
  15. addRecharge.value.jwcode = addRecharge.value.jwcode.replace(/\s/g, '');
  16. }
  17. }
  18. // 上传图片前的验证函数
  19. const beforeAvatarUpload = (file) => {
  20. const isJPG = file.type === 'image/jpeg'
  21. const isPNG = file.type === 'image/png'
  22. const isLt2M = file.size / 1024 / 1024 < 2
  23. if (!isJPG && !isPNG) {
  24. ElMessage.error('上传头像图片只能是 JPG 或 PNG 格式!')
  25. }
  26. if (!isLt2M) {
  27. ElMessage.error('上传头像图片大小不能超过 2MB!')
  28. }
  29. return (isJPG || isPNG) && isLt2M
  30. }
  31. // 这是添加上传图片的接口
  32. const imageUrl = ref('')
  33. const rechargeVoucher = ref('')
  34. const Rate = ref()
  35. const adminData = ref({})
  36. const getAdminData = async function () {
  37. try {
  38. const result = await API({
  39. url: '/admin/userinfo',
  40. data: {}
  41. })
  42. adminData.value = result
  43. addRecharge.value.adminId = adminData.value.adminId
  44. addRecharge.value.area = adminData.value.area
  45. console.log('请求成功', result)
  46. console.log('用户信息', user.value)
  47. } catch (error) {
  48. console.log('请求失败', error)
  49. }
  50. }
  51. // 这是添加充值信息的表单
  52. const addRecharge = ref({
  53. rechargeVoucher: '',
  54. rechargeWay: '客服充值',
  55. freeGold: '0',
  56. rechargeGold: 0,
  57. paidGold: 0,
  58. Rate: null,
  59. rechargeRatio: '0'
  60. })
  61. // 这是添加充值信息的接口
  62. const add = async function () {
  63. try {
  64. console.log('开始添加充值信息', addRecharge.value)
  65. // 发送POST请求
  66. const result = await API({
  67. url: '/recharge/recharge/add',
  68. data: addRecharge.value
  69. })
  70. if (result.code === 0) {
  71. ElMessage.error(result.msg)
  72. return
  73. }
  74. // 将响应结果存储到响应式数据中
  75. console.log('请求成功', result)
  76. // 显示成功消息
  77. ElMessage.success('添加成功')
  78. // 重置表单
  79. addRecharge.value = {}
  80. addRecharge.value.adminId = adminData.value.adminId
  81. addRecharge.value.area = adminData.value.area
  82. addRecharge.value.rechargeVoucher = ''
  83. addRecharge.value.rechargeWay = '客服充值'
  84. addRecharge.value.freeGold = ''
  85. addRecharge.value.rechargeGold = 1
  86. addRecharge.value.paidGold = ''
  87. imageUrl.value = ''
  88. Rate.value = null
  89. user.value = {}
  90. } catch (error) {
  91. console.log('请求失败', error)
  92. // 在这里可以处理错误逻辑,比如显示错误提示等
  93. }
  94. }
  95. const addBefore = () => {
  96. Ref.value.validate(async (valid) => {
  97. if (valid) {
  98. ElMessageBox.confirm('确认添加?')
  99. .then(() => {
  100. add()
  101. console.log('添加成功')
  102. })
  103. .catch(() => {
  104. console.log('取消添加')
  105. })
  106. } else {
  107. //提示
  108. ElMessage({
  109. type: 'error',
  110. message: '请检查输入内容'
  111. })
  112. }
  113. })
  114. }
  115. // 表单验证
  116. // 开始时间改变时,重新验证结束时间
  117. const Ref = ref(null)
  118. // const checkFreeGoldRadio = function (rule, value, callback) {
  119. // if (value == "0" || value == null || value == "") {
  120. // callback(new Error("请输入永久金币"));
  121. // } else if (value < 0 || isNaN(value)) {
  122. // callback(new Error("请输入正确的格式"));
  123. // } else {
  124. // callback();
  125. // }
  126. // };
  127. const rules = reactive({
  128. jwcode: [{ required: true, message: '请输入精网号', trigger: 'blur' }],
  129. activityId: [{ required: true, message: '请选择活动名称', trigger: 'blur' }],
  130. paidGold: [
  131. { required: true, message: '请输入充值金额', trigger: 'blur' },
  132. {
  133. validator: (rule, value, callback) => {
  134. if (value > 0) {
  135. callback()
  136. } else {
  137. callback(new Error('请输入大于0的金额'))
  138. }
  139. }
  140. }
  141. ],
  142. // 必须进行选择
  143. rechargeGold: [
  144. {
  145. required: true,
  146. message: '请选择充值方式',
  147. trigger: 'blur'
  148. }
  149. ],
  150. payWay: [{ required: true, message: '请选择付款方式', trigger: 'blur' }],
  151. rechargeTime: [{ required: true, message: '请选择交款时间', trigger: 'blur' }]
  152. })
  153. // 查找客户信息的方法
  154. const user = ref({})
  155. const getUser = async function (jwcode) {
  156. trimJwCode();
  157. try {
  158. // 发送POST请求
  159. const result = await API({
  160. url: '/recharge/user',
  161. data: {
  162. jwcode: addRecharge.value.jwcode,
  163. area: adminData.value.area
  164. }
  165. })
  166. console.log('请求成功', result)
  167. if (result.code === 0) {
  168. ElMessage.error(result.msg)
  169. } else {
  170. user.value = result.data
  171. user.value.A =
  172. Number(user.value.pendingRechargeTimes) +
  173. Number(user.value.pendingSpendTimes)
  174. console.log('用户信息', user.value)
  175. ElMessage.success(result.msg)
  176. }
  177. } catch (error) {
  178. console.log('请求失败', error)
  179. ElMessage.error('查询失败,请检查精网号是否正确')
  180. // 在这里可以处理错误逻辑,比如显示错误提示等
  181. }
  182. }
  183. // 这是查询活动的接口
  184. const activity = ref([])
  185. const getActivity = async function () {
  186. try {
  187. // 发送POST请求
  188. const result = await API({
  189. url: '/recharge/activity/select',
  190. data: {
  191. activity: { status: 1 }
  192. }
  193. })
  194. // 将响应结果存储到响应式数据中
  195. console.log('请求成功', result)
  196. // 存储表格数据
  197. activity.value = result.data
  198. console.log('活动信息', activity.value)
  199. } catch (error) {
  200. console.log('请求失败', error)
  201. // 在这里可以处理错误逻辑,比如显示错误提示等
  202. }
  203. }
  204. // 这是查询货币的接口
  205. const currency = ref([])
  206. const getCurrency = async function () {
  207. try {
  208. // 发送POST请求
  209. const result = await API({
  210. url: '/rates/status',
  211. data: {}
  212. })
  213. // 将响应结果存储到响应式数据中
  214. console.log('货币请求成功', result)
  215. // 存储表格数据
  216. currency.value = result.data
  217. console.log('tableData', currency.value)
  218. // 在这里可以根据需求进一步处理成功后的逻辑,比如更新UI显示成功消息等
  219. } catch (error) {
  220. console.log('请求失败', error)
  221. // 在这里可以处理错误逻辑,比如显示错误提示等
  222. }
  223. }
  224. // 上传图片成功的回调函数
  225. const handleAvatarSuccess = (response, uploadFile) => {
  226. imageUrl.value = URL.createObjectURL(uploadFile.raw)
  227. console.log('图片上传成功', response, uploadFile)
  228. addRecharge.value.rechargeVoucher = `http://54.251.137.151:10702/upload/${response.data}`
  229. console.log('图片名称', addRecharge.value.rechargeVoucher)
  230. }
  231. //充值方式条目
  232. const options = [
  233. {
  234. value: '微信',
  235. label: '微信'
  236. },
  237. {
  238. value: '支付宝',
  239. label: '支付宝'
  240. },
  241. {
  242. value: '银联',
  243. label: '银联'
  244. },
  245. {
  246. value: '信用卡',
  247. label: '信用卡'
  248. },
  249. {
  250. value: '借记卡',
  251. label: '借记卡'
  252. },
  253. {
  254. value: '现金充值',
  255. label: '现金充值'
  256. }
  257. ]
  258. //根据活动id获取汇率
  259. const getActivityById = async function (row) {
  260. try {
  261. // 发送POST请求
  262. const result = await API({
  263. url: '/recharge/activity/select',
  264. data: {
  265. activity: { activityId: row }
  266. }
  267. })
  268. addRecharge.value.rechargeRatio = result.data[0].rechargeRatio
  269. console.log('看看有了吗', addRecharge.value.rechargeRatio)
  270. } catch (error) {
  271. console.log('请求失败', error)
  272. }
  273. }
  274. function handleActivityChange(value) {
  275. // 在这里执行你的逻辑,例如获取选中的值
  276. console.log('选中的值:', value)
  277. getActivityById(value)
  278. console.log('看看', addRecharge.value)
  279. }
  280. // 监听 paidGold 的变化
  281. const calculatedFree = computed(() => {
  282. const result = addRecharge.value.paidGold / addRecharge.value.rechargeRatio
  283. if (isNaN(result) || result < 1 || addRecharge.value.rechargeRatio == 0) {
  284. return 0
  285. } else {
  286. return Math.trunc(result)
  287. }
  288. })
  289. watch(calculatedFree, (newVal) => {
  290. addRecharge.value.freeGold = newVal
  291. })
  292. const calculatedRecharge = computed(() => {
  293. return addRecharge.value.paidGold * Rate.value
  294. })
  295. watch(calculatedRecharge, (newVal) => {
  296. addRecharge.value.rechargeGold = newVal
  297. })
  298. //这是重置重置表单的方法
  299. const deleteRecharge = function () {
  300. addRecharge.value = {
  301. adminId: adminData.value.adminId,
  302. area: adminData.value.area,
  303. rechargeVoucher: '',
  304. rechargeWay: '客服充值',
  305. freeGold: Number(0),
  306. rechargeGold: 0,
  307. paidGold: Number(0)
  308. }
  309. imageUrl.value = ''
  310. Rate.value = ''
  311. }
  312. // 批量充值
  313. // jwcode列表
  314. const jwcodeList = ref([])
  315. let jwcodeSet
  316. // 获取jwcode列表
  317. const getJwcodeList = async function () {
  318. try {
  319. // 发送POST请求
  320. const result = await API({
  321. url: '/recharge/user/jwcode',
  322. data: {
  323. jwcode: jwcode,
  324. area: adminData.value.area
  325. }
  326. })
  327. // 将响应结果存储到响应式数据中
  328. console.log('请求成功', result)
  329. // 存储表格数据
  330. jwcodeList.value = result.data
  331. console.log('精网号', jwcodeList.value)
  332. // 将数组转换为set
  333. jwcodeSet = new Set(jwcodeList.value)
  334. console.log('精网号set', jwcodeSet)
  335. } catch (error) {
  336. console.log('请求失败', error)
  337. // 在这里可以处理错误逻辑,比如显示错误提示等
  338. }
  339. }
  340. // 校验精网号
  341. // 精网号错误对象
  342. const errorCount = ref(0)
  343. // 校验规则
  344. const validateInput = function (row, index) {
  345. console.log(jwcodeSet.has(row.jwcode), 'has')
  346. if (!jwcodeSet.has(row.jwcode) && row.jwcode != '' && row.jwcode != null) {
  347. row.isInputInvalid = true
  348. row.inputErrorMessage = '精网号不存在'
  349. errorCount.value++
  350. return
  351. } else {
  352. row.isInputInvalid = false
  353. row.inputErrorMessage = ''
  354. errorCount.value--
  355. }
  356. }
  357. // 批量充值弹窗
  358. const batchRechargeVisible = ref(false)
  359. const i = ref(1)
  360. const delObj = ref({})
  361. const batchDelObj = ref([])
  362. const resetObj = ref({})
  363. // 批量充值表格数据
  364. const batchData = ref([
  365. {
  366. line: 1,
  367. showInput: true,
  368. isInputInvalid: false,
  369. inputErrorMessage: '',
  370. freeGold: '0',
  371. rechargeGold: '0',
  372. paidGold: '0'
  373. }
  374. ])
  375. // 打开批量充值弹窗
  376. const openBatchRechargeVisible = function () {
  377. batchRechargeVisible.value = true
  378. }
  379. // 关闭批量充值弹窗
  380. const closeBatchRechargeVisible = function () {
  381. batchRechargeVisible.value = false
  382. }
  383. // 批量充值初始化
  384. const batchInit = function () {
  385. openBatchRechargeVisible()
  386. }
  387. // 添加行数对象
  388. const addLineObj = ref(0)
  389. //添加一行
  390. const addLine = function () {
  391. batchData.value.unshift({
  392. line: ++i.value,
  393. showInput: true,
  394. isInputInvalid: false,
  395. inputErrorMessage: '',
  396. freeGold: '0',
  397. rechargeGold: '0',
  398. paidGold: '0'
  399. })
  400. }
  401. const loading = ref(false)
  402. // 添加多行
  403. const addLines = async function () {
  404. try {
  405. loading.value = true // 操作开始前,将loading设为true,显示加载动画
  406. console.log(loading.value, 'loading.value')
  407. await new Promise((resolve) => setTimeout(resolve, 100)) // 人为创建一个小延迟
  408. for (let j = 0; j < addLineObj.value; j++) {
  409. batchData.value.unshift({
  410. line: ++i.value,
  411. showInput: true,
  412. isInputInvalid: false,
  413. inputErrorMessage: '',
  414. freeGold: '0',
  415. rechargeGold: '0',
  416. paidGold: '0'
  417. })
  418. }
  419. ElMessage.success('添加成功')
  420. console.log(batchData.value, 'batchData.value')
  421. } catch (error) {
  422. console.log('添加失败', error)
  423. ElMessage.error('添加失败')
  424. } finally {
  425. loading.value = false
  426. console.log(loading.value, 'loading.value')
  427. }
  428. }
  429. // 添加多行点击按钮
  430. // const addLines = async function () {
  431. // try {
  432. // loading.value = true; // 操作开始前,将loading设为true,显示加载动画
  433. // console.log(loading.value, "loading.value")
  434. // await new Promise(resolve => setTimeout(resolve, 100)); // 人为创建一个小延迟
  435. // const newItems = Array.from({ length: addLineObj.value }, (_, index) => reactive({
  436. // line: ++i.value,
  437. // showInput: true,
  438. // isInputInvalid: false,
  439. // inputErrorMessage: '',
  440. // freeGold: "0",
  441. // rechargeGold: "0",
  442. // paidGold: "0",
  443. // }));
  444. // batchData.value = [...newItems, ...batchData.value];
  445. // ElMessage.success("添加成功");
  446. // console.log(batchData.value, "batchData.value");
  447. // loading.value = false;
  448. // console.log(loading.value, "loading.value")
  449. // } catch (error) {
  450. // console.log("添加失败", error);
  451. // ElMessage.error("添加失败");
  452. // // 如果出现异常,也要确保关闭加载动画
  453. // loading.value = false;
  454. // }
  455. // };
  456. // 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次
  457. const throttledAddLines = throttle(addLines, 500, { trailing: false })
  458. // 导入excel按钮的ref
  459. const uploadRefMap = ref({})
  460. // 获取excel数据
  461. const excelList = ref([])
  462. // 动态设置upload Ref
  463. const handleSetUploadRefMap = (el) => {
  464. if (el) {
  465. uploadRefMap.value[`Upload_Ref`] = el
  466. }
  467. }
  468. // 文件上传自定义
  469. const httpExcelRequest = async (op) => {
  470. // 获取除文件之外的参数,具体根据实际业务需求来
  471. console.log(op.data)
  472. // 获取上传的excel 并解析数据
  473. let file = op.file
  474. let dataBinary = await readFile(file)
  475. let workBook = read(dataBinary, { type: 'binary', cellDates: true })
  476. let workSheet = workBook.Sheets[workBook.SheetNames[0]]
  477. const excelData = utils.sheet_to_json(workSheet, { header: 1 })
  478. excelList.value = excelData
  479. console.log(excelData)
  480. }
  481. const readFile = (file) => {
  482. return new Promise((resolve) => {
  483. let reader = new FileReader()
  484. reader.readAsBinaryString(file)
  485. reader.onload = (ev) => {
  486. resolve(ev.target?.result)
  487. }
  488. })
  489. }
  490. //获取批量删除的数组
  491. const handleSelectionChangebatch = function (val) {
  492. console.log('val===', val)
  493. batchDelObj.value = val
  494. }
  495. //批量删除
  496. const batchDel = function () {
  497. ElMessageBox.confirm('确认批量删除吗?', '批量删除', {
  498. confirmButtonText: '确定',
  499. cancelButtonText: '取消',
  500. type: 'warning'
  501. })
  502. .then(() => {
  503. console.log('batchDel===', batchDelObj.value)
  504. batchData.value = batchData.value.filter((itemA) => {
  505. return !batchDelObj.value.some((itemB) => itemB.line == itemA.line)
  506. })
  507. console.log('batchData===', batchData.value)
  508. ElMessage({
  509. type: 'success',
  510. message: '操作成功'
  511. })
  512. })
  513. .catch(() => {
  514. ElMessage({
  515. type: 'info',
  516. message: '操作撤销'
  517. })
  518. })
  519. }
  520. //单行删除初始化
  521. const del = function (row) {
  522. console.log('row===', row)
  523. delObj.value.line = row.line
  524. }
  525. // 单行删除
  526. const delConfirm = function () {
  527. batchData.value = batchData.value.filter(
  528. (item) => item.line != delObj.value.line
  529. )
  530. console.log('batchData===', batchData.value)
  531. }
  532. //单行重置初始化
  533. const reset = function (row) {
  534. resetObj.value.line = row.line
  535. }
  536. // 单行重置
  537. const resetConfirm = function () {
  538. for (let i = 0; i < batchData.value.length; i++) {
  539. if (batchData.value[i].line == resetObj.value.line) {
  540. batchData.value[i] = {}
  541. batchData.value[i].line = resetObj.value.line
  542. batchData.value[i].showInput = true
  543. break
  544. }
  545. }
  546. }
  547. //取消批量充值
  548. const cancelBatch = function () {
  549. ElMessageBox.confirm('确认取消吗?此操作将不会保存任何数据。', '确认取消', {
  550. confirmButtonText: '确定',
  551. cancelButtonText: '取消',
  552. type: 'warning'
  553. })
  554. .then(() => {
  555. batchData.value = [{ line: 1, showInput: true }]
  556. closeBatchRechargeVisible()
  557. ElMessage({
  558. type: 'success',
  559. message: '操作成功'
  560. })
  561. })
  562. .catch(() => {
  563. ElMessage({
  564. type: 'info',
  565. message: '操作撤销'
  566. })
  567. })
  568. }
  569. //监听改变活动时的操作
  570. const changeActivity = function (row) {
  571. console.log('row===', row)
  572. let ratio = 0
  573. for (let i = 0; i < activity.value.length; i++) {
  574. if (activity.value[i].activityId == row.activityId) {
  575. ratio = activity.value[i].rechargeRatio
  576. break
  577. }
  578. }
  579. console.log('ratio===', ratio)
  580. if (row.paidGold == null || row.paidGold == '') {
  581. row.freeGold = 0
  582. } else {
  583. if (ratio == 0) {
  584. row.freeGold = 0
  585. } else {
  586. row.freeGold = Math.ceil(row.paidGold / ratio)
  587. }
  588. }
  589. }
  590. //监听改变永久金币时的操作
  591. const changePaidGold = function (row) {
  592. console.log('row===', row)
  593. let ratio = 0
  594. if (row.activityId == null || row.activityId == '') {
  595. row.freeGold = 0
  596. } else {
  597. for (let i = 0; i < activity.value.length; i++) {
  598. if (activity.value[i].activityId == row.activityId) {
  599. ratio = activity.value[i].rechargeRatio
  600. break
  601. }
  602. }
  603. if (ratio == 0) {
  604. row.freeGold = 0
  605. } else {
  606. row.freeGold = Math.ceil(Number(row.paidGold) / ratio)
  607. }
  608. }
  609. let rate = row.rate
  610. if (rate == null || rate == '') {
  611. row.rechargeGold = 0
  612. } else {
  613. if (row.paidGold == null || row.paidGold == '') {
  614. row.rechargeGold = 0
  615. } else {
  616. row.rechargeGold = Math.ceil(Number(row.paidGold) * rate)
  617. }
  618. }
  619. }
  620. // 监听改变币种时的操作
  621. const changeRate = function (row) {
  622. console.log('row===', row)
  623. let rate = row.rate
  624. if (rate == null || rate == '') {
  625. row.rechargeGold = 0
  626. } else {
  627. if (row.paidGold == null || row.paidGold == '') {
  628. row.rechargeGold = 0
  629. } else {
  630. row.rechargeGold = Math.ceil(Number(row.paidGold) * rate)
  631. }
  632. }
  633. }
  634. //监听改变凭证时的操作
  635. const changeVoucher = function (row) {
  636. if (
  637. (imageUrl.value != '' && rechargeVoucher.value != '') ||
  638. (imageUrl.value != null && rechargeVoucher.value != null)
  639. ) {
  640. console.log('row===', row)
  641. row.imageUrl = imageUrl.value
  642. row.rechargeVoucher = rechargeVoucher.value
  643. console.log('row===', row)
  644. imageUrl.value = ''
  645. rechargeVoucher.value = ''
  646. }
  647. }
  648. // 上传图片成功的回调函数
  649. const handleBatchAvatarSuccess = (response, uploadFile) => {
  650. imageUrl.value = URL.createObjectURL(uploadFile.raw)
  651. console.log('图片上传成功', response, uploadFile)
  652. rechargeVoucher.value = `http://54.251.137.151:10702/upload/${response.data}`
  653. console.log('图片名称', rechargeVoucher.value)
  654. }
  655. //批量充值确认按钮
  656. const batchAdd = async function () {
  657. try {
  658. console.log('batchData===', batchData.value)
  659. let msg = ''
  660. if (batchData.value.length == 0) {
  661. ElMessage({
  662. type: 'error',
  663. message: '至少需要输入一条数据!'
  664. })
  665. return
  666. }
  667. if (errorCount.value > 0) {
  668. console.log('errorCount.value', errorCount.value)
  669. ElMessage({
  670. type: 'error',
  671. message: '请检查输入的精网号是否正确!'
  672. })
  673. return
  674. }
  675. for (let i = 0; i < batchData.value.length; i++) {
  676. batchData.value[i].adminId = adminData.value.adminId
  677. batchData.value[i].area = adminData.value.area
  678. batchData.value[i].rechargeWay = '客服充值'
  679. if (
  680. batchData.value[i].jwcode == '' ||
  681. batchData.value[i].jwcode == null
  682. ) {
  683. msg += `精网号不能为空! <br/>`
  684. }
  685. if (
  686. batchData.value[i].activityId == '' ||
  687. batchData.value[i].activityId == null
  688. ) {
  689. msg += `活动不能为空! <br/>`
  690. }
  691. if (
  692. batchData.value[i].paidGold == '' ||
  693. batchData.value[i].paidGold == null
  694. ) {
  695. msg += `永久金币不能为空! <br/>`
  696. }
  697. if (
  698. batchData.value[i].freeGold == '' ||
  699. batchData.value[i].freeGold == null
  700. ) {
  701. msg += `免费金币不能为空! <br/>`
  702. }
  703. if (
  704. batchData.value[i].rechargeGold == '' ||
  705. batchData.value[i].rechargeGold == null
  706. ) {
  707. msg += `充值金额不能为空! <br/>`
  708. }
  709. if (
  710. batchData.value[i].payWay == '' ||
  711. batchData.value[i].payWay == null
  712. ) {
  713. msg += `收款方式不能为空! <br/>`
  714. }
  715. if (
  716. batchData.value[i].rechargeTime == '' ||
  717. batchData.value[i].rechargeTime == null
  718. ) {
  719. msg += `交款时间不能为空! <br/>`
  720. }
  721. if (msg != '' && msg != null) {
  722. console.log(batchData.value[i])
  723. ElMessage({
  724. dangerouslyUseHTMLString: true,
  725. type: 'error',
  726. message: msg
  727. })
  728. return
  729. }
  730. }
  731. console.log('batchData===', batchData.value)
  732. const result = await API({
  733. url: '/recharge/recharge/addmore',
  734. data: {
  735. ...batchData.value
  736. }
  737. })
  738. if (result.code === 0) {
  739. ElMessage.error('添加失败')
  740. return
  741. }
  742. ElMessage({
  743. type: 'success',
  744. message: '添加成功!'
  745. })
  746. closeBatchRechargeVisible()
  747. } catch (error) {
  748. console.log('error===', error)
  749. ElMessage.error('添加失败')
  750. return
  751. }
  752. }
  753. // 使用 _.throttle 并设置 trailing 为 false 实现严格节流,只执行一次
  754. const throttledBatchAdd = throttle(batchAdd, 2000, { trailing: false })
  755. // 批量设置的对象
  756. const batchSettingObj = ref({
  757. rechargeGold: '0',
  758. paidGold: '0',
  759. freeGold: '0'
  760. })
  761. // 批量充值弹窗
  762. const batchSettingVisible = ref(false)
  763. // 打开批量充值弹窗
  764. const openBatchSettingVisible = function () {
  765. batchSettingVisible.value = true
  766. }
  767. // 关闭批量充值弹窗
  768. const closeBatchSettingVisible = function () {
  769. batchSettingVisible.value = false
  770. }
  771. // 批量设置初始化
  772. const batchSettingInit = function () {
  773. openBatchSettingVisible()
  774. }
  775. // 上传图片成功的回调函数
  776. const batchSettingHandleAvatarSuccess = (response, uploadFile) => {
  777. batchSettingObj.value.imageUrl = URL.createObjectURL(uploadFile.raw)
  778. console.log('图片上传成功', response, uploadFile)
  779. batchSettingObj.value.rechargeVoucher = `http://54.251.137.151:10702/upload/${response.data}`
  780. console.log('图片名称', batchSettingObj.value.rechargeVoucher)
  781. }
  782. // 批量设置取消按钮
  783. const cancelBatchSetting = function () {
  784. batchSettingObj.value = {
  785. rechargeGold: '0',
  786. paidGold: '0',
  787. freeGold: '0'
  788. }
  789. closeBatchSettingVisible()
  790. }
  791. // 批量设置确认按钮
  792. const batchSettingConfirm = function () {
  793. for (let i = 0; i < batchData.value.length; i++) {
  794. if (
  795. batchSettingObj.value.jwcode != '' &&
  796. batchSettingObj.value.jwcode != null
  797. ) {
  798. batchData.value[i].jwcode = batchSettingObj.value.jwcode
  799. }
  800. if (
  801. batchSettingObj.value.activityId != '' &&
  802. batchSettingObj.value.activityId != null
  803. ) {
  804. batchData.value[i].activityId = batchSettingObj.value.activityId
  805. }
  806. if (
  807. batchSettingObj.value.paidGold != '' &&
  808. batchSettingObj.value.paidGold != null
  809. ) {
  810. batchData.value[i].paidGold = batchSettingObj.value.paidGold
  811. }
  812. if (
  813. batchSettingObj.value.freeGold != '' &&
  814. batchSettingObj.value.freeGold != null
  815. ) {
  816. batchData.value[i].freeGold = batchSettingObj.value.freeGold
  817. }
  818. if (
  819. batchSettingObj.value.rate != '' &&
  820. batchSettingObj.value.rate != null
  821. ) {
  822. batchData.value[i].rate = batchSettingObj.value.rate
  823. }
  824. if (
  825. batchSettingObj.value.rechargeGold != '' &&
  826. batchSettingObj.value.rechargeGold != null
  827. ) {
  828. batchData.value[i].rechargeGold = batchSettingObj.value.rechargeGold
  829. }
  830. if (
  831. batchSettingObj.value.payWay != '' &&
  832. batchSettingObj.value.payWay != null
  833. ) {
  834. batchData.value[i].payWay = batchSettingObj.value.payWay
  835. }
  836. if (
  837. batchSettingObj.value.rechargeTime != '' &&
  838. batchSettingObj.value.rechargeTime != null
  839. ) {
  840. batchData.value[i].rechargeTime = batchSettingObj.value.rechargeTime
  841. }
  842. if (
  843. batchSettingObj.value.imageUrl != '' &&
  844. batchSettingObj.value.imageUrl != null
  845. ) {
  846. batchData.value[i].imageUrl = batchSettingObj.value.imageUrl
  847. }
  848. if (
  849. batchSettingObj.value.rechargeVoucher != '' &&
  850. batchSettingObj.value.rechargeVoucher != null
  851. ) {
  852. batchData.value[i].rechargeVoucher = batchSettingObj.value.rechargeVoucher
  853. }
  854. if (
  855. batchSettingObj.value.remark != '' &&
  856. batchSettingObj.value.remark != null
  857. ) {
  858. batchData.value[i].remark = batchSettingObj.value.remark
  859. }
  860. }
  861. batchSettingObj.value = {
  862. rechargeGold: '0',
  863. paidGold: '0',
  864. freeGold: '0'
  865. }
  866. closeBatchSettingVisible()
  867. }
  868. // 挂载
  869. onMounted(async function () {
  870. await getAdminData()
  871. await getCurrency()
  872. await getActivity()
  873. await getJwcodeList()
  874. })
  875. </script>
  876. <template>
  877. <div style="display: flex">
  878. <div style="margin-right: 20px">新增充值</div>
  879. <!-- <el-button type="primary" plain @click="batchInit()">批量充值</el-button> -->
  880. </div>
  881. <el-form
  882. :model="addRecharge"
  883. ref="Ref"
  884. :rules="rules"
  885. label-width="auto"
  886. style="max-width: 600px"
  887. class="add-form"
  888. >
  889. <el-form-item prop="jwcode" label="精网号">
  890. <el-input v-model="addRecharge.jwcode" style="width: 220px" />
  891. <el-button
  892. type="primary"
  893. @click="getUser(addRecharge.jwcode)"
  894. style="margin-left: 20px"
  895. >查询</el-button
  896. >
  897. </el-form-item>
  898. <el-form-item prop="activityId" label="活动名称">
  899. <el-select
  900. v-model="addRecharge.activityId"
  901. placeholder="请选择"
  902. style="width: 300px"
  903. @change="handleActivityChange"
  904. >
  905. <el-option
  906. v-for="item in activity"
  907. :key="item.value"
  908. :label="item.activityName"
  909. :value="item.activityId"
  910. />
  911. </el-select>
  912. </el-form-item>
  913. <el-form-item prop="paidGold" label="永久金币">
  914. <el-input v-model="addRecharge.paidGold" style="width: 100px" />
  915. <p style="margin-right: 20px"></p>
  916. <p>免费金币</p>
  917. <el-input v-model="addRecharge.freeGold" style="width: 100px" />
  918. <p></p>
  919. </el-form-item>
  920. <el-form-item prop="rechargeGold" label="充值金额">
  921. <el-select
  922. prop="rechargeGold"
  923. v-model="Rate"
  924. placeholder="货币名称"
  925. style="width: 95px; margin-right: 5px"
  926. >
  927. <el-option
  928. v-for="item in currency"
  929. :key="item.value"
  930. :label="item.currency"
  931. :value="item.exchangeRate"
  932. />
  933. </el-select>
  934. <el-input v-model="addRecharge.rechargeGold" style="width: 200px" />
  935. </el-form-item>
  936. <el-form-item prop="payWay" label="收款方式">
  937. <el-select
  938. v-model="addRecharge.payWay"
  939. placeholder="请选择"
  940. style="width: 300px"
  941. >
  942. <el-option
  943. v-for="item in options"
  944. :key="item.value"
  945. :label="item.label"
  946. :value="item.value"
  947. />
  948. </el-select>
  949. </el-form-item>
  950. <el-form-item prop="rechargeTime" label="交款时间">
  951. <!-- 修改 type 属性为 datetime 以支持时分秒选择 -->
  952. <el-date-picker
  953. v-model="addRecharge.rechargeTime"
  954. type="datetime"
  955. style="width: 300px"
  956. />
  957. </el-form-item>
  958. <el-form-item
  959. prop="rechargeVoucher"
  960. label="交款凭证"
  961. style="margin-bottom: 5px"
  962. >
  963. <el-upload
  964. action="http://54.251.137.151:10702/upload"
  965. class="avatar-uploader"
  966. :show-file-list="false"
  967. :on-success="handleAvatarSuccess"
  968. :before-upload="beforeAvatarUpload"
  969. style="width: 100px; height: 115px"
  970. >
  971. <img
  972. v-if="imageUrl"
  973. :src="imageUrl"
  974. class="avatar"
  975. style="width: 100px; height: 115px"
  976. />
  977. <el-icon
  978. v-else
  979. class="avatar-uploader-icon"
  980. style="width: 100px; height: 100px"
  981. >
  982. <Plus />
  983. </el-icon>
  984. </el-upload>
  985. <p style="margin-left: 10px; color: rgb(177, 176, 176)">
  986. 仅支持.jpg .png格式文件1MB
  987. </p>
  988. </el-form-item>
  989. <el-form-item prop="remark" label="备注">
  990. <el-input
  991. v-model="addRecharge.remark"
  992. style="width: 300px"
  993. :rows="2"
  994. maxlength="100"
  995. show-word-limit
  996. type="textarea"
  997. />
  998. </el-form-item>
  999. <el-form-item prop="submitter" label="提交人">
  1000. <el-input
  1001. style="width: 300px"
  1002. :value="adminData.name"
  1003. disabled
  1004. placeholder="提交人姓名"
  1005. />
  1006. </el-form-item>
  1007. <el-button @click="deleteRecharge" style="margin-left: 280px"
  1008. >重置</el-button
  1009. >
  1010. <el-button type="primary" @click="addBefore"> 提交 </el-button>
  1011. </el-form>
  1012. <!-- 客户信息栏 -->
  1013. <el-card
  1014. style="width: 1200px; float: right"
  1015. class="customer-info"
  1016. width="3000px"
  1017. >
  1018. <el-form
  1019. :model="user"
  1020. label-width="auto"
  1021. style="max-width: 1200px"
  1022. label-position="left"
  1023. >
  1024. <el-text size="large" style="margin-left: 20px">客户信息</el-text>
  1025. <el-row style="margin-top: 20px">
  1026. <el-col :span="10">
  1027. <el-form-item label="姓名:">
  1028. <p>{{ user.name }}</p>
  1029. </el-form-item>
  1030. </el-col>
  1031. <el-col :span="14">
  1032. <el-form-item label="历史金币总数">
  1033. <!-- 检查 user.totalRechargeGold 是否为有效的数字 -->
  1034. <p v-if="!isNaN(Number(user.totalRechargeGold))">
  1035. {{ Number(user.totalRechargeGold / 100) }}
  1036. </p>
  1037. <!-- 如果不是有效的数字显示默认值 -->
  1038. <p v-else></p>
  1039. </el-form-item>
  1040. </el-col>
  1041. <el-col :span="10">
  1042. <el-form-item label="精网号">
  1043. <p>{{ user.jwcode }}</p>
  1044. </el-form-item>
  1045. </el-col>
  1046. <el-col :span="14">
  1047. <el-form-item label="当前金币总数" style="width: 500px">
  1048. <span
  1049. style="color: #2fa1ff; margin-right: 5px"
  1050. v-if="user.buyJb !== undefined"
  1051. >{{
  1052. (user.buyJb + user.free6 + user.free12 + user.coreJb) / 100
  1053. }}</span
  1054. >
  1055. <span
  1056. style="display: inline; white-space: nowrap; color: #b1b1b1"
  1057. v-if="user.buyJb !== undefined"
  1058. >(永久金币:{{ user.buyJb / 100 }};免费金币:{{
  1059. (user.free6 + user.free12) / 100
  1060. }};任务金币:{{ user.coreJb / 100 }})</span
  1061. >
  1062. </el-form-item>
  1063. </el-col>
  1064. <el-col :span="10">
  1065. <el-form-item label="首次充值日期">
  1066. <p v-if="user.firstRechargeDate">
  1067. {{ moment(user.firstRechargeDate).format('YYYY-MM-DD HH:mm:ss') }}
  1068. </p>
  1069. </el-form-item>
  1070. </el-col>
  1071. <el-col :span="14">
  1072. <el-form-item label="充值次数">
  1073. <p style="color: #2fa1ff">{{ user.rechargeTimes }}</p>
  1074. </el-form-item>
  1075. </el-col>
  1076. <el-col :span="10">
  1077. <el-form-item label="负责客服">
  1078. <p>{{ adminData.name }}</p>
  1079. </el-form-item>
  1080. </el-col>
  1081. <el-col :span="14">
  1082. <el-form-item label="消费次数">
  1083. <p style="color: #2fa1ff">{{ user.spendTimes }}</p>
  1084. </el-form-item>
  1085. </el-col>
  1086. <el-col :span="10">
  1087. <el-form-item label="所属门店">
  1088. <p>{{ adminData.area }}</p>
  1089. </el-form-item>
  1090. </el-col>
  1091. <el-col :span="14">
  1092. <!-- <el-form-item label="待审核">
  1093. <p style="color: #2fa1ff">
  1094. {{ user.A }}
  1095. </p>
  1096. </el-form-item> -->
  1097. </el-col>
  1098. </el-row>
  1099. </el-form>
  1100. </el-card>
  1101. <el-dialog
  1102. v-model="batchRechargeVisible"
  1103. title="批量充值"
  1104. width="1800px"
  1105. style="height: 700px"
  1106. :close-on-click-modal="false"
  1107. >
  1108. <el-row style="margin-bottom: 10px">
  1109. <!-- <el-button type="primary" @click="addLine()" style="margin-right: 10px">新增一行</el-button> -->
  1110. <div style="font-weight: bold; font-size: 20px">
  1111. <span>添加</span>
  1112. <el-input-number
  1113. min="1"
  1114. style="width: 100px"
  1115. controls-position="right"
  1116. v-model="addLineObj"
  1117. ></el-input-number>
  1118. <span></span>
  1119. <el-button
  1120. type="primary"
  1121. @click="throttledAddLines"
  1122. style="margin-right: 10px"
  1123. >添加</el-button
  1124. >
  1125. </div>
  1126. <el-button
  1127. type="warning"
  1128. @click="batchSettingInit()"
  1129. style="margin-right: 10px"
  1130. >批量设置</el-button
  1131. >
  1132. <!-- <el-upload :ref="(el) => handleSetUploadRefMap(el)" action="" :http-request="httpExcelRequest" :limit="1" :show-file-list="false"
  1133. class="uploadExcelContent" :data={} style="margin-right: auto">
  1134. <el-button type="success" >导入jwcode</el-button>
  1135. </el-upload> -->
  1136. <el-button
  1137. type="danger"
  1138. plain
  1139. @click="batchDel()"
  1140. style="margin-right: 10px; width: 130px"
  1141. >批量删除</el-button
  1142. >
  1143. </el-row>
  1144. <el-row>
  1145. <el-table
  1146. v-loading="loading"
  1147. :data="batchData"
  1148. border
  1149. max-height="540px"
  1150. style="height: 540px"
  1151. @selection-change="handleSelectionChangebatch"
  1152. >
  1153. <el-table-column type="selection" width="50px" />
  1154. <el-table-column property="index" label="序号" width="55px">
  1155. <template #default="scope">
  1156. <span>{{ scope.$index + 1 }}</span>
  1157. </template>
  1158. </el-table-column>
  1159. <el-table-column property="jwcode" label="精网号" width="150px">
  1160. <template #default="scope">
  1161. <el-input
  1162. v-if="scope.row.showInput"
  1163. :class="{ 'is-invalid': scope.row.isInputInvalid }"
  1164. @blur="validateInput(scope.row)"
  1165. v-model="scope.row.jwcode"
  1166. style="width: 110px"
  1167. />
  1168. <p v-if="scope.row.isInputInvalid" class="error-message">
  1169. {{ scope.row.inputErrorMessage }}
  1170. </p>
  1171. </template>
  1172. <!-- <template #default="scope">
  1173. <el-select-v2 v-if="scope.row.showInput" filterable clearable v-model="scope.row.jwcode"
  1174. placeholder="请选择精网号" style="widows: 110px;" :options="jwcodeList">
  1175. <el-select-v2
  1176. v-if="scope.row.showInput"
  1177. filterable
  1178. clearable
  1179. v-model="scope.row.jwcode"
  1180. placeholder="请选择精网号"
  1181. style="widows: 110px"
  1182. :options="jwcodeList"
  1183. >
  1184. </el-select-v2>
  1185. <span v-else>{{ scope.row.jwcode }}</span>
  1186. </template> -->
  1187. </el-table-column>
  1188. <el-table-column property="activityName" label="活动名称" width="150px">
  1189. <template #default="scope">
  1190. <el-select
  1191. v-if="scope.row.showInput"
  1192. filterable
  1193. clearable
  1194. v-model="scope.row.activityId"
  1195. placeholder="请选择活动名称"
  1196. @change="changeActivity(scope.row)"
  1197. >
  1198. <el-option
  1199. v-for="item in activity"
  1200. :key="item.activityId"
  1201. :label="item.activityName"
  1202. :value="item.activityId"
  1203. >
  1204. </el-option>
  1205. </el-select>
  1206. <span v-else>{{ scope.row.activityName }}</span>
  1207. </template>
  1208. </el-table-column>
  1209. <el-table-column property="paidGold" label="永久金币" width="110px">
  1210. <template #default="scope">
  1211. <el-input
  1212. v-if="scope.row.showInput"
  1213. v-model="scope.row.paidGold"
  1214. style="width: 70px"
  1215. @change="changePaidGold(scope.row)"
  1216. />
  1217. <span v-else>{{ scope.row.paidGold }}</span>
  1218. </template>
  1219. </el-table-column>
  1220. <el-table-column property="freeGold" label="免费金币" width="110px">
  1221. <template #default="scope">
  1222. <el-input
  1223. v-if="scope.row.showInput"
  1224. v-model="scope.row.freeGold"
  1225. style="width: 70px"
  1226. />
  1227. <span v-else>{{ scope.row.freeGold }}</span>
  1228. </template>
  1229. </el-table-column>
  1230. <el-table-column property="rate" label="货币名称">
  1231. <template #default="scope">
  1232. <el-select
  1233. v-if="scope.row.showInput"
  1234. filterable
  1235. clearable
  1236. v-model="scope.row.rate"
  1237. placeholder="请选择币种"
  1238. @change="changeRate(scope.row)"
  1239. >
  1240. <el-option
  1241. v-for="item in currency"
  1242. :key="item.exchangeRate"
  1243. :label="item.currency"
  1244. :value="item.exchangeRate"
  1245. >
  1246. </el-option>
  1247. </el-select>
  1248. <span v-else>{{ scope.row.rate }}</span>
  1249. </template>
  1250. </el-table-column>
  1251. <el-table-column property="rechargeGold" label="充值金额" width="110px">
  1252. <template #default="scope">
  1253. <el-input v-model="scope.row.rechargeGold"></el-input>
  1254. </template>
  1255. </el-table-column>
  1256. <el-table-column property="payWay" label="收款方式" width="130px">
  1257. <template #default="scope">
  1258. <el-select
  1259. v-if="scope.row.showInput"
  1260. filterable
  1261. clearable
  1262. v-model="scope.row.payWay"
  1263. placeholder="请选择收款方式"
  1264. >
  1265. <el-option
  1266. v-for="item in options"
  1267. :key="item.value"
  1268. :label="item.label"
  1269. :value="item.value"
  1270. >
  1271. </el-option>
  1272. </el-select>
  1273. <span v-else>{{ scope.row.payWay }}</span>
  1274. </template>
  1275. </el-table-column>
  1276. <el-table-column property="rechargeTime" label="交款时间" width="150px">
  1277. <template #default="scope">
  1278. <el-date-picker
  1279. v-if="scope.row.showInput"
  1280. type="date"
  1281. v-model="scope.row.rechargeTime"
  1282. style="width: 120px"
  1283. placeholder="请选择交款时间"
  1284. >
  1285. </el-date-picker>
  1286. <span v-else>{{
  1287. moment(scope.row.rechargeTime).format('YYYY-MM-DD HH:mm:ss')
  1288. }}</span>
  1289. </template>
  1290. </el-table-column>
  1291. <el-table-column property="rechargeVoucher" label="充值凭证">
  1292. <template #default="scope">
  1293. <el-upload
  1294. action="http://54.251.137.151:10702/upload"
  1295. class="avatar-uploader"
  1296. :show-file-list="false"
  1297. :on-success="handleBatchAvatarSuccess"
  1298. v-if="scope.row.showInput"
  1299. @change="changeVoucher(scope.row)"
  1300. >
  1301. <img
  1302. v-if="scope.row.imageUrl"
  1303. :src="scope.row.imageUrl"
  1304. class="avatar"
  1305. />
  1306. <el-icon v-else class="avatar-uploader-icon">
  1307. <Plus />
  1308. </el-icon>
  1309. </el-upload>
  1310. <span v-else>{{ scope.row.rechargeVoucher }}</span>
  1311. </template>
  1312. </el-table-column>
  1313. <el-table-column property="remark" label="备注" width="130px">
  1314. <template #default="scope">
  1315. <el-input
  1316. type="textarea"
  1317. v-if="scope.row.showInput"
  1318. v-model="scope.row.remark"
  1319. style="max-width: 90px"
  1320. :rows="1"
  1321. cols="12"
  1322. ></el-input>
  1323. <span v-else>{{ scope.row.remark }}</span>
  1324. </template>
  1325. </el-table-column>
  1326. <el-table-column property="submitter" label="提交人">
  1327. <el-input :value="adminData.name" disabled />
  1328. </el-table-column>
  1329. <el-table-column
  1330. fixed="right"
  1331. prop="operation"
  1332. label="操作"
  1333. width="150px"
  1334. >
  1335. <template #default="scope">
  1336. <div style="display: flex">
  1337. <el-popconfirm
  1338. title="确定将此条信息删除吗?"
  1339. @confirm="delConfirm"
  1340. >
  1341. <template #reference>
  1342. <el-button type="danger" text @click="del(scope.row)">
  1343. 删除
  1344. </el-button>
  1345. </template>
  1346. <template #actions="{ confirm, cancel }">
  1347. <el-button size="small" @click="cancel">取消</el-button>
  1348. <el-button type="primary" size="small" @click="confirm">
  1349. 确定
  1350. </el-button>
  1351. </template>
  1352. </el-popconfirm>
  1353. <el-popconfirm
  1354. title="确定将此条信息重置吗?"
  1355. @confirm="resetConfirm"
  1356. >
  1357. <template #reference>
  1358. <el-button type="primary" text @click="reset(scope.row)">
  1359. 重置
  1360. </el-button>
  1361. </template>
  1362. <template #actions="{ confirm, cancel }">
  1363. <el-button size="small" @click="cancel">取消</el-button>
  1364. <el-button type="primary" size="small" @click="confirm">
  1365. 确定
  1366. </el-button>
  1367. </template>
  1368. </el-popconfirm>
  1369. </div>
  1370. </template>
  1371. </el-table-column>
  1372. </el-table>
  1373. </el-row>
  1374. <el-row>
  1375. <div class="batch-btn">
  1376. <el-button @click="cancelBatch()"> 取消 </el-button>
  1377. <el-button type="primary" @click="throttledBatchAdd()">
  1378. 提交
  1379. </el-button>
  1380. </div>
  1381. </el-row>
  1382. </el-dialog>
  1383. <el-dialog
  1384. v-model="batchSettingVisible"
  1385. title="批量设置"
  1386. :close-on-click-modal="false"
  1387. style="width: 550px"
  1388. >
  1389. <el-form label-position="left" label-width="auto">
  1390. <el-form-item label="活动名称">
  1391. <el-select
  1392. v-model="batchSettingObj.activityId"
  1393. placeholder="请选择活动名称"
  1394. clearable
  1395. >
  1396. <el-option
  1397. v-for="item in activity"
  1398. :key="item.activityId"
  1399. :label="item.activityName"
  1400. :value="item.activityId"
  1401. >
  1402. </el-option>
  1403. </el-select>
  1404. </el-form-item>
  1405. <el-form-item label="永久金币">
  1406. <el-input
  1407. v-model="batchSettingObj.paidGold"
  1408. placeholder="请输入永久金币"
  1409. ></el-input>
  1410. </el-form-item>
  1411. <el-form-item label="免费金币">
  1412. <el-input v-model="batchSettingObj.freeGold"></el-input>
  1413. </el-form-item>
  1414. <el-form-item label="充值金额">
  1415. <div style="display: flex">
  1416. <el-select
  1417. v-model="batchSettingObj.rate"
  1418. placeholder="请选择币种"
  1419. style="width: 120px; margin-right: 10px"
  1420. clearable
  1421. >
  1422. <el-option
  1423. v-for="item in currency"
  1424. :key="item.exchangeRate"
  1425. :label="item.currency"
  1426. :value="item.exchangeRate"
  1427. ></el-option>
  1428. </el-select>
  1429. <el-input
  1430. v-model="batchSettingObj.rechargeGold"
  1431. placeholder="请输入充值金额"
  1432. ></el-input>
  1433. </div>
  1434. </el-form-item>
  1435. <el-form-item prop="payWay" label="收款方式">
  1436. <el-select
  1437. v-model="batchSettingObj.payWay"
  1438. placeholder="请选择收款方式"
  1439. clearable
  1440. >
  1441. <el-option
  1442. v-for="item in options"
  1443. :key="item.value"
  1444. :label="item.label"
  1445. :value="item.value"
  1446. ></el-option>
  1447. </el-select>
  1448. </el-form-item>
  1449. <el-form-item prop="rechargeTime" label="交款时间">
  1450. <el-date-picker
  1451. v-model="batchSettingObj.rechargeTime"
  1452. type="date"
  1453. placeholder="请选择交款时间"
  1454. ></el-date-picker>
  1455. </el-form-item>
  1456. <el-form-item prop="rechargeVoucher" label="交款凭证">
  1457. <el-upload
  1458. action="http://54.251.137.151:10702/upload"
  1459. class="avatar-uploader"
  1460. :show-file-list="false"
  1461. :on-success="batchSettingHandleAvatarSuccess"
  1462. :before-upload="beforeAvatarUpload"
  1463. style="width: 100px; height: 115px"
  1464. >
  1465. <img
  1466. v-if="batchSettingObj.imageUrl"
  1467. :src="batchSettingObj.imageUrl"
  1468. class="avatar"
  1469. style="width: 100px; height: 115px"
  1470. />
  1471. <el-icon
  1472. v-else
  1473. class="avatar-uploader-icon"
  1474. style="width: 100px; height: 100px"
  1475. >
  1476. <Plus />
  1477. </el-icon>
  1478. </el-upload>
  1479. </el-form-item>
  1480. <el-form-item prop="remark" label="备注">
  1481. <el-input
  1482. type="textarea"
  1483. v-model="batchSettingObj.remark"
  1484. placeholder="请输入备注"
  1485. />
  1486. </el-form-item>
  1487. </el-form>
  1488. <el-button @click="cancelBatchSetting()" style="margin-left: 370px"
  1489. >取消</el-button
  1490. >
  1491. <el-button type="primary" @click="batchSettingConfirm()"> 确认 </el-button>
  1492. </el-dialog>
  1493. </template>
  1494. <style scoped>
  1495. p {
  1496. margin: 0px;
  1497. }
  1498. .batch-btn {
  1499. margin-top: 20px;
  1500. margin-left: auto;
  1501. }
  1502. .el-form-item {
  1503. margin-left: 50px;
  1504. }
  1505. /* 上传图片的格式 */
  1506. .avatar-uploader .avatar {
  1507. width: 50px;
  1508. height: 50px;
  1509. display: block;
  1510. }
  1511. </style>
  1512. <style>
  1513. .error-message {
  1514. color: red;
  1515. font-size: 8px;
  1516. }
  1517. .is-invalid .el-input__inner {
  1518. border-color: red;
  1519. }
  1520. .avatar-uploader .el-upload {
  1521. border: 1px dashed var(--el-border-color);
  1522. border-radius: 6px;
  1523. cursor: pointer;
  1524. position: relative;
  1525. overflow: hidden;
  1526. transition: var(--el-transition-duration-fast);
  1527. }
  1528. .avatar-uploader .el-upload:hover {
  1529. border-color: var(--el-color-primary);
  1530. }
  1531. .el-icon.avatar-uploader-icon {
  1532. font-size: 28px;
  1533. color: #8c939d;
  1534. width: 50px;
  1535. height: 50px;
  1536. text-align: center;
  1537. }
  1538. .add-form {
  1539. margin-top: 50px;
  1540. max-width: 50%;
  1541. float: left;
  1542. }
  1543. .customer-info {
  1544. max-width: 60%;
  1545. }
  1546. </style>