diff --git a/common/http.api.js b/common/http.api.js index ad27f87..66d84e1 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -22,6 +22,10 @@ const WinnerDatesUrl = 'mp-api/hhrsWinner/dates' const WinnerListUrl = 'mp-api/hhrsWinner/list' // 预约下单(智慧游卡包) const AppointUrl = 'zhy-api/cardBag/appoint' +// xuchao: 怀化石油汽油券(下单/预支付/最新订单查询,后端 HhVoucherController) +const VoucherCreateUrl = 'open-api/hhService/voucher/create' +const VoucherPrepayUrl = 'open-api/hhService/voucher/prepay' +const VoucherLatestUrl = 'open-api/hhService/voucher/latest' // 此处第二个参数vm,就是我们在页面使用的this const install = (Vue, vm) => { @@ -52,6 +56,11 @@ const install = (Vue, vm) => { const getWinnerDates = (params = {}) => vm.$u.get(WinnerDatesUrl, params) const getWinnerList = (params = {}) => vm.$u.post(WinnerListUrl, params) + // xuchao: 石油汽油券 + const voucherCreate = (params = {}) => vm.$u.post(VoucherCreateUrl, params) + const voucherPrepay = (params = {}) => vm.$u.post(VoucherPrepayUrl, params) + const voucherLatest = (params = {}) => vm.$u.post(VoucherLatestUrl, params) + vm.$u.api = { checkerLogin, sendLoginVerifyCode, @@ -67,7 +76,10 @@ const install = (Vue, vm) => { initFaceVerify, describeFaceVerify, getWinnerDates, - getWinnerList + getWinnerList, + voucherCreate, + voucherPrepay, + voucherLatest } } diff --git a/common/petrolVoucher.js b/common/petrolVoucher.js new file mode 100644 index 0000000..3761f0d --- /dev/null +++ b/common/petrolVoucher.js @@ -0,0 +1,62 @@ +// xuchao: 怀化石油汽油减免券——前端常量与工具(全写死,只服务这一个门店,决策 1/10/15) +// 价格真相在后端常量(20000 分),此处 200.00 仅展示用,两处改价必须同步 + +export const PETROL_SHOP_ID = '851219003520709' +export const VOUCHER_PRICE_TEXT = '200.00' +// xuchao: 非云闪付环境豁免拦截的联调手机号(决策 13) +export const VOUCHER_PAY_WHITELIST_PHONE = '18684839400' + +export const VOUCHER_NAME = '怀化石油汽油电子券' +export const VOUCHER_RULE = '加油满 200 元减 8 元' + +export const VOUCHER_GUIDE_TEXT = '请在「云闪付 App」里的「湖南社保卡」小程序首页进入「怀化市社保卡场景建设」活动中完成购买' + +// 券详情页「使用规则 / 使用流程 / 重要须知」文案,来自石油侧材料(决策 14) +export const VOUCHER_USE_RULES = [ + '请加油站收银员以“中石油汽油券”通道扫码核销', + '汽油券单日限用 1 张,多张可叠加使用', + '自购买日起 90 天内有效', + '券一经兑换不可退换' +] +export const VOUCHER_USE_FLOW = [ + '加油后至收银台出示二维码核销', + '支付差额可选:油卡 / 现金等' +] + +// xuchao: 云闪付容器判定。UA 特征 + window.upsdk 双判,真机实测后定稿(方案文档 §8 挂账项); +// 若实测 UA 关键字不符,只需调整下方正则。 +export function isUnionPayApp() { + if (typeof navigator === 'undefined' || !navigator.userAgent) return false + if (!/unionpay|upsdk|云闪付/i.test(navigator.userAgent)) return false + return typeof window !== 'undefined' && !!window.upsdk +} + +// xuchao: open-api/hhService/voucher/* 为双层壳:外层 errcode,内层 data.code 才是业务码 +// (同 login.vue 的 isBizOk 判定,提到公共层复用) +export function bizOk(res) { + if (!res || res.errcode !== 0) return false + const d = res.data + if (!d || d.code === undefined || d.code === null) { + return !d || (d.status === undefined && d.error === undefined) + } + return d.code === 200 +} + +export function bizMsg(res) { + return (res && res.data && res.data.msg) || (res && res.errmsg) || '' +} + +export function bizData(res) { + return (res && res.data && res.data.data) || {} +} + +// statusCode 含义与后端 HhVoucherService.toView 对齐:-1无单 0待支付 1发券中 2已发券 3已退款 4退款处理中 5已关闭 +export const VOUCHER_STATUS_TEXT = { + '-1': '', + 0: '待支付', + 1: '发券中', + 2: '有效', + 3: '已退款', + 4: '退款处理中', + 5: '已关闭' +} diff --git a/index.html b/index.html index 750e6f5..2591403 100644 --- a/index.html +++ b/index.html @@ -10,6 +10,8 @@ (coverSupport ? ', viewport-fit=cover' : '') + '" />') + + diff --git a/pages.json b/pages.json index a86941f..7eee50d 100644 --- a/pages.json +++ b/pages.json @@ -51,6 +51,18 @@ "navigationStyle": "custom" } }, + { + "path": "pages/petrol/orderConfirm", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/petrol/voucherDetail", + "style": { + "navigationStyle": "custom" + } + }, { "path": "pages/winners/winners", "style": { diff --git a/pages/petrol/orderConfirm.vue b/pages/petrol/orderConfirm.vue new file mode 100644 index 0000000..718f3b0 --- /dev/null +++ b/pages/petrol/orderConfirm.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/pages/petrol/voucherDetail.vue b/pages/petrol/voucherDetail.vue new file mode 100644 index 0000000..e039711 --- /dev/null +++ b/pages/petrol/voucherDetail.vue @@ -0,0 +1,240 @@ + + + + + diff --git a/pages/venue/detail.vue b/pages/venue/detail.vue index 94e3fbd..605203e 100644 --- a/pages/venue/detail.vue +++ b/pages/venue/detail.vue @@ -63,6 +63,21 @@ {{ item }} + + + + + + 汽油电子券 + + + 满200减8 汽油电子券 + 无门槛 | 90 天有效 | 单日限用 1 张 | 可叠加 + 90天 + + 支付成功后券码即时展示;到店出示二维码,收银员以“中石油汽油券”通道扫码核销。券一经售出不支持退换。 + {{ voucherBtnText }} + @@ -80,12 +95,16 @@