123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- <template>
- <view class="main">
- <view v-if="user.type=='1'">
- <view class="one"> <text>{{info.zhStatus}}</text> </view>
- <view class="two">
- <view class="two_1">
- <image v-if="info.source&&info.source.file.length>0" class="image"
- :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
- </image>
- <image v-else class="image"
- :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
- </image>
- <text v-if="info.type=='0'">酒店民宿</text>
- <text v-else>景区门票</text>
- </view>
- <view class="two_2">
- <view class="left">
- <image v-if="info.source&&info.source.file.length>0" class="image"
- :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
- </image>
- <image v-else class="image"
- :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
- </image>
- </view>
- <view class="right">
- <view class="right_1">
- <view class="left">
- <view class="name textOver">{{info.source_name||'暂无'}}</view>
- <view class="other">{{info.zhType||'暂无'}}</view>
- <view class="other">{{info.zhPerson||'暂无'}}</view>
- </view>
- <view class="right">
- <view class="other">
- ¥{{info.source.money||'0'}}
- </view>
- <view class="other">
- ×{{info.num||'0'}}
- </view>
- </view>
- </view>
- <view class="right_2">
- 合计:¥{{info.money||'0'}}
- </view>
- </view>
- </view>
- </view>
- <view class="thr">
- <view class="thr_1">优惠</view>
- <view class="other">商品总价:¥{{info.money||'0'}} <text>(共{{info.num||'0'}}件)</text> </view>
- <view class="other">优惠:¥{{info.coupon_money||'0'}}</view>
- <view class="other">实付:¥{{info.total_money||'0'}}</view>
- </view>
- <view class="four">
- <view class="four_1">订单信息</view>
- <view class="other">订单编号:{{info._id||'暂无'}}</view>
- <view class="other">下单时间:{{info.buy_time||'暂无'}}</view>
- </view>
- <view class="four">
- <view class="four_1">用户信息</view>
- <view class="list" v-for="(item, index) in info.identity" :key="index">
- <view class="other">游客{{index+1}}</view>
- <view class="other">真实姓名:{{item.name||'暂无'}}</view>
- <view class="other">证件号码:{{item.card||'暂无'}}</view>
- <view class="other">手机号码:{{ getProps(item.phone) }}</view>
- </view>
- </view>
- <view class="four">
- <view class="four_1">支付信息</view>
- <view class="other">支付时间:{{info.pay_time||'暂无'}}</view>
- <view class="other">交易快照:当发生交易纠纷时可作为交易凭证 ></view>
- <view class="other">支付数据:{{info.pay||'暂无'}}</view>
- </view>
- <view class="five" v-if="info.status=='1'">
- <button class="button" type="primary" size="mini" @tap="toOff()">确定核销</button>
- </view>
- </view>
- <view class="one" v-else>暂无权限核销券码</view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- id: '',
- config: {
- logo_url: []
- },
- user: {},
- info: {
- source: {
- file: []
- }
- },
- statusList: [],
- personList: [],
- typeList: [],
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e && e.id || '');
- },
- onShow: function() {
- const that = this;
- that.searchToken();
- },
- methods: {
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) that.$set(that, `config`, res);
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- async searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const arr = await that.$api(`/user/${res._id}`, 'GET', {})
- if (arr.errcode == '0') {
- that.$set(that, `user`, arr.data);
- if (arr.data.type == '1') {
- that.searchConfig();
- await that.searchOther();
- await that.search();
- }
- }
- } else {
- uni.navigateTo({
- url: `/pagesIndex/login/index`
- })
- }
- } catch (e) {
- uni.showToast({
- title: err.errmsg,
- icon: 'error',
- duration: 2000
- });
- }
- },
- async search() {
- const that = this;
- if (that.id) {
- const res = await that.$api(`/order/${that.id}`, 'GET', {})
- if (res.errcode == '0') {
- const status = that.statusList.find(i => i.value == res.data.status)
- if (status) res.data.zhStatus = status.label
- if (res.data && res.data.source && res.data.source.person) {
- const person = that.personList.find(i => i.value == res.data.source.person)
- if (person) res.data.zhPerson = person.label
- }
- if (res.data && res.data.source && res.data.source.type) {
- const type = that.typeList.find(i => i.value == res.data.source.type)
- if (type) res.data.zhType = type.label
- }
- that.$set(that, `info`, res.data)
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- }
- },
- // 整理电话号
- getProps(phone) {
- if (!phone) return '暂无';
- return phone.replace(/^(\d{3})(\d{4})(\d{4})$/, '$1****$2');
- },
- // 核销券码
- async toOff() {
- const that = this;
- uni.showModal({
- title: '提示',
- content: '确定核销券码吗?',
- success: async function(res) {
- if (res.confirm) {
- const res = await that.$api(`/order/${that.id}`, 'POST', {
- status: "2"
- })
- if (res.errcode == '0') {
- uni.showToast({
- title: `核销券码成功`,
- });
- that.search();
- } else {
- uni.showToast({
- title: res.errmsg,
- });
- }
- }
- }
- });
- },
- // 查询其他信息
- async searchOther() {
- const that = this;
- let res;
- // 查询类型
- res = await that.$api(`/dictData`, 'GET', {
- type: 'order_status',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `statusList`, res.data);
- // 出游人群
- res = await that.$api(`/dictData`, 'GET', {
- type: 'ticket_person',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `personList`, res.data);
- // 服务特色
- res = await that.$api(`/dictData`, 'GET', {
- type: 'ticket_type',
- is_use: '0',
- })
- if (res.errcode == '0') that.$set(that, `typeList`, res.data);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- display: flex;
- flex-direction: column;
- background-image: linear-gradient(to top, rgba(241, 241, 241, 1), rgba(135, 206, 250, 1), rgba(0, 122, 255, 1));
- .one {
- padding: 5vw;
- font-size: var(--font20Size);
- font-weight: bold;
- }
- .two {
- background-color: var(--mainColor);
- border-radius: 5px;
- margin: 2vw 2vw 0 2vw;
- padding: 2vw;
- .two_1 {
- display: flex;
- align-items: center;
- .image {
- width: 8vw;
- height: 8vw;
- border-radius: 8vw;
- }
- text {
- padding: 0 0 0 2vw;
- }
- }
- .two_2 {
- display: flex;
- justify-content: space-between;
- margin: 2vw 0 0 0;
- padding: 0 2vw;
- .left {
- width: 20vw;
- .image {
- width: 20vw;
- height: 20vw;
- border-radius: 1vw;
- }
- }
- .right {
- width: 65vw;
- margin: 0 0 0 2vw;
- .right_1 {
- display: flex;
- justify-content: space-between;
- .left {
- width: 55vw;
- .name {
- font-size: var(--font14Size);
- }
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .right {
- width: 10vw;
- text-align: right;
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- }
- .right_2 {
- text-align: right;
- font-size: var(--font12Size);
- }
- }
- }
- }
- .thr {
- background-color: var(--mainColor);
- border-radius: 5px;
- margin: 2vw 2vw 0 2vw;
- padding: 2vw;
- .thr_1 {
- font-size: var(--font14Size);
- font-weight: bold;
- margin: 1vw 0;
- }
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .four {
- background-color: var(--mainColor);
- border-radius: 5px;
- margin: 2vw 2vw 0 2vw;
- padding: 2vw;
- .four_1 {
- font-size: var(--font14Size);
- font-weight: bold;
- margin: 1vw 0;
- }
- .list {
- border: 1px solid #d5d5da;
- border-radius: 5px;
- margin: 2vw 0 0 0;
- padding: 2vw;
- }
- .other {
- padding: 2px 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- .five {
- margin: 2vw 2vw 0 2vw;
- text-align: center;
- .button {
- margin: 2vw 0 0 0;
- background-color: var(--f3CColor);
- color: var(--mainColor);
- font-size: var(--font14Size);
- }
- }
- }
- </style>
|