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.

853 lines
25 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
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
  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: adminData.value.adminName
  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: "change"}],
  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: adminData.value.id,
  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. ``
  296. // 确认使用cookie继续充值
  297. const ConsumeDialogVisibleContinue = () => {
  298. ConsumeDialogVisible.value = false;
  299. add();
  300. };
  301. const ConsumeDialogVisibleCancel = () => {
  302. ConsumeDialogVisible.value = false
  303. resetForm()
  304. user.value = {}
  305. };
  306. // 第一次弹窗
  307. // 充值对话框显示状态
  308. const FirstConsumeDialogVisible = ref(false);
  309. // 关闭对话框
  310. const FirstConsumeDialogVisiblehandleClose = () => {
  311. FirstConsumeDialogVisible.value = false;
  312. // 重置表单数据
  313. resetForm()
  314. user.value = {}
  315. };
  316. // 第一次消耗
  317. const FirstConsumeDialogVisibleContinue = () => {
  318. FirstConsumeDialogVisible.value = false;
  319. add();
  320. };
  321. const FirstConsumeDialogVisibleCancel = () => {
  322. FirstConsumeDialogVisible.value = false
  323. resetForm()
  324. user.value = {}
  325. };
  326. // 实际执行充值操作
  327. // const proceedWithConsume = () => {
  328. // ElMessageBox.confirm('确认购买?')
  329. // .then(() => {
  330. // add();
  331. // console.log('添加成功');
  332. // })
  333. // .catch(() => {
  334. // console.log('取消添加');
  335. // });
  336. // };
  337. // 添加前验证
  338. const addBefore = () => {
  339. Ref.value.validate(async (valid) => {
  340. // 验证cookie
  341. if (!valid) {
  342. ElMessage({
  343. type: 'error',
  344. message: '请检查输入内容'
  345. });
  346. return;
  347. }
  348. ReadCookies.value = `coinConsume:${addConsume.value.jwcode}:${addConsume.value.goodsName}`
  349. // 获取cookie
  350. const cookie = Cookies.get(ReadCookies.value)
  351. console.log("time", WriteCookiesTime.value)
  352. // 格式化时间
  353. ReadCookiesTime.value = moment(cookie).format('YYYY-MM-DD HH:mm:ss')
  354. console.log("cookie========", cookie)
  355. if (cookie) {
  356. ConsumeDialogVisible.value = true;
  357. } else {
  358. FirstConsumeDialogVisible.value = true;
  359. }
  360. });
  361. };
  362. // 查询客户信息(通过精网号)
  363. const getUser = async function (jwcode) {
  364. try {
  365. // 验证精网号
  366. if (!jwcode) {
  367. ElMessage.warning('精网号不能为空');
  368. return;
  369. }
  370. // 验证精网号是否为数字
  371. if (!/^\d{1,9}$/.test(jwcode)) {
  372. ElMessage.warning('精网号必须为数字且不超过九位');
  373. resetForm()
  374. return;
  375. }
  376. // 发送POST请求
  377. const result = await request({
  378. url: "/user/selectUser",
  379. data: {jwcode}
  380. });
  381. console.log("请求成功", result);
  382. if (result.code === 200 && result.data) {
  383. // 处理用户数据
  384. user.value = {
  385. ...result.data,
  386. // 统一处理所有黄金数值,除以100
  387. nowPermanentGold: result.data.nowPermanentGold / 100,
  388. nowFreeGold: result.data.nowFreeGold / 100,
  389. nowSumGold: result.data.nowSumGold / 100,
  390. nowTaskGold: result.data.nowTaskGold / 100,
  391. nowFreeJune: result.data.nowFreeJune / 100,
  392. nowFreeDecember: result.data.nowFreeDecember / 100,
  393. historySumGold: result.data.historySumGold / 100,
  394. historyPermanentGold: result.data.historyPermanentGold / 100,
  395. historyFreeGold: result.data.historyFreeGold / 100,
  396. historyTaskGold: result.data.historyTaskGold / 100
  397. };
  398. ElMessage.success("查询成功");
  399. // 检查sumGold是否有值,如果有则重新计算金币分配
  400. if (addConsume.value.sumGold) {
  401. const parsedSumGold = parseFloat(addConsume.value.sumGold);
  402. if (!isNaN(parsedSumGold) && parsedSumGold > 0) {
  403. const {free, permanent, task} = calculateCoins(parsedSumGold);
  404. addConsume.value.freeGold = free;
  405. addConsume.value.permanentGold = permanent;
  406. addConsume.value.taskGold = task;
  407. }
  408. }
  409. // 验证输入
  410. validateInput()
  411. } else if (!result.data) {
  412. ElMessage.warning("用户不存在");
  413. user.value.jwcode = null
  414. addConsume.value.jwcode = null
  415. // resetForm(); // 重置表单
  416. } else {
  417. ElMessage.warning(result.msg || "请检查查询参数");
  418. }
  419. } catch (error) {
  420. console.error("请求失败", error);
  421. ElMessage.error("查询失败,请检查网络连接或精网号是否正确");
  422. resetForm(); // 重置表单
  423. }
  424. };
  425. // 获取商品信息(三楼接口)
  426. const getGoods = async function () {
  427. try {
  428. // 发送POST请求
  429. const result = await request({
  430. // url: "/product", //
  431. // url: "http://39.101.133.168:8828/live_mall/api/product/all",
  432. url: "https://api.homilychart.com/live_mall/api/product/all",
  433. });
  434. // 将响应结果存储到响应式数据中
  435. console.log("请求成功", result);
  436. goods.value = result.data.map(item => ({
  437. id: item.id,
  438. label: item.name,
  439. value: item.name
  440. }));
  441. } catch (error) {
  442. console.log("请求失败", error);
  443. // 在这里可以处理错误逻辑,比如显示错误提示等
  444. }
  445. };
  446. /*
  447. ====================监听=================================
  448. */
  449. // 监听消费总金额变化,自动计算三类金币
  450. watch(
  451. () => addConsume.value.sumGold,
  452. (newValue) => {
  453. const parsedNewValue = parseFloat(newValue);
  454. if (!isNaN(parsedNewValue) && parsedNewValue > 0) {
  455. const {free, permanent, task} = calculateCoins(parsedNewValue);
  456. addConsume.value.freeGold = free;
  457. addConsume.value.permanentGold = permanent;
  458. addConsume.value.taskGold = task;
  459. } else {
  460. addConsume.value.freeGold = null;
  461. addConsume.value.permanentGold = null;
  462. addConsume.value.taskGold = null;
  463. }
  464. }
  465. );
  466. /*
  467. ====================挂载=================================
  468. */
  469. // 挂载
  470. onMounted(async function () {
  471. await getGoods()
  472. console.log('adminData', adminData.value)
  473. })
  474. </script>
  475. <template>
  476. <div>
  477. <el-form :model="addConsume" ref="Ref" :rules="rules" style="max-width: 600px;" class="add-form" label-width="auto" label-position="right">
  478. <el-form-item prop="jwcode" label="精网号" style="margin-top: 50px">
  479. <el-input v-model="addConsume.jwcode" style="width: 10vw;"/>
  480. <el-button type="primary" @click="getUser(addConsume.jwcode)" style="margin-left: 10px">查询
  481. </el-button>
  482. </el-form-item>
  483. <el-form-item prop="goodsName" label="商品名称" style="flex: 1; margin-right: 0px">
  484. <el-select v-model="addConsume.goodsName" placeholder="请选择商品" style="width: 10vw;" clearable filterable
  485. >
  486. <el-option v-for="(item, index) in goods" :key="index" :label="item.label" :value="item"/>
  487. </el-select>
  488. </el-form-item>
  489. <el-form-item prop="sumGold" label="消耗金币总数">
  490. <el-input v-model="addConsume.sumGold" style="width: 10vw;" @input="validateInput()"
  491. @change="calculateCoins(addConsume.sumGold)"/>
  492. </el-form-item>
  493. <!-- 三类金币自动计算禁用状态不可编辑 -->
  494. <el-form-item prop="permanentGold" label="永久金币">
  495. <el-input v-model="addConsume.permanentGold" disabled style="width: 10vw;">
  496. <template #default="scope">{{ scope.row.permanentGold }}</template>
  497. </el-input>
  498. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  499. </el-form-item>
  500. <el-form-item prop="freeCoin" label="免费金币">
  501. <el-input disabled v-model="addConsume.freeGold" style="width: 10vw;"/>
  502. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  503. </el-form-item>
  504. <el-form-item prop="taskGold" label="任务金币">
  505. <el-input disabled v-model="addConsume.taskGold" style="width: 10vw;"/>
  506. <p style="margin-right: 20px">&nbsp;&nbsp;</p>
  507. </el-form-item>
  508. <el-form-item prop="remark" label="备注">
  509. <el-input v-model="addConsume.remark" style="width: 13.5vw;" :rows="4" maxlength="100"
  510. show-word-limit type="textarea"/>
  511. </el-form-item>
  512. <el-button type="success" @click="resetForm()" style="margin-left: 200px;margin-top:10px">重置</el-button>
  513. <el-button type="primary" :disabled="addDisabled" @click="addBefore" style="margin-top:10px"> 提交</el-button>
  514. </el-form>
  515. <!-- 客户信息栏 -->
  516. <el-card v-if="user.jwcode" style="width: 800px; float: right" class="customer-info">
  517. <el-form :model="user" label-width="auto" style="max-width: 1000px" label-position="left">
  518. <el-text size="large" style="margin-left: 20px">客户信息</el-text>
  519. <!-- 第一行姓名 + 历史金币 -->
  520. <el-row style="margin-top: 20px">
  521. <el-col :span="9">
  522. <el-form-item label="姓名">
  523. <p>{{ user.name }}</p>
  524. </el-form-item>
  525. </el-col>
  526. <el-col :span="14">
  527. <el-form-item label="当前金币总数" style="width: 500px">
  528. <span style="color: #2fa1ff; margin-right: 5px" v-if="user.nowSumGold !== undefined">{{
  529. 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. }};
  537. 免费金币:{{ user.nowFreeGold }};
  538. 任务金币:{{ user.nowTaskGold }})</span>
  539. </el-form-item>
  540. </el-col>
  541. </el-row>
  542. <!-- 第二行精网号 + 当前金币独立行 -->
  543. <el-row>
  544. <el-col :span="9">
  545. <el-form-item label="精网号">
  546. <p>{{ user.jwcode }}</p>
  547. </el-form-item>
  548. </el-col>
  549. <el-col :span="14">
  550. <el-form-item label="充值次数">
  551. <p style="color: #2fa1ff">{{ user.rechargeNum }}</p>
  552. </el-form-item>
  553. </el-col>
  554. </el-row>
  555. <!-- 第三行首次充值日期 + 充值次数 -->
  556. <el-row >
  557. <el-col :span="9">
  558. <el-form-item label="首次充值日期">
  559. <p v-if="user.firstRecharge">
  560. {{ moment(user.firstRecharge).format('YYYY-MM-DD HH:mm:ss') }}
  561. </p>
  562. </el-form-item>
  563. </el-col>
  564. <el-col :span="14">
  565. <el-form-item label="消费次数">
  566. <p style="color: #2fa1ff">{{ user.consumeNum }}</p>
  567. </el-form-item>
  568. </el-col>
  569. </el-row>
  570. <!-- 第四行消费次数 + 所属门店 -->
  571. <el-row>
  572. <el-col :span="9">
  573. <el-form-item label="所属门店">
  574. <p>{{ user.market }}</p>
  575. </el-form-item>
  576. </el-col>
  577. </el-row>
  578. </el-form>
  579. </el-card>
  580. <el-dialog
  581. v-model="FirstConsumeDialogVisible"
  582. title="操作确认"
  583. :before-close="FirstConsumeDialogVisiblehandleClose"
  584. :close-on-click-modal="false"
  585. width="480px"
  586. >
  587. <!-- 内容整体居中且收窄 -->
  588. <div class="confirm-body">
  589. <!-- 用户信息 -->
  590. <div>
  591. <div class="field-label">用户信息</div>
  592. <el-input :model-value="user.jwcode + (user.name ? '' + user.name + '' : '')" disabled/>
  593. </div>
  594. <!-- 活动名称 -->
  595. <div class="field">
  596. <div class="field-label">商品名称</div>
  597. <el-input v-model="addConsume.goodsName" disabled/>
  598. </div>
  599. <!--金币总数 -->
  600. <div class="field">
  601. <div class="field-label">金币总数</div>
  602. <el-input v-model="addConsume.sumGold" disabled/>
  603. </div>
  604. <!-- 金币详细信息同一行左右排列 -->
  605. <el-row :gutter="20" class="coins-row">
  606. <el-col :span="8">
  607. <div class="field">
  608. <div class="field-label">永久金币</div>
  609. <el-input v-model="addConsume.permanentGold" disabled/>
  610. </div>
  611. </el-col>
  612. <el-col :span="8">
  613. <div class="field">
  614. <div class="field-label">免费金币</div>
  615. <el-input v-model="addConsume.freeGold" disabled/>
  616. </div>
  617. </el-col>
  618. <el-col :span="8">
  619. <div class="field">
  620. <div class="field-label">任务金币</div>
  621. <el-input v-model="addConsume.taskGold" disabled/>
  622. </div>
  623. </el-col>
  624. </el-row>
  625. <div class="field">
  626. <div class="field-label">备注</div>
  627. <el-input v-model="addConsume.remark" disabled/>
  628. </div>
  629. </div>
  630. <!-- 底部按钮居中 -->
  631. <template #footer>
  632. <div class="dialog-footer-center">
  633. <el-button @click="FirstConsumeDialogVisibleCancel"> </el-button>
  634. <el-button type="primary" @click="FirstConsumeDialogVisibleContinue">确认购买</el-button>
  635. </div>
  636. </template>
  637. </el-dialog>
  638. <el-dialog v-model="ConsumeDialogVisible" title="第二次操作确认" :before-close="ConsumeDialogVisiblehandleClose"
  639. :close-on-click-modal="false" width="480px">
  640. <!-- 内容整体居中且收窄 -->
  641. <div class="confirm-body">
  642. <!-- 用户信息 -->
  643. <div>
  644. <div class="field-label">用户信息</div>
  645. <el-input :model-value="user.jwcode + (user.name ? '' + user.name + '' : '')" disabled/>
  646. </div>
  647. <!-- 活动名称 -->
  648. <div class="field">
  649. <div class="field-label">商品名称</div>
  650. <el-input v-model="addConsume.goodsName" disabled/>
  651. </div>
  652. <!--金币总数 -->
  653. <div class="field">
  654. <div class="field-label">金币总数</div>
  655. <el-input v-model="addConsume.sumGold" disabled/>
  656. </div>
  657. <!-- 金币详细信息同一行左右排列 -->
  658. <el-row :gutter="20" class="coins-row">
  659. <el-col :span="8">
  660. <div class="field">
  661. <div class="field-label">永久金币</div>
  662. <el-input v-model="addConsume.permanentGold" disabled/>
  663. </div>
  664. </el-col>
  665. <el-col :span="8">
  666. <div class="field">
  667. <div class="field-label">免费金币</div>
  668. <el-input v-model="addConsume.freeGold" disabled/>
  669. </div>
  670. </el-col>
  671. <el-col :span="8">
  672. <div class="field">
  673. <div class="field-label">任务金币</div>
  674. <el-input v-model="addConsume.taskGold" disabled/>
  675. </div>
  676. </el-col>
  677. </el-row>
  678. <!-- 风险提示 -->
  679. <div style="display: flex; align-items: center; margin-top: 20px;">
  680. <el-icon :size="24" color="#FFD700">
  681. <WarnTriangleFilled/>
  682. </el-icon>
  683. <p>重复购买风险提示</p>
  684. </div>
  685. <!-- 记录 + 虚线分隔 -->
  686. <div>
  687. <el-divider border-style="dashed"/>
  688. <p>检测到该用户近期有相似消费记录</p>
  689. · {{ ReadCookiesTime }} 购买 {{ addConsume.goodsName }}(操作人: {{ adminData.adminName }})
  690. </div>
  691. <div style="margin-top: 10px">
  692. <p>是否继续操作</p>
  693. </div>
  694. </div>
  695. <!-- 底部按钮居中 -->
  696. <template #footer>
  697. <div class="dialog-footer-center">
  698. <el-button @click="ConsumeDialogVisibleCancel"> </el-button>
  699. <el-button type="primary" @click="ConsumeDialogVisibleContinue">确认购买</el-button>
  700. </div>
  701. </template>
  702. </el-dialog>
  703. </div>
  704. <!-- 金币消耗明细的布局------------------------------------------------------- -->
  705. <!-- <div v-else-if="activeTab === 'detail'"> -->
  706. <!-- </div>
  707. </div> -->
  708. </template>
  709. <style scoped>
  710. p {
  711. margin: 0px;
  712. }
  713. .el-form-item {
  714. margin-left: 50px;
  715. }
  716. /* 上传图片的格式 */
  717. .avatar-uploader .avatar {
  718. width: 50px;
  719. height: 50px;
  720. display: block;
  721. }
  722. .add-form {
  723. max-width: 50%;
  724. float: left;
  725. }
  726. /* 标题居中 */
  727. .el-dialog__header {
  728. text-align: center;
  729. }
  730. .confirm-body {
  731. width: 420px;
  732. margin: 0 auto;
  733. }
  734. /* 字段块与标签样式 */
  735. .field {
  736. margin-bottom: 14px;
  737. }
  738. .customer-info {
  739. width: 700px;
  740. float: right;
  741. margin-right: 200px;
  742. margin-top: 100px;
  743. }
  744. .field-label {
  745. font-size: 14px;
  746. color: #606266;
  747. margin-bottom: 6px;
  748. }
  749. /* 金币行紧凑 */
  750. .coins-row .field {
  751. margin-bottom: 0;
  752. }
  753. /* 底部按钮居中 */
  754. .dialog-footer-center {
  755. display: flex;
  756. justify-content: center;
  757. gap: 12px;
  758. }
  759. </style>