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.

868 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
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
  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 class="father1">
  477. <div class="left">
  478. <el-form :model="addConsume" ref="Ref" :rules="rules" style="max-width: 600px;" class="add-form" label-width="auto" label-position="right">
  479. <el-form-item prop="jwcode" label="精网号" style="margin-top: 50px">
  480. <el-input v-model="addConsume.jwcode" style="width: 10vw;"/>
  481. <el-button type="primary" @click="getUser(addConsume.jwcode)" style="margin-left: 10px">查询
  482. </el-button>
  483. </el-form-item>
  484. <el-form-item prop="goodsName" label="商品名称" style="flex: 1; margin-right: 0px">
  485. <el-select v-model="addConsume.goodsName" placeholder="请选择商品" style="width: 10vw;" clearable filterable
  486. >
  487. <el-option v-for="(item, index) in goods" :key="index" :label="item.label" :value="item"/>
  488. </el-select>
  489. </el-form-item>
  490. <el-form-item prop="sumGold" label="消耗金币总数">
  491. <el-input v-model="addConsume.sumGold" style="width: 10vw;" @input="validateInput()"
  492. @change="calculateCoins(addConsume.sumGold)"/>
  493. </el-form-item>
  494. <!-- 三类金币自动计算禁用状态不可编辑 -->
  495. <el-form-item prop="permanentGold" label="永久金币">
  496. <el-input v-model="addConsume.permanentGold" disabled style="width: 10vw;">
  497. <template #default="scope">{{ scope.row.permanentGold }}</template>
  498. </el-input>
  499. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  500. </el-form-item>
  501. <el-form-item prop="freeCoin" label="免费金币">
  502. <el-input disabled v-model="addConsume.freeGold" style="width: 10vw;"/>
  503. <p style="margin-right: 0px">&nbsp;&nbsp;</p>
  504. </el-form-item>
  505. <el-form-item prop="taskGold" label="任务金币">
  506. <el-input disabled v-model="addConsume.taskGold" style="width: 10vw;"/>
  507. <p style="margin-right: 20px">&nbsp;&nbsp;</p>
  508. </el-form-item>
  509. <el-form-item prop="remark" label="备注">
  510. <el-input v-model="addConsume.remark" style="width: 13.5vw;" :rows="4" maxlength="100"
  511. show-word-limit type="textarea"/>
  512. </el-form-item>
  513. <el-button type="success" @click="resetForm()" style="margin-left: 200px;margin-top:10px">重置</el-button>
  514. <el-button type="primary" :disabled="addDisabled" @click="addBefore" style="margin-top:10px"> 提交</el-button>
  515. </el-form>
  516. </div>
  517. <div class="right">
  518. <!-- 客户信息栏 -->
  519. <el-card v-if="user.jwcode" style="width: 800px; float: right" class="customer-info">
  520. <el-form :model="user" label-width="auto" style="max-width: 1000px" label-position="left">
  521. <el-text size="large" style="margin-left: 20px">客户信息</el-text>
  522. <!-- 第一行姓名 + 历史金币 -->
  523. <el-row style="margin-top: 20px">
  524. <el-col :span="9">
  525. <el-form-item label="姓名">
  526. <p>{{ user.name }}</p>
  527. </el-form-item>
  528. </el-col>
  529. <el-col :span="14">
  530. <el-form-item label="当前金币总数" style="width: 500px">
  531. <span style="color: #2fa1ff; margin-right: 5px" v-if="user.nowSumGold !== undefined">{{
  532. user.nowSumGold
  533. }}</span>
  534. </el-form-item>
  535. <!-- 金币详情独立显示 -->
  536. <el-form-item style="margin-top: -23px"> <!-- 负边距减少间距 -->
  537. <span style="color: #b1b1b1; margin-left: 0px" v-if="user.nowPermanentGold !== undefined">(永久金币:{{
  538. user.nowPermanentGold
  539. }};
  540. 免费金币:{{ user.nowFreeGold }};
  541. 任务金币:{{ user.nowTaskGold }})</span>
  542. </el-form-item>
  543. </el-col>
  544. </el-row>
  545. <!-- 第二行精网号 + 当前金币独立行 -->
  546. <el-row>
  547. <el-col :span="9">
  548. <el-form-item label="精网号">
  549. <p>{{ user.jwcode }}</p>
  550. </el-form-item>
  551. </el-col>
  552. <el-col :span="14">
  553. <el-form-item label="充值次数">
  554. <p style="color: #2fa1ff">{{ user.rechargeNum }}</p>
  555. </el-form-item>
  556. </el-col>
  557. </el-row>
  558. <!-- 第三行首次充值日期 + 充值次数 -->
  559. <el-row >
  560. <el-col :span="9">
  561. <el-form-item label="首次充值日期">
  562. <p v-if="user.firstRecharge">
  563. {{ moment(user.firstRecharge).format('YYYY-MM-DD HH:mm:ss') }}
  564. </p>
  565. </el-form-item>
  566. </el-col>
  567. <el-col :span="14">
  568. <el-form-item label="消费次数">
  569. <p style="color: #2fa1ff">{{ user.consumeNum }}</p>
  570. </el-form-item>
  571. </el-col>
  572. </el-row>
  573. <!-- 第四行消费次数 + 所属门店 -->
  574. <el-row>
  575. <el-col :span="9">
  576. <el-form-item label="所属门店">
  577. <p>{{ user.market }}</p>
  578. </el-form-item>
  579. </el-col>
  580. </el-row>
  581. </el-form>
  582. </el-card>
  583. <el-dialog
  584. v-model="FirstConsumeDialogVisible"
  585. title="操作确认"
  586. :before-close="FirstConsumeDialogVisiblehandleClose"
  587. :close-on-click-modal="false"
  588. width="480px"
  589. >
  590. <!-- 内容整体居中且收窄 -->
  591. <div class="confirm-body">
  592. <!-- 用户信息 -->
  593. <div>
  594. <div class="field-label">用户信息</div>
  595. <el-input :model-value="user.jwcode + (user.name ? '' + user.name + '' : '')" disabled/>
  596. </div>
  597. <!-- 活动名称 -->
  598. <div class="field">
  599. <div class="field-label">商品名称</div>
  600. <el-input v-model="addConsume.goodsName" disabled/>
  601. </div>
  602. <!--金币总数 -->
  603. <div class="field">
  604. <div class="field-label">金币总数</div>
  605. <el-input v-model="addConsume.sumGold" disabled/>
  606. </div>
  607. <!-- 金币详细信息同一行左右排列 -->
  608. <el-row :gutter="20" class="coins-row">
  609. <el-col :span="8">
  610. <div class="field">
  611. <div class="field-label">永久金币</div>
  612. <el-input v-model="addConsume.permanentGold" 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.freeGold" disabled/>
  619. </div>
  620. </el-col>
  621. <el-col :span="8">
  622. <div class="field">
  623. <div class="field-label">任务金币</div>
  624. <el-input v-model="addConsume.taskGold" disabled/>
  625. </div>
  626. </el-col>
  627. </el-row>
  628. <div class="field">
  629. <div class="field-label">备注</div>
  630. <el-input v-model="addConsume.remark" disabled/>
  631. </div>
  632. </div>
  633. <!-- 底部按钮居中 -->
  634. <template #footer>
  635. <div class="dialog-footer-center">
  636. <el-button @click="FirstConsumeDialogVisibleCancel"> </el-button>
  637. <el-button type="primary" @click="FirstConsumeDialogVisibleContinue">确认购买</el-button>
  638. </div>
  639. </template>
  640. </el-dialog>
  641. <el-dialog v-model="ConsumeDialogVisible" title="第二次操作确认" :before-close="ConsumeDialogVisiblehandleClose"
  642. :close-on-click-modal="false" width="480px">
  643. <!-- 内容整体居中且收窄 -->
  644. <div class="confirm-body">
  645. <!-- 用户信息 -->
  646. <div>
  647. <div class="field-label">用户信息</div>
  648. <el-input :model-value="user.jwcode + (user.name ? '' + user.name + '' : '')" disabled/>
  649. </div>
  650. <!-- 活动名称 -->
  651. <div class="field">
  652. <div class="field-label">商品名称</div>
  653. <el-input v-model="addConsume.goodsName" disabled/>
  654. </div>
  655. <!--金币总数 -->
  656. <div class="field">
  657. <div class="field-label">金币总数</div>
  658. <el-input v-model="addConsume.sumGold" disabled/>
  659. </div>
  660. <!-- 金币详细信息同一行左右排列 -->
  661. <el-row :gutter="20" class="coins-row">
  662. <el-col :span="8">
  663. <div class="field">
  664. <div class="field-label">永久金币</div>
  665. <el-input v-model="addConsume.permanentGold" 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.freeGold" disabled/>
  672. </div>
  673. </el-col>
  674. <el-col :span="8">
  675. <div class="field">
  676. <div class="field-label">任务金币</div>
  677. <el-input v-model="addConsume.taskGold" disabled/>
  678. </div>
  679. </el-col>
  680. </el-row>
  681. <!-- 风险提示 -->
  682. <div style="display: flex; align-items: center; margin-top: 20px;">
  683. <el-icon :size="24" color="#FFD700">
  684. <WarnTriangleFilled/>
  685. </el-icon>
  686. <p>重复购买风险提示</p>
  687. </div>
  688. <!-- 记录 + 虚线分隔 -->
  689. <div>
  690. <el-divider border-style="dashed"/>
  691. <p>检测到该用户近期有相似消费记录</p>
  692. · {{ ReadCookiesTime }} 购买 {{ addConsume.goodsName }}(操作人: {{ adminData.adminName }})
  693. </div>
  694. <div style="margin-top: 10px">
  695. <p>是否继续操作</p>
  696. </div>
  697. </div>
  698. <!-- 底部按钮居中 -->
  699. <template #footer>
  700. <div class="dialog-footer-center">
  701. <el-button @click="ConsumeDialogVisibleCancel"> </el-button>
  702. <el-button type="primary" @click="ConsumeDialogVisibleContinue">确认购买</el-button>
  703. </div>
  704. </template>
  705. </el-dialog>
  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. .field-label {
  739. font-size: 14px;
  740. color: #606266;
  741. margin-bottom: 6px;
  742. }
  743. /* 金币行紧凑 */
  744. .coins-row .field {
  745. margin-bottom: 0;
  746. }
  747. /* 底部按钮居中 */
  748. .dialog-footer-center {
  749. display: flex;
  750. justify-content: center;
  751. gap: 12px;
  752. }
  753. .father1 {
  754. width: 100%;
  755. height: 100%;
  756. display: flex;
  757. .left {
  758. width: 35%;
  759. float: left;
  760. align-items: center;
  761. }
  762. .right {
  763. flex: 1;
  764. display: flex;
  765. justify-content: center;
  766. align-items: center;
  767. .customer-info {
  768. width: 80%;
  769. height: 70%;
  770. display: flex;
  771. justify-content: center;
  772. align-items: center;
  773. }
  774. }
  775. }
  776. </style>