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.

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