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.

772 lines
24 KiB

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