123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- <template>
- <view :class="['qn-page-' + theme]" style="height: 100vh">
- <view class="content">
- <view class="navbar">
- <view v-for="(item, index) in navList" :key="index" class="nav-item"
- :class="[tabCurrentIndex === index ? 'current' : '']" @click="tabClick(item, index)">
- {{ item.text }}
- <view class="current-line primary-btn"></view>
- </view>
- </view>
- <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
- <scroll-view @scrolltolower="scrollBootom" scroll-y="true" style="height:100%">
- <u-empty v-if="tabItem.list.length == 0" mode="list"></u-empty>
- <view v-for="(item, index) in tabItem.list" :key="index" class="order-item">
- <view class="clearfix order-no-view">
- <text class="float_left order-no-text">{{ $_utils.formatDate(item.createTime) }}</text>
- <text class="float_right order-status-text">
- {{
- tabCurrentIndex === 0
- ? '待付款'
- : tabCurrentIndex === 1
- ? '已支付'
- : tabCurrentIndex === 2
- ? '已完成'
- : ''
- }}
- </text>
- </view>
- <view class="goods-ul" style="display: flex;">
- <block v-for="(it, gindex) in item.project" :key="gindex">
- <view class="goods-li clearfix" v-if="gindex <= 4" style="flex-shrink: 0;">
- <image class="goods-img float_left" :src="it.image" mode="aspectFill"></image>
- </view>
- <view class="" style="padding-left: 10rpx;">
- {{item.project[0].name}}
- </view>
- </block>
- </view>
- <view class="money-view">
- 总价:¥{{ item.to_price || '0.00' }}
- <view class="price">
- 实付款:
- <text style="font-size: 20rpx;">¥</text>
- <view style="display: inline-block;font-size: 32rpx;">
- <rich-text :nodes="$_utils.splitPrice(item.pay_price)"></rich-text>
- </view>
- </view>
- </view>
- <view class="middle clearfix">
- <!-- #ifdef APP-PLUS||MP-WEIXIN -->
- <view class="btnSAdd float_right primary-btn" @click="goPay(item)"
- v-if="item.paid == 0 && item.examine_status == 0">
- 去付款
- </view>
- <view class="btnSAdd float_right primary-btn" @click="goQx(item)"
- v-if="item.status == 0 && item.examine_status == 0">
- 取消预约
- </view>
- <view class="btnSAdd float_right " style="color: #1f76f5;"
- v-if="item.status == 0 && (item.examine_status == 1 || item.examine_status == 2)">
- 请等待审核
- </view>
- <view class="btnSAdd float_right " style="color: #ff4d4d;"
- v-if="item.status == 0 && item.examine_status == -1 ">
- 取消预约未通过
- </view>
- <view class="btnSAdd float_right primary-btn"
- v-if="item.status == 0 && item.examine_status == 3 ">
- 取消预约已通过
- </view>
- <view class="btnSAdd float_right primary-btn" @click="goPage('/pagesT/unit/evaluate?uid=' + item.uid + '&order_id=' + item.id)"
- v-if="item.status == 1 && !item.is_evaluate">
- 去评价
- </view>
- <!-- #endif -->
- </view>
- </view>
- <u-loadmore margin-top="20" v-if="tabItem.list.length" :status="tabItem.loadingType" />
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <u-popup v-model="payPop" mode="bottom" :border-radius="12">
- <view class="pay-pop-view">
- <view class="pay-sel-title clearfix">
- <text class="float_left">付款方式</text>
- <text class="float_right ibonfont ibonguanbi" @click="closePayPop"></text>
- </view>
- <view class="pay-ul">
- <view class="pay-li" @click="pay_type = 1">
- <text class="ibonfont ibonhuodaofukuan"></text>
- <view class="pay-name clearfix"
- :class="[order_detail.pay_price*1 > Number(userInfo.memberBalance) ? 'balance-pay-name' : '']">
- <view class="float_left">
- <text>余额</text>
- <text class="balace-num">(余额:¥{{ Number(userInfo.memberBalance) }})</text>
- </view>
- <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 1"></text>
- <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
- </view>
- </view>
- <view class="pay-li" @click="pay_type = 2" v-if="order_detail.pay_price*1 > 0">
- <text class="ibonfont ibonweixinzhifu"></text>
- <view class="pay-name clearfix ">
- <view class="float_left">
- <text>微信</text>
- </view>
- <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 2"></text>
- <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
- </view>
- </view>
- </view>
- <view class="pay-btn primary-btn" @click="submit">
- <text>确定</text>
- </view>
- </view>
- </u-popup>
- <u-modal :show-cancel-button="true" :confirm-color="primaryColor" v-model="modal_show" :content="content"
- @confirm="confirmEdit" @cancel="cancelEdit"></u-modal>
- <CancelOrder
- @confirm="cancelOrderConfirm"
- :payStatus="pay_status"
- :cancelbeforeOrderStatus="order_status"
- :orderId="order_id"
- @close="closeCancel"
- :show="cancel_show"
- :type="2"
- ></CancelOrder>
- </view>
- </template>
- <script>
- import CancelOrder from './CancelOrder.vue';
- export default {
- components: {
- CancelOrder
- },
- data() {
- return {
- pay_type: 1,
- order_detail: {},
- payPop: false,
- qx_item: {},
- content: '请确认是否要取消预约',
- modal_show: false,
- order_id: 0,
- order_status: '',
- pay_status: '',
- cancel_show: false,
- orderList: [],
- tabCurrentIndex: 0,
- state: 1,
- loading_status: 'loadmore',
- navList: [{
- state: 1,
- text: '待付款',
- loadingType: 'loadmore',
- page: 1,
- pageSize: 10,
- list: [],
- loaded: false
- },
- {
- state: 2,
- text: '已支付',
- loadingType: 'loadmore',
- page: 1,
- pageSize: 10,
- list: [],
- loaded: false
- },
- {
- state: 3,
- text: '已完成',
- loadingType: 'loadmore',
- page: 1,
- pageSize: 10,
- list: [],
- loaded: false
- }
- ],
- page: 1,
- pageSize: 10,
- pageTotal: 0,
- tmplIds: [],
- userInfo: {},
- };
- },
- computed: {
- // 是否在发货前可以取消订单
- // isCancelOrder() {
- // return this.$store.state.baseSet.cancelOrder || 5;
- // }
- // userInfo() {
- // return this.$store.state.userStatus;
- // }
- },
- onLoad(opt) {
- if(opt.state) {
- this.tabCurrentIndex = opt.state
- }
- // #ifdef MP-WEIXIN
- // this.getSettingDataByMessageId();
- // #endif
- },
- onShow() {
- // this.getOrderSelect();
- this.getCustomerInfo()
- },
- methods: {
- cancelOrderConfirm() {
- this.getOrderSelect('reload')
- },
- cancelHandel(row) {
- this.order_id = row.id;
- this.order_status = row.orderStatus;
- this.pay_status = row.payStatus;
- this.cancel_show = true;
- },
- closeCancel() {
- this.cancel_show = false;
- },
- // 点击支付
- goPay(item) {
- this.order_detail = item
- this.payPop = true
- },
- submit() {
- //
- let that = this
- if(that.pay_type == 1 && (that.order_detail.pay_price*1 > that.userInfo.memberBalance*1)) {
- return that.$u.toast('抱歉,您的可用余额不足');
- }
- that.$u.api.itemPayment({
- "id": that.order_detail.id,
- "pay_type": that.pay_type, //1余额2微信3支付宝
- "source": that.pay_type == 2 ? 3: '',
- }).then(({data})=> {
- // 余额支付
- if(that.pay_type == 1) {
- console.log(data)
- if(data == '支付成功' || data.data == '支付成功') {
- that.payPop = false
- uni.showToast({
- title: '支付成功'
- });
- that.getOrderSelect('reload');
- that.getCustomerInfo()
- }
- }
- // 微信支付
- if(that.pay_type == 2) {
- // data.data
- let payInfo = data.data
- // #ifdef MP-WEIXIN
- uni.requestPayment({
- provider: 'wxpay',
- timeStamp: payInfo.timeStamp, //当前时间
- nonceStr: payInfo.nonceStr, //随机字符串,长度在32一下
- package: payInfo.package, //统一单接口返回的prepay_id
- signType: payInfo.signType, //签名算法,目前支持MD5
- paySign: payInfo.paySign, //签名
- success: res => {
- uni.showToast({
- title: '支付成功'
- });
- that.payPop = false
- that.getOrderSelect('reload');
- that.getCustomerInfo()
- },
- fail: async err => {
- that.payPop = false
- that.$u.toast('支付失败');
- that.getOrderSelect('reload');
- that.getCustomerInfo()
- }
- });
- // #endif
- }
- })
- },
- goQx(item) {
- this.cancelHandel(item);
- },
- confirmEdit() {
- this.$u.api.itemCancel({
- id: this.qx_item.id
- }).then(res => {
- this.getOrderSelect('reload');
- })
- this.modal_show = false
- },
- cancelEdit() {
- this.qx_item = {}
- this.modal_show = false
- },
- scrollBootom() {
- this.getOrderSelect()
- },
- // 获取订单列表
- getOrderSelect(type) {
- let that = this
- let item = that.navList[that.tabCurrentIndex]
- if (type == 'reload' || type == 'tab') {
- item.loadingType = 'loadmore'
- item.list = []
- item.page = 1
- }
- // if (type == 'tab' && item.loaded) {
- // return
- // }
- if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
- return
- }
- item.loadingType = 'loading'
- this.$u.api
- .getMyItem({
- page: item.page,
- pageSize: item.pageSize,
- name: '',
- type: item.state
- })
- .then(({data}) => {
- item.list = item.list.concat(data)
- item.page++
- if (item.pageSize == data.length) {
- item.loadingType = 'loadmore'
- } else {
- item.loadingType = 'nomore'
- }
- item.loaded = true
- });
- },
- //swiper 切换
- changeTab(e) {
- console.log('swiper拿去数据')
- this.tabCurrentIndex = e.target.current;
- this.getOrderSelect('tab');
- },
- //顶部tab点击
- tabClick(item, index) {
- this.tabCurrentIndex = index;
- // this.getOrderSelect('tab');
- // this.getOrderSelect()
- },
- // 获取用户信息
- getCustomerInfo() {
- this.$u.api.getCustomerInfo().then(({ data }) => {
- this.userInfo = data;
- this.$store.commit('commit_userStatus', data);
- });
- },
- // 获取消息模版ID 后台取消订单, 退款通知
- // getSettingDataByMessageId() {
- // this.$u.api
- // .getSettingDataByMessageId({
- // id: [5, 7]
- // })
- // .then(res => {
- // if (res.data.length > 0) {
- // this.tmplIds = res.data.map(item => {
- // return item.weixinTemplateId;
- // });
- // }
- // });
- // }
- }
- };
- </script>
- <style lang="scss">
- .order-item {
- margin: 24upx 0;
- padding-bottom: 24rpx;
- background-color: #fff;
- .order-no-view {
- font-size: 24upx;
- padding: 24upx 30upx;
- color: #666;
- font-weight: 300;
- border-bottom: 1upx solid #eee;
- .order-status-text {
- font-weight: 500;
- }
- }
- .goods-li:last-child {
- margin-bottom: 0;
- }
- .goods-ul {
- padding: 20rpx 10rpx 0;
- .goods-li {
- margin: 0 10rpx;
- display: inline-block;
- text-align: center;
- line-height: 100rpx;
- background: #eeeeee;
- border-radius: 16rpx;
- overflow: hidden;
- width: 100upx;
- height: 100upx;
- .goods-img {
- width: 100%;
- height: 100%;
- }
- position: relative;
- .buyNum {
- position: absolute;
- font-size: 20rpx;
- color: #ffffff;
- line-height: 32rpx;
- background-color: rgba($color: #000000, $alpha: 0.6);
- padding: 0 10rpx;
- right: 0;
- bottom: 0;
- }
- }
- }
- .goods-li {
- // background: #fafafa;
- // padding: 30upx 20upx;
- // margin-bottom: 20upx;
- // margin-right: 10rpx;
- .goods-right {
- width: 500upx;
- margin-left: 20upx;
- .goods-name {
- color: #333;
- font-size: 32upx;
- margin-bottom: 19upx;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .goods-descrip {
- font-size: 22upx;
- color: #999;
- margin-bottom: 28upx;
- // font-weight: 300;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- line-clamp: 1;
- -webkit-box-orient: vertical;
- }
- .goods-price {
- .price {
- color: $price-color;
- font-size: 40upx;
- }
- .sku {
- font-size: 22upx;
- font-weight: 300;
- color: #666;
- }
- .float_right {
- font-size: 24upx;
- }
- }
- }
- }
- }
- .money-view {
- color: #666666;
- text-align: right;
- font-size: 24upx;
- padding: 24upx 30upx;
- .price {
- font-size: 24upx;
- font-weight: bold;
- color: #000000;
- margin-left: 10rpx;
- display: inline-block;
- }
- }
- .middle {
- font-size: 24upx;
- position: relative;
- padding: 0 30upx;
- }
- .btnS {
- padding: 0 20upx;
- line-height: 50upx;
- color: #6e6e6e;
- font-size: 24upx;
- text-align: center;
- margin-left: 20upx;
- height: 50upx;
- background: rgba(241, 241, 241, 1);
- // box-shadow: 0px 2upx 14upx 0px rgba(0, 0, 0, 0.1);
- border-radius: 8upx;
- }
- .btnSAdd {
- padding: 0 20upx;
- line-height: 50upx;
- color: #ffffff;
- font-size: 24upx;
- text-align: center;
- height: 50upx;
- border-radius: 8upx;
- margin-left: 20rpx;
- }
- .content {
- background: $page-color-base;
- height: 100vh;
- }
- .swiper-box {
- height: calc(100% - 80upx);
- }
- .list-scroll-content {
- height: 100%;
- }
- .navbar {
- display: flex;
- height: 88upx;
- background: #fff;
- position: relative;
- z-index: 10;
- border-bottom: 1upx solid #eee;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 28upx;
- color: #666666;
- position: relative;
- font-weight: 300;
- &.current {
- font-weight: 500;
- .current-line {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 10upx;
- transform: translateX(-50%);
- width: 40upx;
- height: 6upx;
- background: $base-btn-bg;
- border-radius: 6upx;
- /*border-bottom: 2px solid #F53C28;*/
- }
- }
- }
- }
- .pay-pop-view {
- background-color: #ffffff;
- border-top-left-radius: 12upx;
- border-top-right-radius: 12upx;
- font-size: 28upx;
-
- .pay-sel-title {
- padding: 0 30upx;
- line-height: 88upx;
- font-weight: bold;
- font-size: 32upx;
-
- .ibonfont {
- color: #999;
- font-weight: 400;
- }
- }
-
- .pay-btn {
- height: 90upx;
- line-height: 90upx;
- color: #000;
- font-size: 32upx;
- text-align: center;
- background-color: #108ee9;
- }
-
- .pay-ul {
- .pay-li {
- line-height: 100upx;
-
- .ibonfont {
- padding-left: 30upx;
- font-size: 46upx;
- vertical-align: middle;
- margin-right: 24upx;
- }
-
- .ibonweixinzhifu {
- color: #04be02;
- }
-
- .ibonumidd17 {
- color: #108ee9;
- }
-
- .ibonhuodaofukuan {
- color: #f2b844;
- }
-
- .pay-name {
- width: 650upx;
- display: inline-block;
- padding-right: 30upx;
- vertical-align: middle;
- border-bottom: 1px solid #f5f5f5;
-
- .ibonxuanze1,
- .ibonweixuanze {
- margin-right: 0;
- padding-left: 0;
- font-size: 38upx;
- }
-
- .balace-num {
- font-size: 24rpx;
- color: #6c6c6c;
- }
- }
-
- .balance-pay-name {
- position: relative;
- padding-bottom: 20rpx;
-
- .balance-tip {
- position: absolute;
- font-size: 22rpx;
- line-height: 36rpx;
- bottom: 10rpx;
- left: 0;
- }
- }
- }
- }
- }
- </style>
|