diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 038e443..f0defcf 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -10,20 +10,6 @@ onLoad(() => { // .then(res=>{ // console.log('stadiumFind', res); // }) - tt.login({ - success() { - tt.showToast({ - title: "登录成功", - icon: "success", - }); - }, - fail() { - tt.showToast({ - title: "登录失败", - icon: "fail", - }); - }, - }); }); diff --git a/src/subpackage/groupon/api/index.js b/src/subpackage/groupon/api/index.js index 8015646..feb4519 100644 --- a/src/subpackage/groupon/api/index.js +++ b/src/subpackage/groupon/api/index.js @@ -8,6 +8,7 @@ export const userCertificates = params => server.post({ url: '/douyinMiniapp/202 export const countCity = params => server.post({ url: '/stadium/count/city', ...params }); // A主页-选择门店-城市列表 export const stadiumFind = params => server.post({ url: '/stadium/find', ...params }); // 门店列表 export const jsapiPreVerifyCertificates = params => server.post({ url: '/douyinMiniapp/202506/jsapiPreVerifyCertificates', ...params }); // 票券核销 +export const orderAdd = params => server.post({ url: '/stadium/order/add', ...params }); // 生成场馆预约订单 diff --git a/src/subpackage/groupon/components/site/table.vue b/src/subpackage/groupon/components/site/table.vue index 6294c07..df99c29 100644 --- a/src/subpackage/groupon/components/site/table.vue +++ b/src/subpackage/groupon/components/site/table.vue @@ -4,14 +4,14 @@ import { reactive, ref, computed, nextTick } from 'vue'; import { deepClone } from "@/utils"; import { showNone } from "@/utils/polish"; import { AutoSelect } from "../../js/site_select/autoSelect"; -const emits = defineEmits([ 'update:table' ]); +const emits = defineEmits([ 'update:sitetable' ]); const props = defineProps({ - tableData: { default: [] }, + sitetable: { default: [] }, altitude: { default: 0 } }) const timeList = computed(_=> { - let _table = props?.tableData; + let _table = props?.sitetable; if(_table?.length <= 0)return []; let _items = _table?.[0]?.items ?? [], _tempArr; if(_items?.length <=0)return []; @@ -29,7 +29,7 @@ onLoad(() => { const itemClick = function(k, i, j){ if(k.is_valid === false)return showNone('该场次已出售'); - let _tableCopy = deepClone(props?.tableData); + let _tableCopy = deepClone(props?.sitetable); _tableCopy[i].items[j]._is_selected = !k?._is_selected; // 自动勾选连场和起订 // 获取设置场地列表 @@ -45,7 +45,7 @@ const itemClick = function(k, i, j){ // 提示弹窗 nextTick(_=>autoSelect.showModalList(_noticeList || [])); - emits('update:table', _tableCopy); + emits('update:sitetable', _tableCopy); } @@ -62,10 +62,10 @@ const itemClick = function(k, i, j){ - {{ e.name || '-' }} + {{ e.name || '-' }} - + { const instance = getCurrentInstance().proxy const eventChannel = instance.getOpenerEventChannel(); eventChannel.on('dataFromGrouponSiteSelect', data => { - stadiumInfo.value = data?.stadium ?? {}; - ticketInfo.value = data?.ticket ?? {}; - venueData.value = data?.venueInfo ?? {}; + let { stadium, ticket, venueInfo } = data; + stadiumInfo.value = stadium ?? {}; + ticketInfo.value = ticket ?? {}; + venueData.value = venueInfo ?? {}; + + console.warn('dataFromGrouponSiteSelect data', data); + let _classTags = (venueInfo?.venues ?? []).map(e=>e?._class_tag ?? ''); + pvc_func({ + appid: APPID, + brand_id: stadium?.brand_id ?? '', + stadium_id: stadium?.id ?? '', + encrypted_codes: ticket?.encrypted_codes ?? '', + douyin_merchant_pay_amount: ticket?.douyin_merchant_pay_amount ?? '', + certificate_id: ticket?.certificate_id ?? '', + certificate: ticket?.certificates ?? null, + // 场地新增参数 + classify: venueInfo?.classify ?? '', + class_tags: _classTags.filter(e=>e!=='').join(','), + }) + + }) }) +function pvc_func(data){ + jsapiPreVerifyCertificates({ data }) + .then(res=>{ + // routeTo(`/subpackage/groupon/pages/exchange_success`); + console.log('jsapiPreVerifyCertificates', res); + verify_token.value = res?.data?.verify_token ?? ''; + }) +} + +function confirmBtn(){ + let _tVal = ticketInfo.value; + + const _query = { + verifyToken: verify_token.value ?? '', + poiId: _tVal?.poi_id ?? '', + orderList: [{ + orderId: _tVal?.order_id ?? '', + certificateList: [ _tVal?.certificate_id ?? '' ] + }], + orderEntrySchema: { + // 后端: 把verify_token和c什么id那个作为参数, 到时候应该也用这两个反查 + path: 'subpackage/order/pages/detail', + params: JSON.stringify({ certificate_id: _tVal?.certificate_id ?? '' }), + }, + success(res){ + hideLoad(); + console.warn('verifyCertificates success', res); + showModal({ content: '核销成功!' }); + let _classTags = (venueData.value?.venues ?? []).map(e=>e?._class_tag ?? ''); + createBookOrder({ + appid: APPID, + brand_id: stadiumInfo.value?.brand_id ?? '', + stadium_id: stadiumInfo.value?.id ?? '', + date: venueData.value?.date, + sessions: (venueData.value?.venues || []).map(el=>({ + venue_id: el?.venue_id ?? '', + duration: el?.time ?? '', + price: el?.price ?? 0, + tag: el?._class_tag ?? '', + })), + type_key: venueData.value?.classify ?? '', + class_tags_enable: _classTags.filter(e=>e!=='').join(','), + verify_token: verify_token.value ?? '', + douyin_merchant_pay_amount: _tVal?.douyin_merchant_pay_amount ?? 0, + douyin_groupon_coupon_code: _tVal?.certificate_id ?? '' + }) + }, + fail(err){ + hideLoad(); + console.warn('verifyCertificates fail', err); + showModal({ content: err?.errMsg ?? '兑换操作失败!' }) + }, + + } + console.log('tt.verifyCertificates data -->', _query) + showLoad(); + return tt.verifyCertificates(_query); +} + +function createBookOrder(data){ + orderAdd({ data }) + .then(res=>{ + console.log('createBookOrder', res); + }) +} + @@ -151,4 +247,30 @@ onMounted(() =>{ } } + +.ti-fixed{ + @include ctf; + .cf-btn{ + @include clearBtn; + flex-shrink: 0; + flex-grow: 0; + margin-left: 12upx; + width: 240upx; + text-align: center; + border-radius: 20upx; + background-color: $redColor; + @include flcw(32upx, 88upx, #fff); + &.cf-full{ + flex-grow: 1; + width: auto; + } + } + .cf-price{ + flex-grow: 1; + @include flcw(40upx, 56upx, $redColor, 500); + .cp-txt{ + @include flcw(28upx, 56upx, #333); + } + } +} diff --git a/src/subpackage/groupon/pages/site_select.vue b/src/subpackage/groupon/pages/site_select.vue index 5bd74bf..2f9978f 100644 --- a/src/subpackage/groupon/pages/site_select.vue +++ b/src/subpackage/groupon/pages/site_select.vue @@ -28,7 +28,8 @@ const selectedData = computed(_=>{ // 已选中场地 _temArr.push({ ...ele, _venue_id: e?.id ?? 0, - _venue_name: e?.name ?? '' + _venue_name: e?.name ?? '', + _class_tag: e?.class_tag ?? '', }) }) }); @@ -149,13 +150,10 @@ function getBookList({ return siteData.value = res?.data; }) } -// 建议在 Page.onReady 或者更后的时机调用,调用过早可能出现获取的宽高信息不准确。 -onReady(_=>{ - setScrollViewSize(); -}); + // 获取table 高度 async function setScrollViewSize(){ - const _sysInfo = uni.getSystemInfoSync(true); + const _sysInfo = uni.getSystemInfoSync(); let _headerInfo = await getNodeMes('#ssHeader'); let _dateBarInfo = await getNodeMes(`#smDates`); let _footerInfo = await getNodeMes('#ssFooter'); @@ -164,6 +162,7 @@ async function setScrollViewSize(){ } function submitClick(venues){ + console.warn('submitClick venues', venues); uni.navigateTo({ url: `/subpackage/groupon/pages/confirm_order/venue`, success: res => { @@ -171,6 +170,7 @@ function submitClick(venues){ stadium: stadiumInfo.value, ticket: ticketInfo, venueInfo: { + classify: currentVenueType.value?.key ?? '', typeName: currentVenueType.value?.name ?? '', date: (currentBookDate.value?.date ?? '').slice(0, 10), zh_day: currentBookDate.value?._zh_day, @@ -181,6 +181,7 @@ function submitClick(venues){ price: e?.price ?? '', date: e?.date ?? '', index: e?.index ?? '', + _class_tag: e?._class_tag ?? '', })) }, }) @@ -223,9 +224,8 @@ function submitClick(venues){