金币系统前端
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.

1570 lines
45 KiB

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