settings.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. <template>
  2. <view class="page">
  3. <u-navbar title="储值设置" :autoBack="true" :placeholder="true"></u-navbar>
  4. <!-- 是否接受共享 -->
  5. <view class="card switch-card">
  6. <text class="label">是否接受其他门店共享储值</text>
  7. <u-switch v-model="form.acceptShare" activeColor="#1C7CF9"></u-switch>
  8. </view>
  9. <!-- 自定义最低金额 -->
  10. <view class="card min-card">
  11. <view class="min-head">
  12. <text class="label">自定义充值最低金额</text>
  13. <text class="min-tip">默认最低金额为100</text>
  14. </view>
  15. <view class="min-input-wrap">
  16. <text class="currency">¥</text>
  17. <input
  18. class="min-input"
  19. type="digit"
  20. v-model="form.minAmount"
  21. placeholder="100"
  22. placeholder-class="placeholder"
  23. @input="onMinAmountInput"
  24. />
  25. </view>
  26. </view>
  27. <!-- 固定充值 -->
  28. <view class="section-head">
  29. <view class="section-title-row">
  30. <view class="section-bar"></view>
  31. <text class="section-title">固定充值</text>
  32. </view>
  33. <text class="section-tip">*可点击加号添加固定充值档位</text>
  34. </view>
  35. <view class="tier-list">
  36. <view class="tier-card" v-for="(item, index) in form.tiers" :key="item.id || index">
  37. <view class="tier-top">
  38. <text class="tier-name">档位{{ index + 1 }}</text>
  39. <view class="tier-ops">
  40. <view class="op" @click.stop="openTierEdit(index)">
  41. <u-icon name="edit-pen" color="#1C7CF9" size="35"></u-icon>
  42. </view>
  43. <view class="op" @click.stop="removeTier(index)">
  44. <u-icon name="trash" color="#1C7CF9" size="35"></u-icon>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="tier-body" @click="openTierEdit(index)">
  49. <view class="tier-line">
  50. <text class="k">充值金额</text>
  51. <text class="v">{{ item.amount }}</text>
  52. </view>
  53. <view class="tier-line">
  54. <text class="k">赠送金额</text>
  55. <text class="v">{{ item.giftAmount || 0 }}</text>
  56. </view>
  57. <view class="tier-line">
  58. <text class="k">优惠券</text>
  59. <text class="v">{{ getCouponCount(item) }}张</text>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="empty" v-if="!form.tiers.length && !loading">暂无固定充值档位,请点击加号添加</view>
  64. </view>
  65. <!-- 添加档位 -->
  66. <image class="fab" src="/static/topUp/add.png" mode="aspectFit" @click="openTierAdd"></image>
  67. <!-- 底部保存 -->
  68. <view class="footer">
  69. <view class="save-btn" :class="{ disabled: saving }" @click="onSave">
  70. {{ saving ? '保存中...' : '保存' }}
  71. </view>
  72. </view>
  73. <!-- 固定充值编辑弹层 -->
  74. <u-popup v-model="tierVisible" mode="right" width="100%" :mask-close-able="false">
  75. <view class="sub-page tier-page">
  76. <view class="sub-nav">
  77. <view class="sub-nav-back" @click="closeTier">
  78. <u-icon name="arrow-left" color="#333" size="36"></u-icon>
  79. </view>
  80. <text class="sub-nav-title">储值设置</text>
  81. </view>
  82. <view class="form-card">
  83. <view class="form-title">{{ tierFormTitle }}</view>
  84. <view class="form-row">
  85. <text class="form-label">充值金额</text>
  86. <input
  87. class="form-input"
  88. type="digit"
  89. v-model="tierForm.amount"
  90. placeholder="请点击输入"
  91. placeholder-class="form-placeholder"
  92. />
  93. </view>
  94. <view class="form-row">
  95. <text class="form-label">赠送金额</text>
  96. <input
  97. class="form-input"
  98. type="digit"
  99. v-model="tierForm.giftAmount"
  100. placeholder="请点击输入"
  101. placeholder-class="form-placeholder"
  102. />
  103. </view>
  104. <view class="form-row link-row" @click="openCouponSelect">
  105. <text class="form-label">赠送优惠券</text>
  106. <view class="link-right">
  107. <text class="link-text" :class="{ active: couponSelectedCount > 0 }">
  108. {{ couponSelectedCount > 0 ? '已选择' : '请选择' }}
  109. </text>
  110. <u-icon name="arrow-right" color="#c0c4cc" size="14"></u-icon>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="footer tier-footer">
  115. <view class="save-btn" :class="{ disabled: !canSubmitTier }" @click="submitTier">
  116. {{ tierEditIndex === -1 ? '确认添加' : '确认修改' }}
  117. </view>
  118. </view>
  119. </view>
  120. </u-popup>
  121. <!-- 优惠券选择弹层 -->
  122. <u-popup v-model="couponVisible" mode="right" width="100%" :mask-close-able="false">
  123. <view class="sub-page coupon-page">
  124. <view class="sub-nav">
  125. <view class="sub-nav-back" @click="closeCouponSelect">
  126. <u-icon name="arrow-left" color="#333" size="36"></u-icon>
  127. </view>
  128. <text class="sub-nav-title">优惠券</text>
  129. </view>
  130. <view class="tabs">
  131. <view
  132. class="tab"
  133. v-for="(tab, idx) in couponTabs"
  134. :key="idx"
  135. :class="{ active: couponTab === idx }"
  136. @click="switchCouponTab(idx)"
  137. >
  138. <text class="tab-text">{{ tab }}</text>
  139. <image
  140. v-if="couponTab === idx"
  141. class="tab-indicator"
  142. src="/static/topUp/tabs.png"
  143. mode="aspectFit"
  144. ></image>
  145. </view>
  146. </view>
  147. <scroll-view scroll-y class="coupon-scroll">
  148. <view
  149. class="coupon-item"
  150. v-for="item in currentCouponList"
  151. :key="item.id"
  152. @click="toggleCoupon(item)"
  153. >
  154. <view class="radio" :class="{ checked: isCouponChecked(item.id) }">
  155. <u-icon v-if="isCouponChecked(item.id)" name="checkmark" color="#fff" size="12"></u-icon>
  156. </view>
  157. <view class="coupon-ticket">
  158. <image
  159. class="ticket-bg"
  160. src="/static/topUp/bg-coupon-border.png"
  161. mode="scaleToFill"
  162. ></image>
  163. <view class="ticket-left">
  164. <text class="ticket-value" :class="{ multi: couponTab === 1 }">{{ item.display }}</text>
  165. </view>
  166. <view class="ticket-right">
  167. <text class="cname">{{ item.name }}</text>
  168. <text class="ccond" v-if="item.condition">{{ item.condition }}</text>
  169. <view class="ticket-bottom">
  170. <text class="cvalid">{{ item.validText }}</text>
  171. <view class="stepper" @click.stop>
  172. <view
  173. class="step-btn minus"
  174. :class="{ active: getCouponQty(item.id) > 0 }"
  175. @click="changeCouponQty(item.id, -1)"
  176. >
  177. <text class="step-icon">−</text>
  178. </view>
  179. <text class="step-num">{{ getCouponQty(item.id) }}</text>
  180. <view class="step-btn plus" @click="changeCouponQty(item.id, 1)">
  181. <text class="step-icon">+</text>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. <view class="empty" v-if="!currentCouponList.length && !couponLoading">暂无优惠券</view>
  189. <view class="empty" v-if="couponLoading">加载中...</view>
  190. </scroll-view>
  191. <view class="footer coupon-footer">
  192. <view
  193. class="save-btn"
  194. :class="{ disabled: tempCouponCount <= 0 }"
  195. @click="confirmCouponSelect"
  196. >
  197. {{ tempCouponCount > 0 ? `确定添加${tempCouponCount}张` : '确认添加' }}
  198. </view>
  199. </view>
  200. </view>
  201. </u-popup>
  202. </view>
  203. </template>
  204. <script>
  205. import prepaidApi from '@/api/memberPrepaid.js'
  206. function createId() {
  207. return `t_${Date.now()}_${Math.floor(Math.random() * 1000)}`;
  208. }
  209. function formatValidText(beginTime, endTime) {
  210. if (!beginTime && !endTime) return '长期有效';
  211. const begin = beginTime ? String(beginTime).slice(0, 10) : '';
  212. const end = endTime ? String(endTime).slice(0, 10) : '';
  213. if (begin && end) return `${begin} 至 ${end}`;
  214. return begin || end || '长期有效';
  215. }
  216. export default {
  217. data() {
  218. return {
  219. loading: false,
  220. saving: false,
  221. configVersion: null,
  222. form: {
  223. acceptShare: true,
  224. minAmount: '100',
  225. tiers: []
  226. },
  227. tierVisible: false,
  228. tierEditIndex: -1,
  229. tierForm: {
  230. amount: '',
  231. giftAmount: '',
  232. coupons: []
  233. },
  234. couponVisible: false,
  235. couponTab: 0,
  236. couponTabs: ['折扣券', '满减券'],
  237. tempCoupons: [],
  238. discountCoupons: [],
  239. reduceCoupons: [],
  240. couponLoading: false
  241. };
  242. },
  243. computed: {
  244. hasGiftConfig() {
  245. return (this.form.tiers || []).some((tier) => {
  246. const gift = Number(tier.giftAmount) || 0;
  247. const couponQty = (tier.coupons || []).reduce((sum, c) => sum + (Number(c.qty) || 0), 0);
  248. return gift > 0 || couponQty > 0;
  249. });
  250. },
  251. canSubmitTier() {
  252. const amount = String(this.tierForm.amount || '').trim();
  253. return !!amount && Number(amount) > 0;
  254. },
  255. tierFormTitle() {
  256. if (this.tierEditIndex === -1) {
  257. return `档位${(this.form.tiers || []).length + 1}`;
  258. }
  259. return `档位${this.tierEditIndex + 1}`;
  260. },
  261. couponSelectedCount() {
  262. return (this.tierForm.coupons || []).reduce((sum, c) => sum + (Number(c.qty) || 0), 0);
  263. },
  264. tempCouponCount() {
  265. return (this.tempCoupons || []).reduce((sum, c) => sum + (Number(c.qty) || 0), 0);
  266. },
  267. currentCouponList() {
  268. return this.couponTab === 0 ? this.discountCoupons : this.reduceCoupons;
  269. }
  270. },
  271. onLoad() {
  272. this.loadSettings();
  273. },
  274. methods: {
  275. onMinAmountInput(e) {
  276. const val = String((e && e.detail && e.detail.value) || this.form.minAmount || '')
  277. .replace(/[^\d]/g, '');
  278. this.$nextTick(() => {
  279. this.form.minAmount = val;
  280. });
  281. },
  282. loadSettings() {
  283. this.loading = true;
  284. prepaidApi
  285. .getRechargeConfig()
  286. .then((res) => {
  287. if (res.data.code !== 200 || !res.data.result) {
  288. uni.showToast({ title: res.data.message || '加载失败', icon: 'none' });
  289. return;
  290. }
  291. const data = res.data.result;
  292. this.configVersion = data.version;
  293. const tiers = Array.isArray(data.tiers) ? data.tiers : [];
  294. this.form = {
  295. acceptShare: data.acceptSharedPrepaid !== false,
  296. minAmount:
  297. data.customMinAmount != null ? String(data.customMinAmount) : '100',
  298. tiers: tiers.map((tier) => ({
  299. id: tier.tierId || createId(),
  300. amount: Number(tier.rechargeAmount) || 0,
  301. giftAmount: Number(tier.giftAmount) || 0,
  302. coupons: (tier.coupons || []).map((c) => ({
  303. id: c.couponId,
  304. name: c.couponName || '',
  305. type: String(c.couponType) === '2' ? 'discount' : 'reduce',
  306. qty: Number(c.quantity) || 1
  307. }))
  308. }))
  309. };
  310. })
  311. .catch(() => {
  312. uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
  313. })
  314. .finally(() => {
  315. this.loading = false;
  316. });
  317. },
  318. getCouponCount(item) {
  319. return (item.coupons || []).reduce((sum, c) => sum + (Number(c.qty) || 0), 0);
  320. },
  321. openTierAdd() {
  322. this.tierEditIndex = -1;
  323. this.tierForm = { amount: '', giftAmount: '', coupons: [] };
  324. this.tierVisible = true;
  325. },
  326. openTierEdit(index) {
  327. const item = this.form.tiers[index];
  328. this.tierEditIndex = index;
  329. this.tierForm = {
  330. amount: item.amount != null ? String(item.amount) : '',
  331. giftAmount: item.giftAmount != null ? String(item.giftAmount) : '',
  332. coupons: JSON.parse(JSON.stringify(item.coupons || []))
  333. };
  334. this.tierVisible = true;
  335. },
  336. closeTier() {
  337. this.tierVisible = false;
  338. },
  339. removeTier(index) {
  340. uni.showModal({
  341. title: '提示',
  342. content: '确认删除该充值档位吗?',
  343. confirmColor: '#fa3534',
  344. success: (res) => {
  345. if (res.confirm) {
  346. this.form.tiers.splice(index, 1);
  347. }
  348. }
  349. });
  350. },
  351. submitTier() {
  352. if (!this.canSubmitTier) return;
  353. const amountStr = String(this.tierForm.amount || '').trim();
  354. if (!/^\d+(\.\d{1,2})?$/.test(amountStr) || Number(amountStr) <= 0) {
  355. uni.showToast({ title: '充值金额须大于0', icon: 'none' });
  356. return;
  357. }
  358. const amount = Number(amountStr);
  359. const giftRaw = String(this.tierForm.giftAmount || '').trim();
  360. const giftAmount = giftRaw === '' ? 0 : Number(giftRaw);
  361. if (Number.isNaN(giftAmount) || giftAmount < 0) {
  362. uni.showToast({ title: '赠送金额格式不正确', icon: 'none' });
  363. return;
  364. }
  365. const payload = {
  366. id: this.tierEditIndex === -1 ? createId() : this.form.tiers[this.tierEditIndex].id,
  367. amount,
  368. giftAmount,
  369. coupons: JSON.parse(JSON.stringify(this.tierForm.coupons || []))
  370. };
  371. if (this.tierEditIndex === -1) {
  372. this.form.tiers.push(payload);
  373. } else {
  374. this.$set(this.form.tiers, this.tierEditIndex, payload);
  375. }
  376. this.tierVisible = false;
  377. },
  378. mapCouponItem(item) {
  379. const type = String(item.couponType);
  380. const isDiscount = type === '2';
  381. return {
  382. id: item.couponId,
  383. name: item.couponName || '',
  384. display: item.contentInfo || (isDiscount ? '折扣' : '优惠'),
  385. condition: item.contentConditions || '',
  386. validText: formatValidText(item.beginTime, item.endTime),
  387. remainingQuantity: Number(item.remainingQuantity) || 0
  388. };
  389. },
  390. switchCouponTab(idx) {
  391. this.couponTab = idx;
  392. this.loadCoupons();
  393. },
  394. openCouponSelect() {
  395. this.tempCoupons = JSON.parse(JSON.stringify(this.tierForm.coupons || []));
  396. this.couponTab = 0;
  397. this.couponVisible = true;
  398. this.loadCoupons();
  399. },
  400. closeCouponSelect() {
  401. this.couponVisible = false;
  402. },
  403. loadCoupons() {
  404. this.couponLoading = true;
  405. // couponType: 1满减 2折扣;tabs: 0折扣 1满减
  406. const couponType = this.couponTab === 0 ? '2' : '1';
  407. prepaidApi
  408. .getCouponPage({ couponType, pageNo: 1, pageSize: 100 })
  409. .then((res) => {
  410. if (res.data.code !== 200) {
  411. uni.showToast({ title: res.data.message || '优惠券加载失败', icon: 'none' });
  412. return;
  413. }
  414. const page = res.data.result || {};
  415. const records = Array.isArray(page.records) ? page.records : [];
  416. const list = records.map((item) => this.mapCouponItem(item));
  417. if (this.couponTab === 0) {
  418. this.discountCoupons = list;
  419. } else {
  420. this.reduceCoupons = list;
  421. }
  422. })
  423. .catch(() => {
  424. uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
  425. })
  426. .finally(() => {
  427. this.couponLoading = false;
  428. });
  429. },
  430. isCouponChecked(id) {
  431. return this.tempCoupons.some((c) => c.id === id && Number(c.qty) > 0);
  432. },
  433. getCouponQty(id) {
  434. const found = this.tempCoupons.find((c) => c.id === id);
  435. return found ? Number(found.qty) || 0 : 0;
  436. },
  437. findCouponMeta(id) {
  438. return (
  439. this.discountCoupons.find((c) => c.id === id) ||
  440. this.reduceCoupons.find((c) => c.id === id) ||
  441. null
  442. );
  443. },
  444. toggleCoupon(item) {
  445. const idx = this.tempCoupons.findIndex((c) => c.id === item.id);
  446. if (idx >= 0 && Number(this.tempCoupons[idx].qty) > 0) {
  447. this.tempCoupons.splice(idx, 1);
  448. return;
  449. }
  450. if (idx >= 0) {
  451. this.$set(this.tempCoupons[idx], 'qty', 1);
  452. } else {
  453. this.tempCoupons.push({
  454. id: item.id,
  455. name: item.name,
  456. type: this.couponTab === 0 ? 'discount' : 'reduce',
  457. qty: 1
  458. });
  459. }
  460. },
  461. changeCouponQty(id, delta) {
  462. const idx = this.tempCoupons.findIndex((c) => c.id === id);
  463. const meta = this.findCouponMeta(id);
  464. if (idx < 0) {
  465. if (delta > 0 && meta) {
  466. this.tempCoupons.push({
  467. id,
  468. name: meta.name,
  469. type: this.couponTab === 0 ? 'discount' : 'reduce',
  470. qty: 1
  471. });
  472. }
  473. return;
  474. }
  475. const next = Math.max(0, (Number(this.tempCoupons[idx].qty) || 0) + delta);
  476. if (next === 0) {
  477. this.tempCoupons.splice(idx, 1);
  478. } else {
  479. this.$set(this.tempCoupons[idx], 'qty', next);
  480. }
  481. },
  482. confirmCouponSelect() {
  483. this.tierForm.coupons = this.tempCoupons
  484. .filter((c) => Number(c.qty) > 0)
  485. .map((c) => ({ ...c, qty: Number(c.qty) }));
  486. this.couponVisible = false;
  487. },
  488. onSave() {
  489. if (this.saving) return;
  490. if (this.form.tiers.length < 2) {
  491. uni.showToast({ title: '至少配置2个固定充值档位', icon: 'none' });
  492. return;
  493. }
  494. const amounts = this.form.tiers.map((t) => Number(t.amount) || 0);
  495. for (let i = 1; i < amounts.length; i++) {
  496. if (amounts[i] <= amounts[i - 1]) {
  497. uni.showToast({ title: '档位充值金额须严格递增', icon: 'none' });
  498. return;
  499. }
  500. }
  501. // 有赠送余额/优惠券时接口要求关闭自定义充值
  502. const customAmountEnabled = !this.hasGiftConfig;
  503. const minRaw = String(this.form.minAmount || '').trim();
  504. let customMinAmount = 100;
  505. if (minRaw !== '') {
  506. customMinAmount = Number(minRaw);
  507. if (!customMinAmount || customMinAmount < 100) {
  508. uni.showToast({ title: '自定义最低金额不得低于100', icon: 'none' });
  509. return;
  510. }
  511. }
  512. const payload = {
  513. acceptSharedPrepaid: !!this.form.acceptShare,
  514. customAmountEnabled,
  515. customMinAmount,
  516. tiers: this.form.tiers.map((tier) => ({
  517. rechargeAmount: Number(tier.amount),
  518. giftAmount: Number(tier.giftAmount) || 0,
  519. coupons: (tier.coupons || [])
  520. .filter((c) => Number(c.qty) > 0)
  521. .map((c) => ({
  522. couponId: c.id,
  523. quantity: Number(c.qty)
  524. }))
  525. }))
  526. };
  527. if (this.configVersion != null) {
  528. payload.version = this.configVersion;
  529. }
  530. this.saving = true;
  531. prepaidApi
  532. .saveRechargeConfig(payload)
  533. .then((res) => {
  534. if (res.data.code === 200) {
  535. uni.showToast({ title: '保存成功', icon: 'none' });
  536. setTimeout(() => {
  537. uni.navigateBack();
  538. }, 500);
  539. } else {
  540. uni.showToast({ title: res.data.message || '保存失败', icon: 'none' });
  541. }
  542. })
  543. .catch(() => {
  544. uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
  545. })
  546. .finally(() => {
  547. this.saving = false;
  548. });
  549. }
  550. }
  551. };
  552. </script>
  553. <style scoped lang="scss">
  554. .page {
  555. min-height: 100vh;
  556. background: #f5f5f5;
  557. padding: 24rpx;
  558. padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
  559. box-sizing: border-box;
  560. }
  561. .card {
  562. background: #fff;
  563. border-radius: 16rpx;
  564. margin-bottom: 24rpx;
  565. }
  566. .switch-card {
  567. display: flex;
  568. align-items: center;
  569. justify-content: space-between;
  570. padding: 28rpx 28rpx;
  571. .label {
  572. font-size: 28rpx;
  573. color: #333;
  574. flex: 1;
  575. padding-right: 24rpx;
  576. }
  577. }
  578. .min-card {
  579. padding: 28rpx 28rpx 32rpx;
  580. .min-head {
  581. display: flex;
  582. align-items: center;
  583. justify-content: space-between;
  584. margin-bottom: 28rpx;
  585. .label {
  586. font-size: 28rpx;
  587. color: #333;
  588. }
  589. .min-tip {
  590. font-size: 22rpx;
  591. color: #999;
  592. }
  593. }
  594. .min-input-wrap {
  595. display: flex;
  596. align-items: baseline;
  597. padding-bottom: 16rpx;
  598. border-bottom: 1px solid #e8e8e8;
  599. .currency {
  600. font-size: 40rpx;
  601. color: #999;
  602. margin-right: 8rpx;
  603. line-height: 1;
  604. }
  605. .min-input {
  606. flex: 1;
  607. font-size: 40rpx;
  608. color: #333;
  609. line-height: 1.2;
  610. }
  611. }
  612. }
  613. .placeholder {
  614. color: #bbb;
  615. font-size: 40rpx;
  616. }
  617. .section-head {
  618. margin: 8rpx 0 20rpx;
  619. padding: 0 4rpx;
  620. .section-title-row {
  621. display: flex;
  622. align-items: center;
  623. margin-bottom: 10rpx;
  624. }
  625. .section-bar {
  626. width: 8rpx;
  627. height: 28rpx;
  628. border-radius: 4rpx;
  629. background: #1c7cf9;
  630. margin-right: 12rpx;
  631. flex-shrink: 0;
  632. }
  633. .section-title {
  634. font-size: 30rpx;
  635. font-weight: 600;
  636. color: #333;
  637. }
  638. .section-tip {
  639. font-size: 22rpx;
  640. color: #999;
  641. padding-left: 20rpx;
  642. }
  643. }
  644. .tier-list {
  645. padding-bottom: 40rpx;
  646. }
  647. .tier-card {
  648. background: #fff;
  649. border-radius: 16rpx;
  650. padding: 28rpx;
  651. margin-bottom: 20rpx;
  652. .tier-top {
  653. display: flex;
  654. align-items: center;
  655. justify-content: space-between;
  656. margin-bottom: 8rpx;
  657. .tier-name {
  658. font-size: 30rpx;
  659. font-weight: 600;
  660. color: #333;
  661. }
  662. .tier-ops {
  663. display: flex;
  664. align-items: center;
  665. gap: 28rpx;
  666. .op {
  667. padding: 4rpx;
  668. }
  669. }
  670. }
  671. .tier-line {
  672. display: flex;
  673. justify-content: space-between;
  674. align-items: center;
  675. padding: 18rpx 0;
  676. border-bottom: 1px solid #f2f2f2;
  677. font-size: 26rpx;
  678. &:last-child {
  679. border-bottom: none;
  680. padding-bottom: 0;
  681. }
  682. .k {
  683. color: #999;
  684. }
  685. .v {
  686. color: #333;
  687. }
  688. }
  689. }
  690. .empty {
  691. padding: 80rpx 0;
  692. text-align: center;
  693. color: #ccc;
  694. font-size: 26rpx;
  695. }
  696. .fab {
  697. position: fixed;
  698. right: 40rpx;
  699. bottom: calc(170rpx + env(safe-area-inset-bottom));
  700. width: 60rpx;
  701. height: 60rpx;
  702. z-index: 20;
  703. }
  704. .footer {
  705. position: fixed;
  706. left: 0;
  707. right: 0;
  708. bottom: 0;
  709. padding: 20rpx 40rpx calc(20rpx + env(safe-area-inset-bottom));
  710. background: transparent;
  711. z-index: 30;
  712. .save-btn {
  713. height: 88rpx;
  714. line-height: 88rpx;
  715. text-align: center;
  716. border-radius: 44rpx;
  717. background: #1c7cf9;
  718. color: #fff;
  719. font-size: 32rpx;
  720. font-weight: 500;
  721. &.disabled {
  722. background: #c0c4cc;
  723. }
  724. }
  725. &.sub-footer {
  726. position: relative;
  727. z-index: 1;
  728. flex-shrink: 0;
  729. background: #fff;
  730. box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
  731. .save-btn {
  732. border-radius: 12rpx;
  733. background: #2979ff;
  734. }
  735. }
  736. &.tier-footer,
  737. &.coupon-footer {
  738. position: fixed;
  739. left: 0;
  740. right: 0;
  741. bottom: 0;
  742. padding: 20rpx 40rpx calc(20rpx + env(safe-area-inset-bottom));
  743. background: transparent;
  744. box-shadow: none;
  745. .save-btn {
  746. border-radius: 44rpx;
  747. background: linear-gradient(90deg, #4da3ff 0%, #1c7cf9 100%);
  748. &.disabled {
  749. background: linear-gradient(90deg, rgba(77, 163, 255, 0.35) 0%, rgba(28, 124, 249, 0.35) 100%);
  750. color: rgba(255, 255, 255, 0.9);
  751. }
  752. }
  753. }
  754. }
  755. .sub-nav {
  756. display: flex;
  757. align-items: center;
  758. justify-content: center;
  759. position: relative;
  760. height: 88rpx;
  761. padding-top: var(--status-bar-height);
  762. background: #fff;
  763. border-bottom: 1px solid #f0f0f0;
  764. box-sizing: content-box;
  765. .sub-nav-back {
  766. position: absolute;
  767. left: 24rpx;
  768. bottom: 0;
  769. height: 88rpx;
  770. display: flex;
  771. align-items: center;
  772. padding: 0 12rpx;
  773. }
  774. .sub-nav-title {
  775. font-size: 32rpx;
  776. color: #333;
  777. font-weight: 500;
  778. line-height: 88rpx;
  779. }
  780. }
  781. .sub-page {
  782. width: 100vw;
  783. height: 100vh;
  784. background: #f5f5f5;
  785. display: flex;
  786. flex-direction: column;
  787. box-sizing: border-box;
  788. padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
  789. }
  790. .tier-page {
  791. .form-card {
  792. margin-top: 24rpx;
  793. }
  794. }
  795. .form-card {
  796. margin: 24rpx;
  797. background: #fff;
  798. border-radius: 16rpx;
  799. overflow: hidden;
  800. flex-shrink: 0;
  801. .form-title {
  802. padding: 28rpx 28rpx 8rpx;
  803. font-size: 30rpx;
  804. font-weight: 600;
  805. color: #333;
  806. }
  807. .form-row {
  808. display: flex;
  809. align-items: center;
  810. justify-content: space-between;
  811. padding: 28rpx;
  812. border-bottom: 1px solid #f2f2f2;
  813. &:last-child {
  814. border-bottom: none;
  815. }
  816. }
  817. .form-label {
  818. font-size: 28rpx;
  819. color: #333;
  820. width: 200rpx;
  821. flex-shrink: 0;
  822. }
  823. .form-input {
  824. flex: 1;
  825. text-align: right;
  826. font-size: 28rpx;
  827. color: #333;
  828. }
  829. .form-placeholder {
  830. color: #c0c4cc;
  831. font-size: 28rpx;
  832. }
  833. .link-row {
  834. .link-right {
  835. display: flex;
  836. align-items: center;
  837. gap: 8rpx;
  838. }
  839. .link-text {
  840. font-size: 28rpx;
  841. color: #c0c4cc;
  842. &.active {
  843. color: #333;
  844. }
  845. }
  846. }
  847. }
  848. .coupon-page {
  849. $coupon-orange: #ff5f3e;
  850. $ticket-left-w: 28%;
  851. .tabs {
  852. display: flex;
  853. background: #fff;
  854. border-bottom: 1px solid #f0f0f0;
  855. flex-shrink: 0;
  856. padding-bottom: 4rpx;
  857. .tab {
  858. flex: 1;
  859. display: flex;
  860. align-items: center;
  861. justify-content: center;
  862. height: 88rpx;
  863. position: relative;
  864. .tab-text {
  865. font-size: 28rpx;
  866. color: #999;
  867. line-height: 1.2;
  868. }
  869. .tab-indicator {
  870. position: absolute;
  871. left: 50%;
  872. bottom: 10rpx;
  873. transform: translateX(-50%);
  874. width: 48rpx;
  875. height: 12rpx;
  876. }
  877. &.active {
  878. .tab-text {
  879. color: #1c7cf9;
  880. font-weight: 600;
  881. }
  882. }
  883. }
  884. }
  885. .coupon-scroll {
  886. flex: 1;
  887. height: 0;
  888. padding: 24rpx;
  889. box-sizing: border-box;
  890. }
  891. .coupon-item {
  892. display: flex;
  893. align-items: center;
  894. background: #fff;
  895. border-radius: 16rpx;
  896. padding: 24rpx 20rpx;
  897. margin-bottom: 20rpx;
  898. gap: 18rpx;
  899. }
  900. .radio {
  901. width: 34rpx;
  902. height: 34rpx;
  903. border-radius: 50%;
  904. border: 2rpx solid #c8c8c8;
  905. display: flex;
  906. align-items: center;
  907. justify-content: center;
  908. flex-shrink: 0;
  909. box-sizing: border-box;
  910. &.checked {
  911. background: #1c7cf9;
  912. border-color: #1c7cf9;
  913. }
  914. }
  915. .coupon-ticket {
  916. position: relative;
  917. flex: 1;
  918. min-width: 0;
  919. display: flex;
  920. align-items: stretch;
  921. min-height: 180rpx;
  922. box-sizing: border-box;
  923. }
  924. .ticket-bg {
  925. position: absolute;
  926. left: 0;
  927. top: 0;
  928. width: 100%;
  929. height: 100%;
  930. z-index: 0;
  931. pointer-events: none;
  932. }
  933. .ticket-left {
  934. position: relative;
  935. z-index: 1;
  936. width: $ticket-left-w;
  937. flex-shrink: 0;
  938. display: flex;
  939. align-items: center;
  940. justify-content: center;
  941. padding: 24rpx 16rpx 24rpx 20rpx;
  942. box-sizing: border-box;
  943. }
  944. .ticket-value {
  945. font-size: 44rpx;
  946. font-weight: 700;
  947. color: $coupon-orange;
  948. text-align: center;
  949. line-height: 1.2;
  950. word-break: break-all;
  951. &.multi {
  952. font-size: 26rpx;
  953. line-height: 1.35;
  954. }
  955. }
  956. .ticket-right {
  957. position: relative;
  958. z-index: 1;
  959. flex: 1;
  960. min-width: 0;
  961. padding: 22rpx 24rpx 18rpx 28rpx;
  962. display: flex;
  963. flex-direction: column;
  964. box-sizing: border-box;
  965. }
  966. .cname {
  967. font-size: 28rpx;
  968. font-weight: 600;
  969. color: #333;
  970. margin-bottom: 8rpx;
  971. overflow: hidden;
  972. text-overflow: ellipsis;
  973. white-space: nowrap;
  974. line-height: 1.3;
  975. }
  976. .ccond {
  977. font-size: 24rpx;
  978. color: $coupon-orange;
  979. line-height: 1.4;
  980. margin-bottom: 8rpx;
  981. }
  982. .ticket-bottom {
  983. margin-top: auto;
  984. display: flex;
  985. align-items: center;
  986. justify-content: space-between;
  987. gap: 12rpx;
  988. }
  989. .cvalid {
  990. flex: 1;
  991. min-width: 0;
  992. font-size: 22rpx;
  993. color: #999;
  994. line-height: 1.4;
  995. overflow: hidden;
  996. text-overflow: ellipsis;
  997. white-space: nowrap;
  998. }
  999. .stepper {
  1000. display: flex;
  1001. align-items: center;
  1002. flex-shrink: 0;
  1003. gap: 12rpx;
  1004. .step-btn {
  1005. width: 36rpx;
  1006. height: 36rpx;
  1007. border-radius: 6rpx;
  1008. display: flex;
  1009. align-items: center;
  1010. justify-content: center;
  1011. box-sizing: border-box;
  1012. .step-icon {
  1013. font-size: 26rpx;
  1014. line-height: 1;
  1015. color: #fff;
  1016. font-weight: 500;
  1017. }
  1018. &.minus {
  1019. background: #d0d0d0;
  1020. &.active {
  1021. background: $coupon-orange;
  1022. }
  1023. }
  1024. &.plus {
  1025. background: $coupon-orange;
  1026. }
  1027. }
  1028. .step-num {
  1029. min-width: 28rpx;
  1030. text-align: center;
  1031. font-size: 28rpx;
  1032. color: #333;
  1033. line-height: 36rpx;
  1034. }
  1035. }
  1036. }
  1037. </style>