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.

794 lines
24 KiB

2 months ago
2 months ago
2 months ago
  1. <script setup>
  2. import {onMounted, reactive, ref, watch} from "vue";
  3. import {ElIcon, ElMessage, ElMessageBox} from "element-plus";
  4. import {Plus, WarnTriangleFilled} from '@element-plus/icons-vue'
  5. import moment from "moment";
  6. import request from "@/util/http.js"
  7. import Cookies from 'js-cookie';
  8. import dayjs from "dayjs";
  9. // 精网号去空格
  10. const trimJwCode = () => {
  11. if (addConsume.value.jwcode) {
  12. // 去除所有空格,并尝试转换为整数
  13. const trimmed = addConsume.value.jwcode.toString().replace(/\s/g, '');
  14. const numeric = Number(trimmed);
  15. // 如果转换为数字成功,保存为数字,否则提示错误
  16. if (!isNaN(numeric)) {
  17. addConsume.value.jwcode = numeric;
  18. } else {
  19. ElMessage.error("精网号格式不正确,请输入数字");
  20. }
  21. }
  22. }
  23. //提交禁止重复点击
  24. const addDisabled = ref(false)
  25. /*
  26. ====================数据=================================
  27. */
  28. //这是获取当前登录的用户信息
  29. const adminData = ref({});
  30. // 通过精网号查询用户(客户)信息 表单
  31. const user = ref({
  32. jwcode: null,
  33. name: "",
  34. market: "",
  35. historySumGold: null,
  36. historyPermanentGold: null,
  37. historyFreeGold: null,
  38. historyTaskGold: null,
  39. rechargeNum: null,
  40. consumeNum: null,
  41. firstRecharge: "",
  42. nowPermanentGold: null,
  43. nowFreeJune: null,
  44. nowTaskGold: null,
  45. nowFreeDecember: null,
  46. nowFreeGold: null,
  47. nowSumGold: null
  48. })
  49. // 这是添加消费信息的表单(金币)
  50. const addConsume = ref({
  51. // jwcode 是数字
  52. jwcode: null, //精网号
  53. goodsName: "",// 商品名称
  54. sumGold: null, // 消费金币总数
  55. freeGold: null, // 免费金币
  56. permanentGold: null, // 永久金币
  57. taskGold: null, // 任务金币
  58. remark: "",//备注
  59. adminId: null,// 当前管理员id
  60. });
  61. // 表单验证
  62. const Ref = ref(null);
  63. // 表单验证规则
  64. const rules = reactive({
  65. jwcode: [
  66. {required: true, message: "请输入精网号", trigger: "blur"},
  67. // { type: 'number', message: "精网号必须为数字", trigger: "blur" }
  68. ],
  69. goodsName: [{required: true, message: "请选择商品", trigger: "blur"}],
  70. sumGold: [
  71. {required: true, message: "消耗金币总数不能为空", trigger: "blur"},
  72. {
  73. validator: (rule, value, callback) => {
  74. // 允许0开头的小数(如0.1)但不允许单独的0
  75. const isValid = /^(0\.\d{1,2})|([1-9]\d*(\.\d{1,2})?)$/.test(value);
  76. if (!isValid) {
  77. callback(new Error("请输入大于0的正数(可包含最多两位小数)"));
  78. } else {
  79. callback();
  80. }
  81. },
  82. trigger: "blur"
  83. }
  84. ]
  85. });
  86. // 查询商品的表单
  87. const goods = ref([]);
  88. /*
  89. ====================方法=================================
  90. */
  91. const getAdminData = async function () {
  92. try {//await 暂停函数执行,直到请求完成
  93. const result = await request({
  94. url: "/admin/userinfo",
  95. data: {},
  96. });
  97. adminData.value = result;
  98. addConsume.value.adminId = adminData.value.id;
  99. addConsume.value.name = adminData.value.adminName;
  100. console.log("请求成功", result);
  101. console.log("用户信息", adminData.value);
  102. } catch (error) {
  103. console.log("请求失败", error);
  104. }
  105. };
  106. // 输入验证函数
  107. function validateInput() {
  108. const sumGold = parseFloat(addConsume.value.sumGold);
  109. trimJwCode();
  110. if (user.value.jwcode == null) {
  111. ElMessage.warning("请先查询用户信息");
  112. addConsume.value.sumGold = null;
  113. user.value = {};
  114. return false;
  115. }
  116. /*
  117. // 验证金币数值
  118. if (user.value.jwcode && (isNaN(sumGold) || sumGold <= 0)) {
  119. ElMessage.warning("消费金币总数必须是大于0的数字");
  120. // 将sumGold设置为null
  121. addConsume.value.sumGold = null;
  122. return false;
  123. }
  124. */
  125. // sumGold 补充0(比如.1 为0.1)
  126. if (addConsume.value.sumGold && addConsume.value.sumGold.toString().startsWith('.')) {
  127. addConsume.value.sumGold = '0' + addConsume.value.sumGold;
  128. // ElMessage.info('已自动补充前导0');
  129. }
  130. // 验证金币不能为负数
  131. if (sumGold < 0) {
  132. ElMessage.warning("消耗金币总数不能为负数");
  133. addConsume.value.sumGold = null;
  134. return false;
  135. }
  136. // 小数位数限制 2位,整数位数限制 6位
  137. if (addConsume.value.sumGold) {
  138. const sumGoldStr = addConsume.value.sumGold.toString();
  139. // 检查整数部分长度
  140. if (sumGoldStr.includes('.')) {
  141. const integerPart = sumGoldStr.split('.')[0];
  142. if (integerPart.length > 6) {
  143. // 截断整数部分到6位并提示
  144. const truncatedInteger = integerPart.slice(0, 6);
  145. addConsume.value.sumGold = parseFloat(truncatedInteger);
  146. ElMessage.info('整数部分最多允许6位');
  147. return; // 直接返回,不再处理小数部分
  148. }
  149. } else {
  150. // 纯整数情况
  151. if (sumGoldStr.length > 6) {
  152. addConsume.value.sumGold = parseFloat(sumGoldStr.slice(0, 6));
  153. ElMessage.info('整数部分最多允许6位');
  154. return;
  155. }
  156. }
  157. // 处理小数部分
  158. if (sumGoldStr.includes('.')) {
  159. const decimalPart = sumGoldStr.split('.')[1];
  160. if (decimalPart.length > 2) {
  161. // 截断到两位小数并提示
  162. const truncatedValue = parseFloat(sumGoldStr.slice(0, sumGoldStr.indexOf('.') + 3));
  163. addConsume.value.sumGold = truncatedValue;
  164. ElMessage.info('最多允许输入两位小数');
  165. }
  166. }
  167. }
  168. // 验证金币总和
  169. const totalAvailableGold = (user.value.nowSumGold)
  170. if (user.value.jwcode && sumGold > totalAvailableGold) {
  171. ElMessage.error("消耗金币总数超过可用金币总和");
  172. // 将sumGold设置为null
  173. addConsume.value.sumGold = null;
  174. return false;
  175. }
  176. return true;
  177. }
  178. // 消耗金币计算函数
  179. function calculateCoins(sumGold) {
  180. console.log("消耗金币计算函数:计算金币", sumGold);
  181. const parsedSumGold = parseFloat(sumGold);
  182. if (isNaN(parsedSumGold) || parsedSumGold <= 0 || !user.value.jwcode) {
  183. return {free: 0, permanent: 0, task: 0};
  184. }
  185. const {nowFreeGold, nowPermanentGold, nowTaskGold} = user.value;
  186. let remaining = parsedSumGold;
  187. let freeUsed = 0, permanentUsed = 0, taskUsed = 0;
  188. // 优先消耗免费金币
  189. if (nowFreeGold > 0) {
  190. freeUsed = Math.min(parseFloat(nowFreeGold.toFixed(4)), remaining);
  191. remaining = parseFloat((remaining - freeUsed).toFixed(4));
  192. }
  193. // 其次消耗永久金币
  194. if (remaining > 0 && nowPermanentGold > 0) {
  195. permanentUsed = Math.min(parseFloat(nowPermanentGold.toFixed(4)), remaining);
  196. remaining = parseFloat((remaining - permanentUsed).toFixed(4));
  197. }
  198. // 最后消耗任务金币
  199. if (remaining > 0 && nowTaskGold > 0) {
  200. taskUsed = parseFloat(remaining.toFixed(4));
  201. }
  202. // 更新金币值
  203. addConsume.value.freeGold = freeUsed;
  204. addConsume.value.permanentGold = permanentUsed;
  205. addConsume.value.taskGold = taskUsed;
  206. return {free: freeUsed, permanent: permanentUsed, task: taskUsed};
  207. }
  208. // 用来写的 cookie 的 key
  209. const WriteCookies = ref(null)
  210. // 用来写的 cookie 的 value
  211. const WriteCookiesTime = ref(null)
  212. // 用来读的 cookie 的 key
  213. const ReadCookies = ref(null)
  214. // 用来读的 cookie 的 value
  215. const ReadCookiesTime = ref(null)
  216. // 这是添加消费信息的接口
  217. const add = async function () {
  218. try {
  219. // 验证输入数据 再验证一次
  220. if (!validateInput()) {
  221. return;
  222. }
  223. // 计算金币使用情况
  224. calculateCoins(addConsume.value.sumGold);
  225. console.log("addConsume.value", addConsume.value)
  226. //存一下 用户的jwcode
  227. // 拼接 jwcode:permanentGold:freeGold
  228. WriteCookies.value = `coinConsume:${addConsume.value.jwcode}:${addConsume.value.goodsName}}`
  229. //value 为当前消耗时间
  230. WriteCookiesTime.value = dayjs().format("YYYY-MM-DD HH:mm:ss");
  231. // 设置cookies,用户jwcode为key,value也是jwcode,过期时间为1天
  232. Cookies.set(WriteCookies.value, WriteCookiesTime.value, {expires: 1, path: '/'});
  233. // 发送POST请求
  234. addDisabled.value = true
  235. const result = await request({
  236. // url: "/consume/add",
  237. url: "/consume/add",
  238. data: {
  239. ...addConsume.value,
  240. jwcode: addConsume.value.jwcode,
  241. adminId: addConsume.value.adminId,
  242. sumGold: addConsume.value.sumGold * 100,
  243. freeGold: addConsume.value.freeGold * 100,
  244. taskGold: addConsume.value.taskGold * 100,
  245. permanentGold: addConsume.value.permanentGold * 100,
  246. goodsName: addConsume.value.goodsName,
  247. remark: addConsume.value.remark
  248. }
  249. });
  250. addDisabled.value = false
  251. console.log("add请求", result);
  252. // 处理响应
  253. handleResponse(result);
  254. // 重置表单
  255. resetForm();
  256. } catch (error) {
  257. console.error("请求失败", error);
  258. ElMessage.error("添加失败,请检查网络连接或联系管理员");
  259. }
  260. };
  261. // 响应处理函数
  262. function handleResponse(result) {
  263. console.log("响应结果", result)
  264. if (result.code === 200) {
  265. ElMessage.success("添加成功");
  266. console.log("请求成功", result);
  267. } else {
  268. ElMessage.error(result.msg || "添加失败,未知错误");
  269. }
  270. }
  271. // 重置表单函数
  272. function resetForm() {
  273. // 清空表单数据
  274. addConsume.value = {
  275. jwcode: null,
  276. goodsName: "",
  277. sumGold: null,
  278. freeGold: null,
  279. permanentGold: null,
  280. taskGold: null,
  281. remark: "",
  282. adminId: adminData.value.id,
  283. adminName: adminData.value.adminName,
  284. };
  285. console.log("重置表单")
  286. user.value = {
  287. jwcode: null,
  288. name: "",
  289. market: "",
  290. historySumGold: null,
  291. historyPermanentGold: null,
  292. historyFreeGold: null,
  293. historyTaskGold: null,
  294. rechargeNum: null,
  295. consumeNum: null,
  296. firstRecharge: "",
  297. nowPermanentGold: null,
  298. nowFreeJune: null,
  299. nowTaskGold: null,
  300. nowFreeDecember: null,
  301. nowFreeGold: null,
  302. nowSumGold: null
  303. }
  304. }
  305. // 充值对话框显示状态
  306. const ConsumeDialogVisible = ref(false);
  307. // 关闭对话框
  308. const ConsumeDialogVisiblehandleClose = () => {
  309. ConsumeDialogVisible.value = false;
  310. // 重置表单数据
  311. resetForm()
  312. user.value = {}
  313. };
  314. // 确认使用cookie继续充值
  315. const ConsumeDialogVisibleContinue = () => {
  316. ConsumeDialogVisible.value = false;
  317. add();
  318. };
  319. const ConsumeDialogVisibleCancel = () => {
  320. ConsumeDialogVisible.value = false
  321. resetForm()
  322. user.value = {}
  323. };
  324. // 实际执行充值操作
  325. const proceedWithConsume = () => {
  326. ElMessageBox.confirm('确认充值?')
  327. .then(() => {
  328. add();
  329. console.log('添加成功');
  330. })
  331. .catch(() => {
  332. console.log('取消添加');
  333. });
  334. };
  335. // 添加前验证
  336. const addBefore = () => {
  337. Ref.value.validate(async (valid) => {
  338. // 验证cookie
  339. if (!valid) {
  340. ElMessage({
  341. type: 'error',
  342. message: '请检查输入内容'
  343. });
  344. return;
  345. }
  346. ReadCookies.value = `coinConsume:${addConsume.value.jwcode}:${addConsume.value.goodsName}}`
  347. // 获取cookie
  348. const cookie = Cookies.get(ReadCookies.value)
  349. console.log("time", WriteCookiesTime.value)
  350. // 格式化时间
  351. ReadCookiesTime.value = moment(cookie).format('YYYY-MM-DD HH:mm:ss')
  352. if (cookie) {
  353. ConsumeDialogVisible.value = true;
  354. } else {
  355. proceedWithConsume();
  356. }
  357. });
  358. };
  359. // 查询客户信息(通过精网号)
  360. const getUser = async function (jwcode) {
  361. try {
  362. // 验证精网号
  363. if (!jwcode) {
  364. ElMessage.warning('精网号不能为空');
  365. return;
  366. }
  367. // 验证精网号是否为数字
  368. if (!/^\d{1,9}$/.test(jwcode)) {
  369. ElMessage.warning('精网号必须为数字且不超过九位');
  370. resetForm()
  371. return;
  372. }
  373. // 发送POST请求
  374. const result = await request({
  375. url: "/user/selectUser",
  376. data: {jwcode}
  377. });
  378. console.log("请求成功", result);
  379. if (result.code === 200 && result.data) {
  380. // 处理用户数据
  381. user.value = {
  382. ...result.data,
  383. // 统一处理所有黄金数值,除以100
  384. nowPermanentGold: result.data.nowPermanentGold / 100,
  385. nowFreeGold: result.data.nowFreeGold / 100,
  386. nowSumGold: result.data.nowSumGold / 100,
  387. nowTaskGold: result.data.nowTaskGold / 100,
  388. nowFreeJune: result.data.nowFreeJune / 100,
  389. nowFreeDecember: result.data.nowFreeDecember / 100,
  390. historySumGold: result.data.historySumGold / 100,
  391. historyPermanentGold: result.data.historyPermanentGold / 100,
  392. historyFreeGold: result.data.historyFreeGold / 100,
  393. historyTaskGold: result.data.historyTaskGold / 100
  394. };
  395. ElMessage.success("查询成功");
  396. // 检查sumGold是否有值,如果有则重新计算金币分配
  397. if (addConsume.value.sumGold) {
  398. const parsedSumGold = parseFloat(addConsume.value.sumGold);
  399. if (!isNaN(parsedSumGold) && parsedSumGold > 0) {
  400. const {free, permanent, task} = calculateCoins(parsedSumGold);
  401. addConsume.value.freeGold = free;
  402. addConsume.value.permanentGold = permanent;
  403. addConsume.value.taskGold = task;
  404. }
  405. }
  406. // 验证输入
  407. validateInput()
  408. } else if (!result.data) {
  409. ElMessage.warning("用户不存在");
  410. user.value.jwcode = null
  411. addConsume.value.jwcode = null
  412. // resetForm(); // 重置表单
  413. } else {
  414. ElMessage.warning(result.msg || "请检查查询参数");
  415. }
  416. } catch (error) {
  417. console.error("请求失败", error);
  418. ElMessage.error("查询失败,请检查网络连接或精网号是否正确");
  419. resetForm(); // 重置表单
  420. }
  421. };
  422. // 获取商品信息(三楼接口)
  423. const getGoods = async function () {
  424. try {
  425. // 发送POST请求
  426. const result = await request({
  427. // url: "/product", //
  428. // url: "http://39.101.133.168:8828/live_mall/api/product/all",
  429. url: "https://api.homilychart.com/live_mall/api/product/all",
  430. });
  431. // 将响应结果存储到响应式数据中
  432. console.log("请求成功", result);
  433. goods.value = result.data.map(item => ({
  434. id: item.id,
  435. label: item.name,
  436. value: item.name
  437. }));
  438. } catch (error) {
  439. console.log("请求失败", error);
  440. // 在这里可以处理错误逻辑,比如显示错误提示等
  441. }
  442. };
  443. /*
  444. ====================监听=================================
  445. */
  446. // 监听消费总金额变化,自动计算三类金币
  447. watch(
  448. () => addConsume.value.sumGold,
  449. (newValue) => {
  450. const parsedNewValue = parseFloat(newValue);
  451. if (!isNaN(parsedNewValue) && parsedNewValue > 0) {
  452. const {free, permanent, task} = calculateCoins(parsedNewValue);
  453. addConsume.value.freeGold = free;
  454. addConsume.value.permanentGold = permanent;
  455. addConsume.value.taskGold = task;
  456. } else {
  457. addConsume.value.freeGold = null;
  458. addConsume.value.permanentGold = null;
  459. addConsume.value.taskGold = null;
  460. }
  461. }
  462. );
  463. /*
  464. ====================挂载=================================
  465. */
  466. // 挂载
  467. onMounted(async function () {
  468. await getAdminData();
  469. await getGoods();
  470. });
  471. </script>
  472. <template>
  473. <div>
  474. <el-form :model="addConsume" ref="Ref" :rules="rules" label-width="auto" style="max-width: 600px;"
  475. label-position="right" class="add-form">
  476. <el-form-item prop="jwcode" label="精网号">
  477. <el-input v-model="addConsume.jwcode" style="width: 200px"/>
  478. <el-button type="primary" @click="getUser(addConsume.jwcode)" style="margin-left: 10px">查询
  479. </el-button>
  480. </el-form-item>
  481. <el-form-item prop="goodsName" label="商品名称">
  482. <el-select v-model="addConsume.goodsName" placeholder="请选择商品" style="width: 200px">
  483. <el-option v-for="item in goods" :key="item.value" :label="item.label" :value="item.value"/>
  484. </el-select>
  485. </el-form-item>
  486. <el-form-item prop="sumGold" label="消耗金币总数">
  487. <el-input v-model="addConsume.sumGold" style="width: 100px" @input="validateInput()"
  488. @change="calculateCoins(addConsume.sumGold)"/>
  489. </el-form-item>
  490. <!-- 三类金币自动计算禁用状态不可编辑 -->
  491. <el-form-item prop="permanentGold" label="永久金币">
  492. <el-input v-model="addConsume.permanentGold" disabled style="width: 100px">
  493. <template #default="scope">{{ scope.row.permanentGold }}</template>
  494. </el-input>
  495. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  496. </el-form-item>
  497. <el-form-item prop="freeCoin" label="免费金币">
  498. <el-input disabled v-model="addConsume.freeGold" style="width: 100px"/>
  499. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  500. </el-form-item>
  501. <el-form-item prop="taskGold" label="任务金币">
  502. <el-input disabled v-model="addConsume.taskGold" style="width: 100px"/>
  503. <p style="margin-right: 20px">&nbsp;&nbsp;</p>
  504. </el-form-item>
  505. <el-form-item prop="remark" label="备注">
  506. <el-input v-model="addConsume.remark" style="width: 300px" :rows="4" maxlength="100" show-word-limit
  507. type="textarea"/>
  508. </el-form-item>
  509. <el-button type="success" @click="resetForm()" style="margin-left: 200px;margin-top:10px">重置</el-button>
  510. <el-button type="primary" :disabled="addDisabled" @click="addBefore" style="margin-top:10px"> 提交</el-button>
  511. </el-form>
  512. <!-- 客户信息栏 -->
  513. <el-card v-if="user.jwcode" style="width: 800px; float: right" class="customer-info">
  514. <el-form :model="user" label-width="auto" style="max-width: 1000px" label-position="left">
  515. <el-text size="large" style="margin-left: 20px">客户信息</el-text>
  516. <!-- 第一行姓名 + 历史金币 -->
  517. <el-row style="margin-top: 20px">
  518. <el-col :span="9">
  519. <el-form-item label="姓名">
  520. <p>{{ user.name }}</p>
  521. </el-form-item>
  522. </el-col>
  523. <el-col :span="14">
  524. <el-form-item label="历史金币总数">
  525. <!-- 检查 user.historySumGold 是否为有效的数字 -->
  526. <p style="color: #2fa1ff; margin-right: 5px" v-if="!isNaN(Number(user.historySumGold))">
  527. {{ Number(user.historySumGold) }}
  528. </p>
  529. <!-- 如果不是有效的数字显示默认值 -->
  530. <p v-else></p>
  531. </el-form-item>
  532. <el-form-item style="margin-top: -23px">
  533. <span style="display: inline; white-space: nowrap; color: #b1b1b1"
  534. v-if="user.historyPermanentGold !== undefined">(永久金币:{{ user.historyPermanentGold }};免费金币:{{
  535. (user.historyFreeGold)
  536. }};任务金币:{{ user.historyTaskGold }})</span>
  537. </el-form-item>
  538. </el-col>
  539. </el-row>
  540. <!-- 第二行精网号 + 当前金币独立行 -->
  541. <el-row>
  542. <el-col :span="9">
  543. <el-form-item label="精网号">
  544. <p>{{ user.jwcode }}</p>
  545. </el-form-item>
  546. </el-col>
  547. <el-col :span="14">
  548. <el-form-item label="当前金币总数" style="width: 500px">
  549. <span style="color: #2fa1ff; margin-right: 5px" v-if="user.nowSumGold !== undefined">{{
  550. user.nowSumGold
  551. }}</span>
  552. </el-form-item>
  553. <!-- 金币详情独立显示 -->
  554. <el-form-item style="margin-top: -23px"> <!-- 负边距减少间距 -->
  555. <span style="color: #b1b1b1; margin-left: 0px" v-if="user.nowPermanentGold !== undefined">(永久金币:{{
  556. user.nowPermanentGold
  557. }};
  558. 免费金币:{{ user.nowFreeGold }};
  559. 任务金币:{{ user.nowTaskGold }})</span>
  560. </el-form-item>
  561. </el-col>
  562. </el-row>
  563. <!-- 第三行首次充值日期 + 充值次数 -->
  564. <el-row style="margin-top:-23px">
  565. <el-col :span="9">
  566. <el-form-item label="首次充值日期">
  567. <p v-if="user.firstRecharge">
  568. {{ moment(user.firstRecharge).format('YYYY-MM-DD HH:mm:ss') }}
  569. </p>
  570. </el-form-item>
  571. </el-col>
  572. <el-col :span="14">
  573. <el-form-item label="充值次数">
  574. <p style="color: #2fa1ff">{{ user.rechargeNum }}</p>
  575. </el-form-item>
  576. </el-col>
  577. </el-row>
  578. <!-- 第四行消费次数 + 所属门店 -->
  579. <el-row>
  580. <el-col :span="9">
  581. <el-form-item label="消费次数">
  582. <p style="color: #2fa1ff">{{ user.consumeNum }}</p>
  583. </el-form-item>
  584. </el-col>
  585. <el-col :span="9">
  586. <el-form-item label="所属门店">
  587. <p>{{ user.market }}</p>
  588. </el-form-item>
  589. </el-col>
  590. </el-row>
  591. </el-form>
  592. </el-card>
  593. <el-dialog
  594. v-model="ConsumeDialogVisible"
  595. title="操作确认"
  596. :before-close="ConsumeDialogVisiblehandleClose"
  597. :close-on-click-modal="false"
  598. width="480px"
  599. >
  600. <!-- 内容整体居中且收窄 -->
  601. <div class="confirm-body">
  602. <!-- 用户信息 -->
  603. <div>
  604. <div class="field-label">用户信息</div>
  605. <el-input :model-value="user.jwcode + (user.name ? '' + user.name + '' : '')" disabled/>
  606. </div>
  607. <!-- 活动名称 -->
  608. <div class="field">
  609. <div class="field-label">商品名称</div>
  610. <el-input v-model="addConsume.goodsName" disabled/>
  611. </div>
  612. <!--金币总数 -->
  613. <div class="field">
  614. <div class="field-label">金币总数</div>
  615. <el-input v-model="addConsume.sumGold" disabled/>
  616. </div>
  617. <!-- 金币详细信息同一行左右排列 -->
  618. <el-row :gutter="20" class="coins-row">
  619. <el-col :span="8">
  620. <div class="field">
  621. <div class="field-label">永久金币</div>
  622. <el-input v-model="addConsume.permanentGold" disabled/>
  623. </div>
  624. </el-col>
  625. <el-col :span="8">
  626. <div class="field">
  627. <div class="field-label">免费金币</div>
  628. <el-input v-model="addConsume.freeGold" disabled/>
  629. </div>
  630. </el-col>
  631. <el-col :span="8">
  632. <div class="field">
  633. <div class="field-label">任务金币</div>
  634. <el-input v-model="addConsume.taskGold" disabled/>
  635. </div>
  636. </el-col>
  637. </el-row>
  638. <!-- 风险提示 -->
  639. <div style="display: flex; align-items: center; margin-top: 20px;">
  640. <el-icon :size="24" color="#FFD700">
  641. <WarnTriangleFilled/>
  642. </el-icon>
  643. <p>重复购买风险提示</p>
  644. </div>
  645. <!-- 记录 + 虚线分隔 -->
  646. <div>
  647. <el-divider border-style="dashed"/>
  648. <p>检测到该用户近期有相似消费记录</p>
  649. · {{ ReadCookiesTime }} 购买 {{ addConsume.goodsName }}(操作人: {{ adminData.adminName }})
  650. </div>
  651. <div style="margin-top: 10px">
  652. <p>是否继续操作</p>
  653. </div>
  654. </div>
  655. <!-- 底部按钮居中 -->
  656. <template #footer>
  657. <div class="dialog-footer-center">
  658. <el-button @click="ConsumeDialogVisibleCancel"> </el-button>
  659. <el-button type="primary" @click="ConsumeDialogVisibleContinue">确认充值</el-button>
  660. </div>
  661. </template>
  662. </el-dialog>
  663. </div>
  664. <!-- 金币消耗明细的布局------------------------------------------------------- -->
  665. <!-- <div v-else-if="activeTab === 'detail'"> -->
  666. <!-- </div>
  667. </div> -->
  668. </template>
  669. <style scoped>
  670. p {
  671. margin: 0px;
  672. }
  673. .add-form {
  674. margin-top: 50px;
  675. max-width: 50%;
  676. float: left;
  677. }
  678. .el-form-item {
  679. margin-left: 50px;
  680. }
  681. /* 上传图片的格式 */
  682. .avatar-uploader .avatar {
  683. width: 50px;
  684. height: 50px;
  685. display: block;
  686. }
  687. .customer-info {
  688. max-width: 60%;
  689. }
  690. </style>
  691. <style>
  692. /* 标题居中 */
  693. .el-dialog__header {
  694. text-align: center;
  695. }
  696. .confirm-body {
  697. width: 420px;
  698. margin: 0 auto;
  699. }
  700. /* 字段块与标签样式 */
  701. .field {
  702. margin-bottom: 14px;
  703. }
  704. .field-label {
  705. font-size: 14px;
  706. color: #606266;
  707. margin-bottom: 6px;
  708. }
  709. /* 金币行紧凑 */
  710. .coins-row .field {
  711. margin-bottom: 0;
  712. }
  713. /* 底部按钮居中 */
  714. .dialog-footer-center {
  715. display: flex;
  716. justify-content: center;
  717. gap: 12px;
  718. }
  719. </style>