tmp: 部分代码与UnishopV5结合,但是代码有严重缺陷
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<page-meta :page-style="themeColor"></page-meta>
|
||||
<view class="order-container">
|
||||
<view class="cate-search">
|
||||
<view class="cate-search" v-if="storeToken">
|
||||
<view class="search-box">
|
||||
<input class="uni-input" maxlength="50" v-model="searchText" confirm-type="search" placeholder="请输入商品名称/订单编号" @confirm="search()" />
|
||||
<text class="iconfont icon-sousuo3" @click="search()"></text>
|
||||
@@ -18,137 +18,138 @@
|
||||
<!-- #ifdef MP -->
|
||||
<mescroll-uni ref="mescroll" @getData="getListData" top="176rpx" v-if="storeToken">
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP -->
|
||||
<mescroll-uni ref="mescroll" @getData="getListData" top="196rpx" v-if="storeToken">
|
||||
<!-- #endif -->
|
||||
<block slot="list">
|
||||
<view class="order-list" v-if="orderList.length > 0">
|
||||
<view class="order-item" v-for="(orderItem, orderIndex) in orderList" :key="orderIndex">
|
||||
<view class="order-header" :class="{ waitpay: orderStatus == 'waitpay' && orderItem.order_status == 0 }">
|
||||
<!-- <view class="iconfont"
|
||||
:class="$util.inArray(orderItem.order_id, mergePayOrder) == -1 ? 'icon-yuan_checkbox' : 'icon-yuan_checked color-base-text'"
|
||||
@click="selectOrder(orderItem.order_id, orderItem.pay_money)"
|
||||
v-if="orderStatus == 'waitpay' && orderItem.order_status == 0"></view> -->
|
||||
<text class="order-no">订单号:{{ orderItem.order_no }}</text>
|
||||
<text class="order-type-name">{{ orderItem.order_type_name }}</text>
|
||||
<text class="status-name">{{ orderItem.order_status_name }}</text>
|
||||
</view>
|
||||
<view class="order-body" @click="orderDetail(orderItem)">
|
||||
<block v-if="orderItem.order_goods.length == 1">
|
||||
<view class="goods-wrap" v-for="(goodsItem, goodsIndex) in orderItem.order_goods" :key="goodsIndex">
|
||||
<view class="goods-img">
|
||||
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })" @error="imageError(orderIndex, goodsIndex)" mode="aspectFill" :lazy-load="true"/>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="pro-info">
|
||||
<view class="goods-name" v-if="goodsItem.goods_class == 2">{{ goodsItem.goods_name }}</view>
|
||||
<view class="goods-name" v-else>{{ goodsItem.sku_name }}</view>
|
||||
<view class="sku" v-if="goodsItem.sku_spec_format">
|
||||
<view class="goods-spec">
|
||||
<block v-for="(x, i) in goodsItem.sku_spec_format" :key="i">
|
||||
{{ x.spec_value_name }}
|
||||
{{ i < goodsItem.sku_spec_format.length - 1 ? '; ' : '' }}
|
||||
</block>
|
||||
</view>
|
||||
<!-- #ifndef MP -->
|
||||
<mescroll-uni ref="mescroll" @getData="getListData" top="196rpx" v-if="storeToken">
|
||||
<!-- #endif -->
|
||||
<block slot="list">
|
||||
<view class="order-list" v-if="orderList.length > 0">
|
||||
<view class="order-item" v-for="(orderItem, orderIndex) in orderList" :key="orderIndex">
|
||||
<view class="order-header" :class="{ waitpay: orderStatus == 'waitpay' && orderItem.order_status == 0 }">
|
||||
<!-- <view class="iconfont"
|
||||
:class="$util.inArray(orderItem.order_id, mergePayOrder) == -1 ? 'icon-yuan_checkbox' : 'icon-yuan_checked color-base-text'"
|
||||
@click="selectOrder(orderItem.order_id, orderItem.pay_money)"
|
||||
v-if="orderStatus == 'waitpay' && orderItem.order_status == 0"></view> -->
|
||||
<text class="order-no">订单号:{{ orderItem.order_no }}</text>
|
||||
<text class="order-type-name">{{ orderItem.order_type_name }}</text>
|
||||
<text class="status-name">{{ orderItem.order_status_name }}</text>
|
||||
</view>
|
||||
<view class="order-body" @click="orderDetail(orderItem)">
|
||||
<block v-if="orderItem.order_goods.length == 1">
|
||||
<view class="goods-wrap" v-for="(goodsItem, goodsIndex) in orderItem.order_goods" :key="goodsIndex">
|
||||
<view class="goods-img">
|
||||
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })" @error="imageError(orderIndex, goodsIndex)" mode="aspectFill" :lazy-load="true"/>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="pro-info">
|
||||
<view class="goods-name" v-if="goodsItem.goods_class == 2">{{ goodsItem.goods_name }}</view>
|
||||
<view class="goods-name" v-else>{{ goodsItem.sku_name }}</view>
|
||||
<view class="sku" v-if="goodsItem.sku_spec_format">
|
||||
<view class="goods-spec">
|
||||
<block v-for="(x, i) in goodsItem.sku_spec_format" :key="i">
|
||||
{{ x.spec_value_name }}
|
||||
{{ i < goodsItem.sku_spec_format.length - 1 ? '; ' : '' }}
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="goods-sub-section">
|
||||
<text class="goods-price">
|
||||
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
|
||||
<text class="price-style large">{{ parseFloat(goodsItem.price).toFixed(2).split(".")[0] }}</text>
|
||||
<text class="unit price-style small">.{{ parseFloat(goodsItem.price).toFixed(2).split(".")[1] }}</text>
|
||||
|
||||
</text>
|
||||
<text class="goods-num">
|
||||
<text class="iconfont icon-close"></text>
|
||||
{{ goodsItem.num }}
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="goods-action"><!-- <view class="action-btn">加购物车</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="multi-order-goods">
|
||||
<scroll-view scroll-x="true" class="scroll-view">
|
||||
<view class="goods-wrap">
|
||||
<view class="goods-img" v-for="(goodsItem, goodsIndex) in orderItem.order_goods" :key="goodsIndex">
|
||||
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })" @error="imageError(orderIndex, goodsIndex)" mode="aspectFill" :lazy-load="true"/>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="shade">
|
||||
<image :src="$util.img('public/uniapp/order/order-shade.png')"></image>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="order-footer">
|
||||
<view class="order-base-info">
|
||||
<view class="total">
|
||||
<text class="font-size-sub">共{{ orderItem.goods_num }}件商品</text>
|
||||
<text class="align-right font-size-base">
|
||||
实付款:
|
||||
<text class="font-size-base price-font">{{ $lang('common.currencySymbol') }}{{ orderItem.order_money }}</text>
|
||||
<!-- <view class="goods-sub-section">
|
||||
<text class="goods-price">
|
||||
<text class="unit price-style small">{{ $lang('common.currencySymbol') }}</text>
|
||||
<text class="price-style large">{{ parseFloat(goodsItem.price).toFixed(2).split(".")[0] }}</text>
|
||||
<text class="unit price-style small">.{{ parseFloat(goodsItem.price).toFixed(2).split(".")[1] }}</text>
|
||||
|
||||
</text>
|
||||
<text class="goods-num">
|
||||
<text class="iconfont icon-close"></text>
|
||||
{{ goodsItem.num }}
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="goods-action"><!-- <view class="action-btn">加购物车</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-action" v-if="orderItem.action.length > 0">
|
||||
<view class="order-time" v-if="orderItem.order_status == 0" id="action-date">
|
||||
<image :src="$util.img('public/uniapp/order/time.png')"></image>
|
||||
剩余时间:
|
||||
<uni-count-down :day="orderItem.discountTimeMachine.d"
|
||||
:hour="orderItem.discountTimeMachine.h"
|
||||
:minute="orderItem.discountTimeMachine.i"
|
||||
:second="orderItem.discountTimeMachine.s" color="#FF4644"
|
||||
splitorColor="#FF4644" />
|
||||
</view>
|
||||
<view class="order-box-btn"
|
||||
v-if="evaluateConfig.evaluate_status == 1 && orderItem.is_evaluate == 1"
|
||||
@click="operation('memberOrderEvaluation', orderItem)">
|
||||
<text v-if="orderItem.evaluate_status == 0">评价</text>
|
||||
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
|
||||
</view>
|
||||
<view class="order-box-btn"
|
||||
:class="{ 'color-base-border color-base-bg': operationItem.action == 'orderPay' }"
|
||||
v-for="(operationItem, operationIndex) in orderItem.action"
|
||||
:key="operationIndex" @click="operation(operationItem.action, orderItem)">
|
||||
{{ operationItem.title }}
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="multi-order-goods">
|
||||
<scroll-view scroll-x="true" class="scroll-view">
|
||||
<view class="goods-wrap">
|
||||
<view class="goods-img" v-for="(goodsItem, goodsIndex) in orderItem.order_goods" :key="goodsIndex">
|
||||
<image :src="$util.img(goodsItem.sku_image, { size: 'mid' })" @error="imageError(orderIndex, goodsIndex)" mode="aspectFill" :lazy-load="true"/>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="shade">
|
||||
<image :src="$util.img('public/uniapp/order/order-shade.png')"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-action" v-else-if="orderItem.action.length == 0 && orderItem.is_evaluate == 1 && evaluateConfig.evaluate_status == 1">
|
||||
<view class="order-box-btn" v-if="orderItem.is_evaluate == 1" @click="operation('memberOrderEvaluation', orderItem)">
|
||||
<text v-if="orderItem.evaluate_status == 0">评价</text>
|
||||
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="order-footer">
|
||||
<view class="order-base-info">
|
||||
<view class="total">
|
||||
<text class="font-size-sub">共{{ orderItem.goods_num }}件商品</text>
|
||||
<text class="align-right font-size-base">
|
||||
实付款:
|
||||
<text class="font-size-base price-font">{{ $lang('common.currencySymbol') }}{{ orderItem.order_money }}</text>
|
||||
</text>
|
||||
</view>
|
||||
<view class="order-action" v-else>
|
||||
<view class="order-box-btn" @click="orderDetail(orderItem)">查看详情</view>
|
||||
</view>
|
||||
<view class="order-action" v-if="orderItem.action.length > 0">
|
||||
<view class="order-time" v-if="orderItem.order_status == 0 && orderItem.pay_type !== 'offlinepay'" id="action-date">
|
||||
<image :src="$util.img('public/uniapp/order/time.png')"></image>
|
||||
剩余时间:
|
||||
<uni-count-down :day="orderItem.discountTimeMachine.d"
|
||||
:hour="orderItem.discountTimeMachine.h"
|
||||
:minute="orderItem.discountTimeMachine.i"
|
||||
:second="orderItem.discountTimeMachine.s" color="#FF4644"
|
||||
splitorColor="#FF4644" />
|
||||
</view>
|
||||
<view class="order-box-btn"
|
||||
v-if="evaluateConfig.evaluate_status == 1 && orderItem.is_evaluate == 1"
|
||||
@click="operation('memberOrderEvaluation', orderItem)">
|
||||
<text v-if="orderItem.evaluate_status == 0">评价</text>
|
||||
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
|
||||
</view>
|
||||
<view class="order-box-btn"
|
||||
:class="{ 'color-base-border color-base-bg': operationItem.action == 'orderPay' }"
|
||||
v-for="(operationItem, operationIndex) in orderItem.action"
|
||||
:key="operationIndex" @click="operation(operationItem.action, orderItem)">
|
||||
{{ operationItem.title }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-action" v-else-if="orderItem.action.length == 0 && orderItem.is_evaluate == 1 && evaluateConfig.evaluate_status == 1">
|
||||
<view class="order-box-btn" v-if="orderItem.is_evaluate == 1" @click="operation('memberOrderEvaluation', orderItem)">
|
||||
<text v-if="orderItem.evaluate_status == 0">评价</text>
|
||||
<text v-else-if="orderItem.evaluate_status == 1">追评</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-action" v-else>
|
||||
<view class="order-box-btn" @click="orderDetail(orderItem)">查看详情</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else><ns-empty :isIndex="false" :text="$lang('emptyTips')"></ns-empty></view>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
<view v-else><ns-empty :isIndex="false" :text="$lang('emptyTips')"></ns-empty></view>
|
||||
</block>
|
||||
</mescroll-uni>
|
||||
<view v-if="!storeToken" class="no-login">
|
||||
<view><ns-empty :isIndex="false" :text="$lang('emptyTips')"></ns-empty></view>
|
||||
<button type="primary" size="mini" class="button mini" @click="toLogin">去登录</button>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- <view class="order-batch-action" :class="{ 'bottom-safe-area': isIphoneX }" v-if="mergePayOrder.length">
|
||||
<view class="action-btn color-base-text color-base-border" @click="mergePay()">合并付款</view>
|
||||
</view> -->
|
||||
<!-- 选择支付方式弹窗 -->
|
||||
<payment ref="choosePaymentPopup"></payment>
|
||||
|
||||
<!-- 选择支付方式弹窗 -->
|
||||
<ns-payment ref="choosePaymentPopup"></ns-payment>
|
||||
<ns-payment ref="choosePaymentMergePopup"></ns-payment>
|
||||
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
<ns-login ref="login"></ns-login>
|
||||
<loading-cover ref="loadingCover"></loading-cover>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import orderMethod from './public/js/orderMethod.js';
|
||||
import nsPayment from '@/components/payment/payment.vue';
|
||||
import payment from '@/components/payment/payment.vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -176,7 +177,7 @@
|
||||
};
|
||||
},
|
||||
components: {
|
||||
nsPayment
|
||||
payment
|
||||
},
|
||||
mixins: [orderMethod],
|
||||
onLoad(option) {
|
||||
@@ -192,14 +193,19 @@
|
||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.login.open('/pages/order/list?status=' + this.orderStatus);
|
||||
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
|
||||
// this.$refs.login.open('/pages/order/list?status=' + this.orderStatus);
|
||||
})
|
||||
}
|
||||
if(this.$refs.choosePaymentPopup) this.$refs.choosePaymentPopup.pageShow()
|
||||
},
|
||||
onUnload() {
|
||||
if (!this.storeToken && this.$refs.login) this.$refs.login.cancelCompleteInfo();
|
||||
},
|
||||
methods: {
|
||||
toLogin() {
|
||||
this.$refs.login.open();
|
||||
},
|
||||
ontabtap(e) {
|
||||
let index = e.target.dataset.current || e.currentTarget.dataset.current;
|
||||
this.orderStatus = this.statusList[index].status;
|
||||
@@ -208,7 +214,7 @@
|
||||
this.$refs.mescroll.refresh();
|
||||
},
|
||||
getListData(mescroll) {
|
||||
|
||||
|
||||
this.$api.sendRequest({
|
||||
url: '/api/order/lists',
|
||||
data: {
|
||||
@@ -268,39 +274,39 @@
|
||||
getOrderStatus() {
|
||||
this.statusList = [{
|
||||
status: 'all',
|
||||
name:'全部',
|
||||
name: this.$lang('all'),
|
||||
id: 'status_0'
|
||||
},
|
||||
{
|
||||
status: 'waitpay',
|
||||
name: '待付款',
|
||||
name: this.$lang('waitPay'),
|
||||
id: 'status_1'
|
||||
},
|
||||
{
|
||||
status: 'waitsend',
|
||||
name: '待发货',
|
||||
name: this.$lang('readyDelivery'),
|
||||
id: 'status_2'
|
||||
},
|
||||
{
|
||||
status: 'waitconfirm',
|
||||
name: '待收货',
|
||||
name: this.$lang('waitDelivery'),
|
||||
id: 'status_3'
|
||||
},
|
||||
{
|
||||
status: 'waitrate',
|
||||
name: '已完成',
|
||||
id: 'status_4'
|
||||
},
|
||||
/*{
|
||||
status: 'wait_use',
|
||||
name: '待使用',
|
||||
name: this.$lang('waitUse'),
|
||||
id: 'status_4'
|
||||
}*/
|
||||
}
|
||||
];
|
||||
},
|
||||
operation(action, orderData) {
|
||||
let index = this.status;
|
||||
switch (action) {
|
||||
case 'orderDelete':
|
||||
this.orderDelete(orderData.order_id, () => {
|
||||
this.$refs.mescroll.refresh();
|
||||
});
|
||||
break;
|
||||
case 'orderPay': // 支付
|
||||
this.orderData = orderData;
|
||||
this.payMoney = parseFloat(orderData.pay_money);
|
||||
@@ -339,34 +345,18 @@
|
||||
this.$refs.mescroll.refresh();
|
||||
});
|
||||
break;
|
||||
case 'orderOfflinePay':
|
||||
this.orderData = orderData;
|
||||
this.$util.redirectTo('/pages_tool/pay/offlinepay', {
|
||||
outTradeNo: this.orderData.out_trade_no
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
orderDetail(data) {
|
||||
switch (parseInt(data.order_type)) {
|
||||
case 2:
|
||||
// 自提订单
|
||||
this.$util.redirectTo('/pages/order/detail_pickup', {
|
||||
order_id: data.order_id
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
// 本地配送订单
|
||||
this.$util.redirectTo('/pages/order/detail_local_delivery', {
|
||||
order_id: data.order_id
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
// 虚拟订单
|
||||
this.$util.redirectTo('/pages_tool/order/detail_virtual', {
|
||||
order_id: data.order_id
|
||||
});
|
||||
break;
|
||||
default:
|
||||
this.$util.redirectTo('/pages/order/detail', {
|
||||
order_id: data.order_id
|
||||
});
|
||||
break;
|
||||
}
|
||||
this.$util.redirectTo('/pages/order/detail', {
|
||||
order_id: data.order_id
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 选择订单
|
||||
@@ -381,28 +371,6 @@
|
||||
this.mergePayOrder.push(orderId);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 合并支付
|
||||
*/
|
||||
mergePay() {
|
||||
if (this.mergePayOrder.length) {
|
||||
this.$api.sendRequest({
|
||||
url: '/api/order/pay',
|
||||
data: {
|
||||
order_ids: this.mergePayOrder.toString()
|
||||
},
|
||||
success: res => {
|
||||
if (res.code >= 0) {
|
||||
this.$refs.choosePaymentMergePopup.getPayInfo(res.data);
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
imageError(orderIndex, goodsIndex) {
|
||||
this.orderList[orderIndex].order_goods[goodsIndex].sku_image = this.$util.getDefaultImage().goods;
|
||||
this.$forceUpdate();
|
||||
@@ -450,4 +418,18 @@
|
||||
/deep/ .mescroll-upwarp {
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
.no-login{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.no-login .button{
|
||||
width: 300rpx;
|
||||
margin-top: 100rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx !important;
|
||||
font-size: 28rpx;
|
||||
border-radius: 50rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user