123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <template>
- <view class="jump-container">
- <view v-if="viewType === 'verification'">
- <JHeader tabbar="/pages/tabbar/user/index" width="50" height="50" title="订单核销"></JHeader>
- <view v-if="orderInfo && orderInfo.orderId" style="margin-top: 40upx;">
- <OrderInfo :data="orderInfo"></OrderInfo>
- </view>
- <view style="margin-top: 50upx;">
- <tui-input v-model="code" label="核销码" placeholder="请输入核销码" disabled></tui-input>
- </view>
- <view>
- <tui-button
- margin="20upx 0 0 auto" type="green" width="260rpx" shape="circle"
- @click="handleVerification()"
- >
- 确认核销
- </tui-button>
- </view>
- </view>
- <view v-else>
- <tui-skeleton :preload-data="preloadData" style="z-index: 888;"></tui-skeleton>
- </view>
- </view>
- </template>
- <script>
- import { J_STORAGE_KEY, J_NEW_BIND_TYPE, J_NEW_BIND_CODE, J_NEW_BIND_ID } from '../../config/constant'
- import { getOrderDetailApi, updateSetHxCodeApi, bindPlatformInfoCodeApi } from '../../api/user'
- import { getUserToken } from '../../utils'
- export default {
- name: 'Jump',
- components: {},
- props: {},
- data() {
- return {
- data: [],
- preloadData: [
- {
- 'id': '',
- 'dataset': {},
- 'left': 164.84375,
- 'right': 365,
- 'top': 20,
- 'bottom': 220,
- 'width': 200.15625,
- 'height': 19,
- 'skeletonType': 'rect'
- }, {
- 'id': '',
- 'dataset': {},
- 'left': 0,
- 'right': 375,
- 'top': 70,
- 'bottom': 187,
- 'width': 375,
- 'height': 187,
- 'skeletonType': 'fillet'
- }
- ],
- type: '',
- code: '',
- otherSideUserId: '',
- userToken: '',
- userInfo: {},
-
- viewType: '',
-
- orderId: '',
- orderInfo: {}
- }
- },
-
- onLoad(options) {
- if (options.type) uni.setStorageSync(J_NEW_BIND_TYPE, options.type) || uni.setStorageSync(J_NEW_BIND_CODE, options.code || '') || uni.setStorageSync(J_NEW_BIND_ID, options.userId || '')
- this.userToken = getUserToken() || ''
- if (this.userToken && !options.type && uni.getStorageSync(J_NEW_BIND_TYPE)) {
- this.userInfo = uni.getStorageSync(J_STORAGE_KEY)
- this.type = uni.getStorageSync(J_NEW_BIND_TYPE) || ''
- this.code = uni.getStorageSync(J_NEW_BIND_CODE) || ''
- this.otherSideUserId = uni.getStorageSync(J_NEW_BIND_ID) || ''
- this.handleBusiness(true)
- } else if (this.userToken && options.type) {
- this.userInfo = uni.getStorageSync(J_STORAGE_KEY)
- this.type = options.type || ''
- this.code = options.code || ''
- this.otherSideUserId = options.userId || ''
- this.handleBusiness(false)
- }
- },
-
- onReady() { },
-
- onShow() {
- },
-
- onHide() { },
-
- onUnload() { },
-
- onPullDownRefresh() { },
-
- onReachBottom() { },
-
- onShareAppMessage() { },
- methods: {
-
- async handleBusiness(isFromLogin) {
- console.log(isFromLogin)
- uni.removeStorageSync(J_NEW_BIND_TYPE)
- uni.removeStorageSync(J_NEW_BIND_CODE)
- uni.removeStorageSync(J_NEW_BIND_ID)
- if (this.type === 'nothing') {
- this.$switchTab('/pages/store/store')
- } else if (this.type === 'verification') {
- this.orderId = this.code.split('-')[0]
- this.code = this.code.split('-')[1]
- await getOrderDetailApi({
- orderId: this.orderId,
- noticeId: 0
- }).then(({ data }) => {
- this.orderInfo = data
- })
- return this.viewType = 'verification'
- } else if (this.type === 'invitation') {
- setTimeout(() => { this.$switchTab('/pages/tabbar/user/index') }, 1000)
- } else if (this.type === 'bindingBranchOffice' || this.type === 'bindingStore' || this.type === 'bindingPlanner') {
- bindPlatformInfoCodeApi({ parentId: this.code })
- .then((res) => {
- this.$showToast('绑定成功', 'success')
- })
- .finally((e) => {
- setTimeout(() => { this.$switchTab('/pages/tabbar/user/index') }, 2000)
- })
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- handleVerification() {
- updateSetHxCodeApi({ orderId: this.orderId, noticeId: 0 })
- .then((res) => {
- this.$showToast('核销成功', 'success')
- })
- .finally((e) => {
- setTimeout(() => { this.$switchTab('/pages/tabbar/user/index') }, 2000)
- })
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .jump-container {
- min-height: 100vh;
- padding: 46upx;
- box-sizing: border-box;
- }
- </style>
|