Authored by 肖亚东

订单列表修改以及详情文件添加 — review by 黄敬囿

... ... @@ -38,7 +38,7 @@ App({
this.globalData.systemInfo = res;
},
getUid: function() {
let uid = 0;//this.globalData.userInfo.uid;
let uid = '500031152';//this.globalData.userInfo.uid;
// if (!uid || uid === 0) {
// this.getUserInfo();
... ...
... ... @@ -11,13 +11,15 @@
"pages/category/brands",
"pages/goodsList/brandStore",
"pages/search/search",
"pages/goodsList/ProductListFilterPage",
"pages/goodsList/productListFilterPage",
"pages/goodsList/brand",
"pages/userCenter/serviceFeedBack/serviceFeedBack",
"pages/userCenter/addressManager/addressManager",
"pages/userCenter/addressManager/addressEditer/addressEditer",
"pages/orders/orders",
"pages/orders/antifraud/antifraud"
"pages/orders/antifraud/antifraud",
"pages/orders/orderDetail/orderDetail"
],
"window":{
"navigationBarBackgroundColor": "#3a3a3a",
... ...
... ... @@ -9,39 +9,39 @@ Component({
},
methods: {
navToOrderDetail: function(event) {
this.triggerEvent('navToOrderDetail', event.detail);
this.triggerEvent('navToOrderDetail', event);
},
onCloseOrderTapped: function(event) {
this.triggerEvent('onCloseOrderTapped', event.detail);
this.triggerEvent('onCloseOrderTapped', event);
},
onReaddTapped: function(event) {
this.triggerEvent('onReaddTapped', event.detail);
this.triggerEvent('onReaddTapped', event);
},
onBuyNowTapped: function(event) {
this.triggerEvent('onBuyNowTapped', event.detail);
this.triggerEvent('onBuyNowTapped', event);
},
onBuyFromApp: function(event) {
this.triggerEvent('onBuyFromApp', event.detail);
this.triggerEvent('onBuyFromApp', event);
},
onDelOrderTapped: function(event) {
this.triggerEvent('onDelOrderTapped', event.detail);
this.triggerEvent('onDelOrderTapped', event);
},
onExpressTapped: function(event) {
this.triggerEvent('onExpressTapped', event.detail);
this.triggerEvent('onExpressTapped', event);
},
onConfirmTapped: function(event) {
this.triggerEvent('onConfirmTapped', event.detail);
this.triggerEvent('onConfirmTapped', event);
},
gotoGroupBuyDetail: function(event) {
this.triggerEvent('gotoGroupBuyDetail', event.detail);
this.triggerEvent('gotoGroupBuyDetail', event);
}
}
})
\ No newline at end of file
... ...
... ... @@ -35,33 +35,33 @@
}
.order-good {
position: relative;
margin-left: 30.6rpx;
height: 144rpx;
border-bottom: 1rpx solid #e0e0e0;
font-size: 23.4rpx;
display: flex;
flex-direction: row;
align-items: center;
position: relative;
margin-left: 30.6rpx;
height: 144rpx;
border-bottom: 1rpx solid #e0e0e0;
font-size: 23.4rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.order-tip {
font-size: 25.2rpx;
margin-left: 15rpx;
color: red;
margin-top: 10rpx;
font-size: 25.2rpx;
margin-left: 15rpx;
color: red;
margin-top: 10rpx;
}
.order-good:last-child {
border-bottom: none;
margin-bottom: 0rpx;
border-bottom: none;
margin-bottom: 0rpx;
}
.order-good .thumb-wrap {
position: relative;
float: left;
width: 90rpx;
height: 120rpx;
position: relative;
float: left;
width: 90rpx;
height: 120rpx;
}
.productTag{
... ... @@ -72,46 +72,46 @@
position: absolute;
}
.order-good .thumb {
width: 100%;
height: 100%;
width: 100%;
height: 100%;
}
image {
display: block;
margin: 0 auto;
max-width: 100%;
border: 0;
display: block;
margin: 0 auto;
max-width: 100%;
border: 0;
}
.order-good .deps {
margin-left: 20rpx;
flex-grow: 1;
width:85%;
margin-left: 20rpx;
flex-grow: 1;
width:85%;
}
.order-good .name {
font-family: PingFang SC;
font-size: 25.2rpx;
max-width: 70%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
font-family: PingFang SC;
font-size: 25.2rpx;
max-width: 70%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.order-good .row:nth-child(2) {
height: 40.5rpx;
line-height: 40.5rpx;
width: 80%;
height: 40.5rpx;
line-height: 40.5rpx;
width: 80%;
}
.order-good .row .color {
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
vertical-align: bottom;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
vertical-align: bottom;
}
.order-good .row .size {
... ...
... ... @@ -2,14 +2,17 @@ Component({
properties: {
data: {
type: null
},
selectIndex: {
type: Number,
}
},
data: {
},
methods: {
onSelectChanged: function () {
this.triggerEvent('onSelectChanged');
onSelectChanged: function (e) {
this.triggerEvent('onSelectChanged', e);
},
}
})
\ No newline at end of file
... ...
<view id="order-nav" class="order-nav clearfix">
<block tt:for="{{data}}" tt:key="{{index}}" tt:for-item="item">
<view class="tap-hightlight {{index == 0 ? 'active' : ''}}" data-type="{{index + 1}}" bindtap="onSelectChanged">
<view class="tap-hightlight {{selectIndex == index ? 'active' : ''}}" data-type="{{index + 1}}" bindtap="onSelectChanged">
<view class="nav-tap">{{item}}</view>
<button formType="submit" class="nav-tapButton" style='left: 0rpx;'></button>
<button formType="submit" class="nav-tapButton"></button>
</view>
</block>
</view>
\ No newline at end of file
... ...
import api from '../../../common/api.js';
// import {wexinPay} from '../../../utils/wxpay';
import { getYHStorageSync, getImageUrlWithWH} from '../../../utils/util';
import { getChannelCode, getGenderCode, getRecPosCode, getRecommandContentCode } from '../../../utils/home';
import { parseBrandListData } from '../../../utils/productListUtil';
// import {
// logEvent,
// YB_PAGE_OPEN_L,
// YB_SHARE_RESULT_L,
// } from '../../../libs/analytics.js'
// import {listen } from '../../../utils/login';
const APP_SPACEORDERS_DETAIL = "app.SpaceOrders.detail";
const APP_SPACEORDERS_CLOSE = "app.SpaceOrders.close";
const APP_SPACEORDERS_DELORDERBYCODE = "app.SpaceOrders.delOrderByCode";
const APP_SPACEORDERS_CONFIRM = "app.SpaceOrders.confirm";
let app = getApp();
const pixelRatio = app.globalData.systemInfo.pixelRatio;
const windowWidth = app.globalData.systemInfo.windowWidth;
const windowHeight = app.globalData.systemInfo.windowHeight;
const BANNER_RATIO = 324 / 750;
let bannerWidth = windowWidth;
let bannerHeight = bannerWidth * BANNER_RATIO;
let timer;
Page({
data: {
isShowExpress: false,
isLoading: true,
isShowHomeNav: false,
resources:[],
recommdData:[],
data:{},
bannerWidth,
bannerHeight,
requestOK: false,
order_code: "",
create_time: "",
from_page_name: '',
from_page_param: '',
current_page_name: 'orderDetail',
current_page_param: '',
tipimgsrc: '../images/tan-ic@2x.png',
arrowImg: '../images/arrow_right@2x.png',
refundReason: [],//退款理由
showReason:false,
reFaudCode:"",
reasonIndex:0,
pay_lefttime: 0,
time_left: '',
token: '',
activityBanner: '',
},
formSubmit: function (e) {
let formId = e.detail.formId;
let _self = this;
if (!app.getUid() || !formId || formId.length === 0) return;
//上报formId
let formIdParams = {
uid: app.getUid(),
order_code: _self.data.order_code,
openId: app.globalData.openID ? app.globalData.openID : getYHStorageSync('openID','orderDetail'),
miniapp_type: app.globalData.miniapp_type,
formId: formId,
method: 'wechat.formId.add',
}
// console.log('params', formIdParams)
api.get({data: formIdParams})
},
getRefundSeason: function () {
let param = {
method: 'app.SpaceOrders.refundApplyReasons',
fromPage: 'aFP_MineOrderContent'
}
api.get({data: param})
.then(json => {
if (json && json.code == 200) {
// console.log('退货理由获取成功')
this.setData({
refundReason: json.data
})
}
})
},
/**
* 再次购买
*/
onReaddTapped: function (e) {
// console.log("再次购买tab");
var code = e.currentTarget.dataset.order_code;
var that = this;
tt.showModal({
title: '确认将商品再次加入购物车?',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000',
success: function (res) {
if (res.confirm) {
// console.log("Click confirm button");
let param = {
method: "app.Shopping.readd",
order_code: code,
fromPage: "aFP_MineOrderContent"
}
api.get({data: param})
.then(json => {
if (json && json.code && json.code == 200) {
tt.showToast({
title: '加入购物车成功',
complete: function () {
tt.switchTab({
url: '../../shopCart/shopCart',
})
}
})
}
})
}
}
})
},
//申请退款
onRefundApplyTapped: function (e) {
let that = this;
var code = e.currentTarget.dataset.order_code;
that.setData({
order_code:code,
})
tt.showModal({
content: '申请退款后,本单享有的优惠可能会一并取消,确定申请吗?',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000',
success: function (res) {
if (res.confirm) {
// console.log('用户点击确定')
that.setData({
showReason: true,
reFaudCode: code,
})
}
}
})
},
chooseReason: function (e) {
let app = getApp();
let _self = this;
let reason_id = e.currentTarget.dataset.id;
let reason = e.currentTarget.dataset.reason;
let order_code = this.data.reFaudCode;
if (order_code) {
_self.setData({
order_code,
})
let param = {
method: 'app.SpaceOrders.refundApply',
reason_id,
reason,
order_code,
fromPage: "aFP_MineOrderContent",
miniapp_type: app.globalData.miniapp_type,
}
api.get({data: param})
.then(json => {
this.hidderPicker();
if (json && json.code == 200) {
tt.navigateBack({
delta:1
})
}
})
.catch(error => {
this.hidderPicker();
})
}
},
//picker-view的监听
bindChange:function(e){
// console.log(e);
let value = e.detail.value;
this.setData({
reasonIndex:value[0]
})
},
//选定退货理由
reasonSure:function(e){
// console.log('选定退货理由');
if (!this.data.refundReason || this.data.refundReason.length<0){
return;
}
let reasonIndex = this.data.reasonIndex;
// console.log("下标" + reasonIndex)
let reason_id = this.data.refundReason[reasonIndex].id;
let reason = this.data.refundReason[reasonIndex].reason;
let order_code = this.data.reFaudCode;
this.setData({
reasonIndex:0,
order_code: order_code,
})
if (order_code) {
let param = {
method: 'app.SpaceOrders.refundApply',
reason_id,
reason,
order_code,
fromPage: "aFP_MineOrderContent"
}
api.get({data: param})
.then(json => {
this.hidderPicker();
if (json && json.code == 200) {
tt.navigateBack({
delta: 1
})
}
})
.catch(error => {
this.hidderPicker();
})
}
},
hidderPicker: function () {
this.setData({
showReason: false,
reFaudCode: ''
})
},
add0: function(m) {
return m<10?'0'+m:m
},
formatDate: function(shijianchuo) {
var time = new Date(shijianchuo * 1000);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y + '-' + this.add0(m) + '-' + this.add0(d) + ' ' + this.add0(h) + ':' + this.add0(mm) + ':' + this.add0(s);
},
formatImgUrl: function(json) {
json.data.order_goods && json.data.order_goods.map((item, index) => {
let replaceStr = "{width}";
let url = item.goods_image;
let real_pay_price = item.real_pay_price;
let goods_price = item.goods_price;
let goods_sale_price = item.sales_price;
if (new Number(real_pay_price).toFixed(2) == new Number(goods_sale_price) || !real_pay_price){
item.real_pay_price = item.goods_price ? item.goods_price : item.sales_price;
item.sales_price = '';
}
if (item.sales_price){
item.sales_price = new Number(item.sales_price).toFixed(2);
}
url = url.replace(new RegExp('{width}', 'gm'), '65').replace(new RegExp('{height}', 'gm'), '100');
item.goods_image = url;
});
// console.log(json);
},
getDetail:function (order_code) {
let param = {
method: APP_SPACEORDERS_DETAIL,
order_code: order_code,
uid: app.getUid()
}
api.get({data: param})
.then(json => {
tt.hideLoading();
this.setData({
isLoading: false,
});
if (json && json.code && json.code == 200) {
this.formatImgUrl(json);
let requestOK = true;
let needTimer = false;
let pay_lefttime = 0;
if (json.data.order_detail_info && json.data.order_detail_info.ext && json.data.order_detail_info.ext.need_create === 'Y'){
needTimer = true;
pay_lefttime = parseInt(json.data.order_detail_info.ext.pay_lefttime);
}
let isShowExpress = false;
if (json.data.links && json.data.links.length > 0){
for (var i = 0;i < json.data.links.length;i++){
if (json.data.links[i] === "getExpress"){
isShowExpress = true;
break;
}
}
}
this.setData({
data: json.data,
requestOK: true,
pay_lefttime,
isShowExpress,
});
if (needTimer) {
this.stopTimer();
this.startTimer();
} else {
this.stopTimer();
}
}
})
.catch(error => {
tt.hideLoading();
this.setData({
isLoading: false,
});
});
},
onLoad:function(options){
// 生命周期函数--监听页面加载
let from_page_name = options.page_name ? options.page_name : '';
let from_page_param = options.page_param ? options.page_param : '';
let current_page_param = options.order_code;
this.setData({
order_code: options.order_code,
from_page_name, from_page_param, current_page_param,
isShowHomeNav: app.globalData.currentScene === 1014 || app.globalData.currentScene === "1014",
});
this.loadEnvelopesData();
var pages = getCurrentPages()
var currentPage = pages[pages.length - 1]
var url = currentPage.route
// let params = {
// PAGE_NAME: this.data.current_page_name,
// PAGE_PARAM: this.data.current_page_param,
// FROM_PAGE_NAME: this.data.from_page_name,
// FROM_PAGE_PARAM: this.data.from_page_param,
// PAGE_PATH: url
// };
// logEvent(YB_PAGE_OPEN_L, params);
// //订阅登录完成通知
// listen(function (succeed) {
// if (succeed) {
// this.getDetail(this.data.order_code);
// } else {
// let app = getApp()
// if (!app.getUid() || app.getUid() === 0) {
// tt.switchTab({
// url: '../../userCenter/userCenter',
// })
// }
// }
// }.bind(this))
},
onReady:function(){
// 生命周期函数--监听页面初次渲染完成
},
onShow:function(){
// 生命周期函数--监听页面显示
tt.showLoading({
title: '加载中...',
})
this.setData({
isLoading: true,
});
this.getDetail(this.data.order_code);
this.getRecommed();
this.getRefundSeason();
this.getResources();
},
onHide:function(){
// 生命周期函数--监听页面隐藏
this.stopTimer();
},
onUnload:function(){
// 生命周期函数--监听页面卸载
this.stopTimer();
},
onPullDownRefresh: function() {
// // 页面相关事件处理函数--监听用户下拉动作
// let params = {
// PAGE_NAME: this.data.current_page_name,
// PAGE_PARAM: this.data.current_page_param,
// FROM_PAGE_NAME: this.data.from_page_name,
// FROM_PAGE_PARAM: this.data.from_page_param,
// };
// logEvent(YB_PAGE_OPEN_L, params);
},
onReachBottom: function() {
// 页面上拉触底事件的处理函数
},
onExpressTapped: function (e) {
var code = e.currentTarget.dataset.order_code;
// console.log("查看物流");
tt.navigateTo({
url: '../../logisticsDetails/logisticsDetails?order_code=' + code,
})
},
/**
* 取消订单
*/
onCloseOrderTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var app = getApp();
var _self = this;
_self.setData({
order_code:code,
})
tt.showModal({
title: '取消订单',
content: '订单取消后不能恢复,确认取消此订单么?',
cancelText: '返回',
confirmText: '取消订单',
confirmColor: "#000000",
success: function(res) {
if (res.confirm) {
let param = {
method: APP_SPACEORDERS_CLOSE,
order_code: code,
uid: app.getUid(),
miniapp_type: app.globalData.miniapp_type,
}
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
tt.navigateBack({
delta: 1
})
}
else if (json && json.code && json.code != 200){
tt.showModal({title: json.message, showCancel:false})
}
})
.catch(error => {
})
}
}
})
},
/**
* 确认收货
*/
onConfirmTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var _self = this;
var app = getApp()
tt.showModal({
title: '确认收货',
content: '请确认是否已经收到商品?',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000',
success: function(res) {
if (res.confirm) {
let param = {
method: APP_SPACEORDERS_CONFIRM,
order_code: code,
uid: app.getUid(),
miniapp_type: app.globalData.miniapp_type,
}
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
tt.navigateBack({
delta: 1
})
}
else {
}
})
.catch(error => {
})
}
}
})
},
//拼团购商品 点击立即购买
onBuyFromApp: function (e) {
tt.showModal({
title: '提示',
content: "拼团订单只能在APP支付,请在应用市场搜索下载“Yoho!buy有货”,使用微信登录完成支付",
confirmText: '确定',
showCancel: false,
success: function (res) {
if (res.confirm) {
}
}
})
},
/**
* 立即付款
*/
onBuyNowTapped: function(e) {
// let mCode = e.target.dataset.order_code;
// let group_no = e.target.dataset.group_no ? e.target.dataset.group_no : '';
// let activity_id = e.target.dataset.activity_id ? e.target.dataset.activity_id : '';
// let mOrder = {};
// let payParam = {};
// if (group_no && group_no != ''){
// payParam = {
// group_no,
// activity_id,
// fromPage:"groupPurchaseDetail"
// }
// }
// mOrder.order_code = mCode;
// wexinPay(mOrder,payParam)
},
/**
* 删除订单
*/
onDelOrderTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var _self = this;
tt.showModal({
content: '确认删除订单?',
cancelText: '取消',
confirmText: '确定',
confirmColor: '#FF0000',
success: function(res) {
if (res.confirm) {
let param = {
method: APP_SPACEORDERS_DELORDERBYCODE,
order_code: code,
uid: app.getUid()
}
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
tt.navigateBack({
delta: 1
})
}
})
.catch(error => {
})
}
}
})
},
/**
* 申请售后
*/
onAfterServiceTapped: function(e) {
tt.showModal({
title: '提示',
content: '小程序暂不支持退换货,请使用有货APP或官网退换货!',
showCancel: false,
confirmText: '确定',
})
},
changeAddress: function() {
// console.log(this.data.data.can_update_delivery_address)
// this.data.data.can_update_delivery_address == "Y" 不让在订单详情页 修改地址
if (false) {
//可以点击进入换地址
tt.navigateTo({
url: '../../addressManager/addressManager?currentMode=modeChange&order_code=' + this.data.data.order_code + '&page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
})
}
else {
}
},
selectComplete: function(json) {
// console.log(json);
},
goTODefraudPage: function () {
// console.log("订单详情页跳转到防诈骗页面");
tt.navigateTo({
url: '../../antifraud/antifraud',
})
},
//获取红包信息
loadEnvelopesData: function () {
let app = getApp();
let that = this;
let param = {
// method: 'app.activity.payActivityProfile',
// uid: '500029682',//app.getUid(),
// orderCode: '1701060848',//this.data.orderCode,
// debug: 'XYZ',
method: 'app.activity.payActivityProfile',
uid: app.getUid(),
orderCode: this.data.order_code,
};
api.get({data: param})
.then(function (data) {
if (data && data.code == 200) {
let activityBanner = data.data.activityBanner.replace(/{width}/, bannerWidth).replace(/{height}/, bannerHeight);
let token = data.data.token;
that.setData({
activityBanner,
token,
});
} else {
}
})
.catch(function (error) {
});
},
onShareAppMessage: function (res) {
let param = {
FROM: res.from,
SHARE_RESUIL: 0,
TITLE: '我在有货给你发红包啦,专属好礼送不停!',
PATH: '/pages/envelopesActivity/envelopesActivity?token=' + this.data.token,
}
return {
title: param.TITLE,
path: param.PATH,
imageUrl: 'https://cdn.yoho.cn/20171218/fenxianghongbao.png',
success: function (res) {
// param.SHARE_RESUIL = 1
// logEvent(YB_SHARE_RESULT_L, param);
},
fail: function (res) {
// param.SHARE_RESUIL = 2
// logEvent(YB_SHARE_RESULT_L, param);
}
}
},
startTimer: function (e) {
let that = this;
timer = setInterval(function () {
let pay_lefttime = that.data.pay_lefttime;
let time_left = '';
if (pay_lefttime > 0) {
pay_lefttime = pay_lefttime - 1;
time_left = that.formatDateForTimer(pay_lefttime);
if (pay_lefttime == 0) {
that.getDetail(that.data.order_code);
}
} else {
pay_lefttime = 0;
}
that.setData({
pay_lefttime,
time_left,
})
}, 1000);
},
stopTimer: function (e) {
// console.log('stopTimer');
clearInterval(timer);
},
formatDateForTimer: function (second) {
var dateStr = "";
var hr = Math.floor(second / 3600);
var min = Math.floor((second - hr * 3600) / 60);
var sec = (second - hr * 3600 - min * 60);// equal to => var sec = second % 60;
dateStr = this.add0(hr) + ":" + this.add0(min) + ":" + this.add0(sec);
return dateStr;
},
gotoGroupBuyDetail: function (res) {
let target = res.target;
let group_no = res.target.dataset.group_no ? res.target.dataset.group_no : '';
let activity_id = res.target.dataset.activity_id ? res.target.dataset.activity_id : '';
tt.navigateTo({
url: "../../groupPurchase/groupPurchaseResult?activity_id=" + activity_id + '&group_no=' + group_no + '&page_name=' + 'orderDetail' + '&page_param=' + this.data.current_page_param
});
},
/**
* 为你优选
*/
getRecommed: function () {
let gender = getGenderCode(getApp().globalData.selectedChannel);
let yh_channel = getChannelCode(getApp().globalData.selectedChannel);
let param = {
method: "app.home.newPreference",
gender,
yh_channel,
rec_pos: 100004,
limit: 30,
fromPage: "aFP_My",
}
api.get({data: param})
.then(json => {
if (json && json.code && json.code == 200) {
let data = json.data.product_list;
data = parseBrandListData(data);
this.setData({
recommdData: data,
})
}
});
},
copy: function (e) {
var that = this;
var content = e.currentTarget.dataset.copy_content;
var type = e.currentTarget.dataset.copy_type;
tt.setClipboardData({
data: '' + content,
})
},
lookup: function (e) {
var that = this;
var copy_url = e.currentTarget.dataset.copy_url;
var copy_content = e.currentTarget.dataset.copy_content;
var copy_type = e.currentTarget.dataset.copy_type;
tt.setClipboardData({
data: '' + copy_url,
success: function (res) {
tt.hideToast();
},
})
tt.showModal({
title: '',
content: copy_content,
showCancel: false,
})
},
getResources: function () {
let that = this;
api.get({
url: '/operations/api/v5/resource/get',
data: {
content_code: "384329629395526cdb4c8bbb7be4d619"
},})
.then(json => {
if (json && json.code && json.code == 200 && json.data) {
for(var i = 0;i < json.data.length;i++){
//图片url转换
if(json.data[i] && json.data[i].data && json.data[i].data.list){
for (var j = 0;j < json.data[i].data.list.length; j++){
json.data[i].data.list[j].src = json.data[i].data.list[j].src.replace('{width}', json.data[i].data.imageWidth).replace('{height}', json.data[i].data.imageHeight).replace('{mode}',2);
// json.data[i].data.list[j].src = getImageUrlWithWH(json.data[i].data.list[j].src, windowWidth, windowWidth * json.data[i].data.imageHeight /json.data[i].data.imageWidth);
}
}
//图片宽高转换(为什么这个写法可行还需要再研究)
if (json.data[i] && json.data[i].data && json.data[i].data.imageHeight && json.data[i].data.imageWidth){
json.data[i].data.imageHeight = parseInt(json.data[i].data.imageHeight) / parseInt(json.data[i].data.imageWidth) * 750;//rpx
json.data[i].data.imageWidth = 750;//750rpx是固定的设计标准
}
}
that.setData({
resources: json.data,
});
}
}).catch(error => {});
},
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "订单详情",
"usingComponents": {
"productListCell": "../../../components/productList/productCell"
}
}
... ...
<!-- <import src="../defraudtip/defraudtip.wxml"/> -->
<block tt:if="{{!isLoading}}">
<view class="container">
<form bindsubmit="formSubmit" report-submit='true'>
<block tt:if="{{activityBanner}}">
<view class='header'>
<image class="activityBanner" src="{{activityBanner}}"open-type="share"></image>
<button open-type="share" class="activityBannerButton"></button>
</view>
</block>
<view class='statusContainer'>
<view tt:if="{{data.order_detail_info}}" class='status' bindtap="{{isShowExpress?'onExpressTapped':''}}" data-order_code="{{order_code}}">
<text class='title'>{{data.order_detail_info.value}}</text>
<block tt:if="{{data.order_detail_info.ext}}">
<text tt:if="{{data.order_detail_info.key !== '101'}}" class='detail'>{{data.order_detail_info.ext.desc}}</text>
<text tt:else class='detail'>您的订单已提交,请在{{time_left}}内完成支付,超时订单自动取消。</text>
</block>
</view>
<block tt:if="{{isShowExpress}}">
<view class='arrow'>
<image class='image' src='../images/arrow_right@2x.png'></image>
</view>
</block>
</view>
<view class='downloadApp' style='margin-top: 1rpx;'>
<view class='logoView'>
<image class='logo' style='mode: aspectFit;' src='./images/yoho@3x.png'></image>
</view>
<text class='tips'>下载Yoho!Buy实时获取物流动态</text>
</view>
<view tt:if="{{data.delivery_info}}" class="order-detail-page yoho-page" style='margin-top: 20rpx;'>
<view id="order-detail">
<view class="owner-info block" data-changeable="true" bindtap="changeAddress">
<view class="iconfont">
<image src="images/dizhi_icon@2x.png" class="tag-image"></image>
</view>
<view class="beside-icon">
<view class="name-phone">
{{data.delivery_info.user_name}}
<view>{{data.delivery_info.mobile}}</view>
</view>
<view tt:if="{{data.delivery_info}}" class="address">
{{data.delivery_info.area + ' ' + data.delivery_info.address}}
</view>
<view tt:if="{{false}}" class="rest" style="display: block;">其他地址</view>
</view>
</view>
<view class="order-goods" style='margin-top: 20rpx;'>
<block tt:for="{{data.order_goods}}" tt:for-item="good" tt:key="product_id">
<view class="order-good" data-id="">
<view class="thumb-wrap">
<image class="thumb" src="{{good.goods_image}}" style='mode: aspectFit;'></image>
<image tt:if="{{good.goods_type=='gift' || good.goods_type=='price_gift'}}"class='productTag' src="{{good.goods_type=='gift'?'../images/zp-lab@2x.png':'../images/jjg-lab@2x.png'}}"></image>
</view>
<view class="deps">
<view class="nameContainer">
<text class='name'>{{good.product_name}}</text>
</view>
<view class="colorContainer">
<view class="color">
颜色:{{good.color_name}} 尺码:{{good.size_name}}
</view>
<view tt:if="{{good.expect_arrival_time&&good.goods_type!=='ordinary'}}" class="expire">上市期:{{good.expect_arrival_time}}</view>
</view>
</view>
<view class="price-wrap">
<view class="price">
¥{{good.real_pay_price}}
</view>
<view tt:if="{{good.sales_price}}" class="count" style='text-decoration:line-through;'>
¥{{good.sales_price}}
</view>
<view class="count">
×{{good.buy_number}}
</view>
</view>
</view>
</block>
</view>
<block tt:if="{{data.order_amount_info}}">
<view class='formulas'>
<block tt:for="{{data.order_amount_info.promotion_formulas}}" tt:key="unique">
<view class="invoiceCell" style='margin-bottom: 20rpx;'>
<text class="invoiceCellName">{{item.promotion}}</text>
<text class='price' style='color: #444444;'>{{item.promotion_amount}}</text>
</view>
</block>
<view class='space' style='margin-top: 20rpx;margin-bottom: 20rpx;'></view>
<view tt:if="{{data.order_amount_info.real_amount}}" class="invoiceCell">
<text class="invoiceCellName">{{data.order_amount_info.real_amount.promotion}}</text>
<text class='price'>{{data.order_amount_info.real_amount.promotion_amount}}</text>
</view>
</view>
</block>
<block tt:if="{{data.order_basic_info}}">
<view class='orderDetail' style='margin-top: 20rpx;'>
<block tt:for="{{data.order_basic_info}}" tt:key="unique">
<view class='orderNum'>
<text class='ordernum'>{{item.key}}: {{item.value}}</text>
<block tt:if="{{item.ext}}">
<view tt:if="{{item.ext.need_copy_value}}" class='copyContainer' bindtap='copy' data-copy_content="{{item.ext.need_copy_value}}" data-copy_type="{{item.key}}">
<text class='copy' >复制</text>
</view>
<view tt:elif="{{item.ext.need_show_invoice}}" class='copyContainer' bindtap='lookup' data-copy_url="{{item.ext.need_show_invoice}}" data-copy_content='链接地址已复制成功,请粘贴到浏览器中打开,您也可以通过下载有货APP查看' data-copy_type="{{item.key}}">
<text class='copy'>查看</text>
</view>
</block>
</view>
</block>
</view>
</block>
<block tt:if="{{resources && resources.length > 0}}" tt:for='{{resources}}' tt:key='unique' >
<view tt:if="{{item.template_name=='newSingleImage'}}" style="width: {{item.data.imageWidth}}rpx;height: {{item.data.imageHeight}}rpx;margin-top: 20rpx;">
<image class='bannerImage' bindtap='lookup' data-copy_content="已成功复制微信公众号,请到微信中关注我们" data-copy_type='copyWeChat' data-copy_url='Yoho_buy' src="{{item.data.list&&item.data.list.length>0?item.data.list[0].src:''}}"></image>
</view>
</block>
<!--猜你喜欢列表-->
<view class='titleContainer' style='margin-top: 20rpx;'>
<view class='titleLine'></view>
<view class='titleDesc'> 为你优选</view>
</view>
<view class="likeContainer">
<block tt:for="{{recommdData}}" tt:key="{{index}}">
<productListCell item="{{item}}" page-name="{{current_page_name}}"></productListCell>
</block>
</view>
<view tt:if="{{data.links.length > 0}}" class="timeViewOpt">
<view tt:if="{{data.attribute == 9}}" class="tips" style='font-size:28rpx;color:#444444'>*此订单只能在APP端操作</view>
<view class="bottomView">
<block tt:for="{{data.links}}" tt:for-item="link" tt:key="order_code">
<block tt:if="{{link == 'closeOrder'}}">
<button class="button" style='margin-left:20rpx;margin-right:0rpx' formType="submit" type="default" size="{{defaultSize}}" plain='true' catchtap="onCloseOrderTapped" data-order_code="{{order_code}}">取消订单</button>
</block>
<block tt:if="{{link == 'readd'}}">
<view class="btn btn-cancel" style='margin-left:20rpx;margin-right:0rpx' catchtap="onReaddTapped" data-order_code="{{order_code}}" data-tab_index='1'>再次购买</view></block>
<block tt:if="{{link == 'buyNow'}}">
<view class="btn btn-pay" style='margin-left:20rpx;margin-right:0rpx' catchtap="onBuyNowTapped" data-order_code="{{order_code}}" data-group_no="{{data.order_extInfo.group_no}}" data-activity_id="{{data.order_extInfo.activity_id}}">立即付款</view>
</block>
<block tt:if="{{link == 'buyAtApp'}}">
<view class="btn btn-pay" style='margin-left:20rpx;margin-right:0rpx' catchtap="onBuyFromApp" data-order_code="{{order_code}}" data-group_no="{{data.order_extInfo.group_no}}" data-activity_id="{{data.order_extInfo.activity_id}}">立即付款</view>
</block>
<block tt:if="{{link == 'delOrder'}}">
<view class="btn btn-cancel" style='margin-left:20rpx;margin-right:0rpx' catchtap="onDelOrderTapped" data-order_code="{{order_code}}">删除订单</view>
</block>
<block tt:if="{{link == 'getExpress'}}">
<view class="btn cancel" style='margin-left:20rpx;margin-right:0rpx' catchtap="onExpressTapped" data-order_code="{{order_code}}">查看物流</view>
</block>
<block tt:if="{{link == 'confirm'}}">
<button formType="submit" style='margin-left:20rpx;margin-right:0rpx' type="default" class="button btn-pay" catchtap="onConfirmTapped" data-order_code="{{order_code}}">确认收货</button>
</block>
<block tt:if="{{link == 'refundApply'}}"><!--link == 'refundApply'-->
<button class="button" style='margin-left:20rpx;margin-right:0rpx' formType="submit" type="default" size="{{defaultSize}}" plain='true' catchtap="onRefundApplyTapped" data-order_code="{{order_code}}">申请退款</button>
</block>
<block tt:if="{{link == 'afterService'}}">
<view class="btn btn-pay" style='margin-left:20rpx;margin-right:0rpx' catchtap="onAfterServiceTapped" data-order_code="{{order_code}}">申请售后</view>
</block>
<block tt:if="{{link == 'groupInvite'}}">
<button class="inviteBtn" style='margin-left:20rpx;margin-right:0rpx' catchtap="gotoGroupBuyDetail" data-shareType='groupInvite' size="{{defaultSize}}" plain='true' data-order_code="{{order_code}}" data-group_no="{{data.order_extInfo.group_no}}" data-activity_id="{{data.order_extInfo.activity_id}}">查看拼团详情</button>
</block>
</block>
</view>
</view>
</view>
</view>
<picker-view tt:if="{{showReason}}"class='picker-view' value='{{value}}' bindchange='bindChange' indicator-style="height: 50rpx;">
<picker-view-column>
<!-- bindtap='chooseReason' data-id="{{item.id}}" data-reason="{{item.reason}}" -->
<view tt:for="{{refundReason}}" class="addr-item">{{item.reason}}</view>
</picker-view-column>
</picker-view>
<view tt:if="{{showReason}}" class='chooseBtn' bindtap='reasonSure'>确定</view>
<view tt:if="{{showReason}}" bindtap='hidderPicker' class='mask'></view>
</form>
</view>
</block>
<homenav id="homenav" isShow="{{isShowHomeNav}}"></homenav>
\ No newline at end of file
... ...
page {
display: block;
min-height: 100%;
background-color: #f0f0f0;
padding-bottom: 110rpx;
/* margin-top: 110rpx; */
}
.statusContainer{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
background: white;
}
.statusContainer .arrow{
width: 45rpx;
height: 30rpx;
margin-left: 4%;
margin-right: 4%;
}
.statusContainer .arrow .image{
width: 100%;
height: 100%;
}
.statusContainer .status{
flex-grow: 1;
background: white;
padding-left: 4%;
padding-right: 4%;
padding-top: 30rpx;
padding-bottom: 20rpx;
box-sizing:border-box;
display: flex;
flex-direction: column;
}
.status .title{
font-family: PingFang-SC-Medium;
font-size: 34rpx;
color: #444444;
line-height: 48rpx;
}
.status .detail {
font-family: PingFang-SC-Regular;
font-size: 28rpx;
color: #B0B0B0;
margin-top: 2%;
}
.header {
width: 100%;
height: 235rpx;
}
.header .activityBanner {
width: 100%;
height: 235rpx;
}
.header .activityBannerButton{
width: 100%;
height: 235rpx;
opacity: 0;
position: absolute;
top: 0rpx;
}
.order_fraud-container{
width: 100%;
height: 100rpx;
border-bottom: 1px solid #e0e0e0;
display: flex;
flex-direction: row;
background: white;
align-items: center;
}
.order_left-view{
height: 100rpx;
width: 80%;
flex: 1;
margin-left: 20rpx;
}
.order_top-tip{
display: flex;
flex-direction: row;
margin-top: 8rpx;
}
.order_tip-img{
width: 28rpx;
height: 28rpx;
}
.order_tip-desc{
font-size: 24rpx;
margin-left: 10rpx;
flex: 1;
}
.order_bottom-desc{
font-size: 22rpx;
text-align: left;
color: #aeaeae;
margin-top: 20rpx;
}
.order_right-arrow{
width: 30rpx;
height: 100rpx;
margin-right: 10rpx;
font-size: 22rpx;
padding-top: 30rpx;
}
.order_fraud-remind-bottom-sep {
top: 100rpx;
width: 100%;
height: 10rpx;
background: #f0f0f0;
}
.order-detail-page .owner-info {
line-height: 38rpx;
}
.order-detail-page .block .iconfont {
position: absolute;
left: 30rpx;
top: 50%;
font-size: 39rpx;
margin-top: -25rpx;
}
.order-detail-page .beside-icon {
margin-left: 55rpx;
}
.order-detail-page .name-phone {
font-size: 32rpx;
color: #444444;
}
.order-detail-page .name-phone view {
float: right;
}
.order-detail-page .address {
font-size: 28rpx;
margin-top: 10rpx;
color: #444444;
}
.order-detail-page .rest {
position: relative;
width: 100%;
text-align: right;
color: red;
font-size: 25rpx;
}
.order-detail-page .range {
width: 100%;
height: 20rpx;
}
.order-detail-page .order-status {
margin: 20rpx 0;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
padding-right: 0;
}
.order-detail-page .sub {
position: relative;
}
.order-detail-page .sub .iconfont {
left: 0;
}
.order-detail-page .beside-icon {
margin-left: 54rpx;
}
.order-detail-page .sub-content .sub-title {
display: block;
color: #444444;
font-size: 29rpx;
}
.order-detail-page .sub-content view {
display: block;
color: #b0b0b0;
font-size: 25rpx;
margin-top:15rpx;
}
.order-detail-page .sub-content view:first-child {
margin-top:0rpx !important;
}
.order-detail-page .block {
position: relative;
background: #fff;
padding: 30rpx 30rpx;
}
.order-detail-page .cost {
margin-top: 18rpx;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}
.order-detail-page .cost view {
font-size: 27rpx;
margin-bottom: 20rpx;
height: 35rpx;
line-height: 35rpx;
}
.order-detail-page .cost view:last-child {
margin-bottom: 0rpx !important;
line-height: 35rpx;
height:35rpx;
}
.order-detail-page .cost view view {
float: right;
line-height: 35rpx;
height:35rpx;
}
.order-detail-page .opt {
height: 52rpx;
text-align: right;
border-top: 1px solid #e0e0e0;
position: fixed;
bottom: 0px;
width: 700rpx;
display: flex;
flex-direction:row;
justify-content:flex-end;
}
.order-detail-page .btn {
display: flex;
box-sizing: border-box;
width: 140rpx;
height: 60rpx;
border-radius: 4rpx;
font-size: 28rpx;
text-align: center;
border: 2rpx solid #444444;
color: #444444;
align-items: center;
justify-content: center;
}
.button {
height: 60rpx;
width: 140rpx;
padding-left: 1rpx;
padding-right: 1rpx;
font-size: 28rpx;
text-align: center;
margin-right: 20rpx;
border-radius: 4rpx;
display: flex;
justify-content: center;
align-items: center;
}
.order-detail-page .btn-pay {
color: #fff;
border: none;
background: #d0021b;
font-size: 28rpx;
margin-left: 20rpx;
}
button[class="button btn-pay"]::after {
border: 0;
}
.order-goods {
width: 100%;
background: white;
}
.order-good:last-child {
border-bottom: none;
}
.icon-image {
width:34rpx;
height:43rpx;
}
.tag-image {
width: 34rpx;
height: 44rpx;
}
.order-good {
border-bottom: 1rpx solid #f0f0f0;
display: flex;
flex-direction: row;
width: 96%;
height: 160rpx;
background-color: white;
align-items: center;
margin-left: 4%;
padding-right: 4%;
box-sizing: border-box;
}
.order-good:first-child {
margin-top:0rpx;
}
.order-good:last-child {
border-bottom: none;
}
.order-good .thumb-wrap {
position: relative;
float: left;
width: 90rpx;
height: 120rpx;
}
.order-good .thumb {
width: 100%;
height: 100%;
}
.productTag{
width: 100%;
height: 24rpx;
bottom: 0;
left: 0;
position: absolute;
}
image {
display: block;
margin: 0 auto;
max-width: 100%;
border: 0;
}
.order-good .deps {
display: flex;
width: 420rpx;
height: 100%;
background-color: white;
flex-direction: column;
/* justify-content: space-between; */
margin-left: 30rpx;
}
.order-good .deps .nameContainer {
width: 100%;
margin-top: 20rpx;
background-color: white;
line-height: 30rpx;
}
.order-good .deps .nameContainer .name{
color: #444444;
font-family: PingFang SC;
font-size: 28rpx;
background-color: white;
}
.order-good .deps .colorContainer {
display: flex;
margin-top: 15rpx;
flex-direction: row;
height: wrap;
line-height: 30rpx;
background-color: white;
}
.order-good .deps .colorContainer .color {
color: #B0B0B0;
font-family: PingFang SC;
font-size: 22rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.order-good .price-wrap {
flex-grow: 1;
height: 100%;
background-color: white;
flex-direction: column;
display: flex;
}
.order-good .price-wrap .price {
margin-top: 20rpx;
text-align: right;
font-family: PingFang SC;
font-size: 28rpx;
line-height: 40rpx;
color: #D0021B;
background-color: white;
}
.order-good .price-wrap .count {
color: #B0B0B0;
margin-top: 15rpx;
text-align: right;
font-family: PingFang SC;
font-size: 24rpx;
line-height: 34rpx;
background-color: white;
}
.order-good .deps .colorContainer .expire {
padding-left:20rpx;
color: #D0021B;
font-family: PingFang SC;
font-size: 22rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.addr-item {
line-height: 100rpx;
text-align: center;
}
.mask{
position:fixed;
top:0;
left:0;
background-color: #333;
filter: alpha(opacity=30);
opacity: 0.3;
width:100%;
height:100%;
z-index:1009
}
.picker-view{
z-index:1100;
background-color:white;
position:fixed;
bottom:0;
left:0;
width: 100%;
height: 400rpx;
}
.chooseBtn{
position: fixed;
background-color: white;
width: 80rpx;
height: 40rpx;
color: #444444;
font-size: 28rpx;
bottom: 340rpx;
right: 0;
z-index: 1101;
}
.order-detail-page .timeViewOpt {
/* height:150rpx; */
width: 100%;
text-align: right;
border-top: 1px solid #e0e0e0;
position: fixed;
bottom: 0px;
background: white;
}
.order-detail-page .timeViewOpt .timeView{
height: 60rpx;
width: 100%;
display: flex;
flex-direction:row;
align-items: center;
background: white;
justify-content: center;
}
.order-detail-page .timeViewOpt .timeView .timmmm{
height: 60rpx;
display: flex;
flex-direction:row;
align-items: center;
}
.order-detail-page .timeViewOpt .timeView .timmmm .timeIcon{
height: 24rpx;
width: 24rpx;
}
.order-detail-page .timeViewOpt .timeView .timmmm .counter{
margin-left: 10rpx;
font-size: 24rpx;
}
.order-detail-page .timeViewOpt .bottomViewLine{
height: 1rpx;
width: 100%;
background: #e0e0e0;
}
.order-detail-page .timeViewOpt .tips{
height: 52rpx;
width: 97.5%;
display: flex;
flex-direction:row;
align-items: center;
justify-content: flex-end;
background: white;
border-bottom: 1px solid #e0e0e0;
}
.order-detail-page .timeViewOpt .bottomView{
height: 120rpx;
width: 97.5%;
display: flex;
flex-direction:row;
align-items: center;
justify-content: flex-end;
background: white;
}
.order-detail-page .invite {
background: #d0021b;
}
.order-detail-page .inviteBtn {
height: 60rpx;
font-size: 28rpx;
text-align: center;
margin-right: 0rpx;
background: #d0021b;
color: #fff;
border: none;
margin-left: 0rpx;
padding: 0px 8px 0px 8px;
border-radius: 4rpx;
display: flex;
justify-content: center;
align-items: center;
}
.downloadApp{
width: 100%;
display: flex;
flex-direction: row;
padding-top: 20rpx;
padding-bottom: 20rpx;
padding-left: 25rpx;
align-items: center;
justify-content: flex-start;
background: white;
box-sizing: border-box;
}
.downloadApp .logoView{
width: 40rpx;
height: 40rpx;
position: relative;
}
.downloadApp .logoView .logo{
width: 100%;
height: 100%;
}
.downloadApp .tips{
font-family: PingFang-SC-Regular;
font-size: 24rpx;
color: #444444;
line-height: 34rpx;
margin-left: 10rpx;
}
.formulas{
width: 100%;
background: white;
margin-top: 20rpx;
padding-top: 20rpx;
padding-bottom: 20rpx;
box-sizing: border-box;
}
.space {
width: 96%;
margin-left: 4%;
height: 1rpx;
background-color: #f0f0f0;
}
.invoiceCell {
width: 100%;
padding-left: 4%;
padding-right: 4%;
background: white;
box-sizing: border-box;
align-items: center;
display: flex;
flex-direction: row;
}
.invoiceCell .invoiceCellName {
color: #444444;
font-family: PingFang SC;
font-size: 28rpx;
background-color: white;
text-align: left;
}
.invoiceCell .price {
text-align: right;
font-family: PingFang SC;
font-size: 28rpx;
color: #D0021B;
background-color: white;
flex-grow: 1;
}
.orderDetail{
width: 100%;
padding-left: 4%;
padding-right: 4%;
padding-bottom: 30rpx;
padding-top: 10rpx;
display: flex;
flex-direction: column;
align-items: left;
justify-content: center;
background: white;
box-sizing: border-box;
/* margin-bottom: 50rpx; */
}
.orderDetail .content{
width: 100%;
font-family: PingFang-SC-Regular;
font-size: 28rpx;
color: #444444;
margin-top: 20rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.orderNum{
display: flex;
margin-top: 20rpx;
flex-direction: row;
align-items: center;
}
.orderNum .ordernum{
font-family: PingFang-SC-Regular;
font-size: 28rpx;
color: #444444;
display: flex;
flex-direction: column;
justify-content: center;
}
.copyContainer{
margin-left: 10rpx;
padding-left: 10rpx;
padding-right: 10rpx;
background: white;
border-style: solid;
border-width: 1rpx;
border-color: #B0B0B0;
border-radius: 4rpx;
display: flex;
justify-content: center;
align-items: center;
}
.copy{
font-family: PingFang-SC-Regular;
font-size: 24rpx;
color: #444444;
text-align: center;
vertical-align: center;
align-items: center;
justify-content: center;
}
.likeContainer {
display: flex;
flex-direction: row;
flex-wrap: wrap;
background-color: white;
}
.titleContainer{
background-color: white;
border-bottom: 0.5rpx solid #e0e0e0;
display: flex;
flex-direction: row;
height: 80rpx;
align-items:center;
}
.titleLine{
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 20rpx;
}
.titleDesc{
flex: 1;
text-align: left;
font-family: PingFang SC;
font-size: 30rpx;
margin-left: 16rpx;
font-weight: 600;
color: #444444;
}
.bannerImage {
width: 100%;
height: 100%;
}
\ No newline at end of file
... ...
... ... @@ -21,7 +21,7 @@ let timer;
Page({
data: {
navData: [ '全部', '待付款', '待发货', '待收货' ],
index: 0,
selectIndex: 0,
orders:[],
showEmptyContainer: false,
from_page_name: '',
... ... @@ -41,16 +41,16 @@ Page({
onLoad:function(options){
// 生命周期函数--监听页面加载
if (options.index == "0") {
this.data.index = 0;
this.data.selectIndex = 0;
}
else if (options.index == "1") {
this.data.index = 1;
this.data.selectIndex = 1;
}
else if (options.index == "2") {
this.data.index = 2;
this.data.selectIndex = 2;
}
else if (options.index == "3") {
this.data.index = 3;
this.data.selectIndex = 3;
}
let from_page_name = options.page_name ? options.page_name : '';
... ... @@ -59,7 +59,7 @@ Page({
from_page_name, from_page_param
});
this.setData({
index: this.data.index
selectIndex: this.data.selectIndex
});
var pages = getCurrentPages()
... ... @@ -78,7 +78,7 @@ Page({
// //订阅登录完成通知
// listen(function (succeed) {
// if (succeed) {
// this.getOrders(this.data.index + 1);
// this.getOrders(this.data.selectIndex + 1);
// this.getRefundSeason();
// } else {
// let app = getApp()
... ... @@ -95,7 +95,7 @@ Page({
},
onShow:function(){
// 生命周期函数--监听页面显示
this.getOrders(this.data.index + 1);
this.getOrders(this.data.selectIndex + 1);
//获取退款理由
this.getRefundSeason();
},
... ... @@ -123,14 +123,12 @@ Page({
},
formSubmit: function (e) {
// console.log('####formID:', e.detail.formId)
let app = getApp();
let _self = this;
let formId = e.detail.formId;
_self.setData({
formId,
})
postFormId(formId,"7")
// // console.log('####formID:', e.detail.formId)
// let formId = e.detail.formId;
// this.setData({
// formId,
// })
// postFormId(formId,"7")
},
getRefundSeason:function(){
... ... @@ -186,17 +184,14 @@ Page({
api.get({data: param})
.then(json => {
tt.hideToast();
console.log('==========getOrders=================');
console.log(json);
console.log('====================================');
if (json && json.code && json.code == 200) {
this.formatImgUrl(json);
let orders = json.data.order_list;
orders = this.formatOrders(orders);
let index = mType - 1;
let selectIndex = mType - 1;
this.setData({
orders,
index,
selectIndex,
showEmptyContainer: json.data.order_list == 0
});
}
... ... @@ -238,16 +233,16 @@ Page({
return _orders;
},
onSelectChanged: function(e) {
let mType = e.currentTarget.dataset.type;
console.log(mType);
let mType = e.detail.currentTarget.dataset.type;
// console.log(mType);
this.getOrders(mType);
},
/**
* 取消订单
*/
onCloseOrderTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var tabStatus = e.currentTarget.dataset.tab_index;
var code = e.detail.currentTarget.dataset.order_code;
var tabStatus = e.detail.currentTarget.dataset.tab_index;
var _self = this;
var app = getApp();
this.setData({
... ... @@ -272,7 +267,7 @@ Page({
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
_self.getOrders(_self.data.index + 1);
_self.getOrders(_self.data.selectIndex + 1);
}
else if (json && json.code && json.code != 200){
tt.showModal({title: json.message, showCancel:false})
... ... @@ -288,7 +283,7 @@ Page({
* 确认收货
*/
onConfirmTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var code = e.detail.currentTarget.dataset.order_code;
var _self = this;
var app = getApp();
... ... @@ -317,7 +312,7 @@ Page({
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
_self.getOrders(_self.data.index + 1);
_self.getOrders(_self.data.selectIndex + 1);
}
else {
... ... @@ -366,7 +361,7 @@ Page({
* 删除订单
*/
onDelOrderTapped: function(e) {
var code = e.currentTarget.dataset.order_code;
var code = e.detail.currentTarget.dataset.order_code;
var _self = this;
tt.showModal({
content: '确认删除该订单吗?删除了的订单不可恢复!',
... ... @@ -383,7 +378,7 @@ Page({
api.get({data: param})
.then((json) => {
if (json && json.code && json.code == 200) {
_self.getOrders(_self.data.index + 1);
_self.getOrders(_self.data.selectIndex + 1);
}
})
.catch(error => {
... ... @@ -395,7 +390,7 @@ Page({
//申请退款
onRefundApplyTapped:function(e){
let that = this;
var code = e.currentTarget.dataset.order_code;
var code = e.detail.currentTarget.dataset.order_code;
this.setData({
orderCode: code,
});
... ... @@ -458,7 +453,7 @@ Page({
.then(json => {
this.hidderPicker();
if (json && json.code == 200) {
this.getOrders(this.data.index + 1);
this.getOrders(this.data.selectIndex + 1);
}
})
.catch(error => {
... ... @@ -484,7 +479,7 @@ Page({
.then(json=>{
this.hidderPicker();
if(json && json.code == 200){
this.getOrders(this.data.index + 1);
this.getOrders(this.data.selectIndex + 1);
}
})
.catch(error=>{
... ... @@ -507,7 +502,7 @@ Page({
})
},
onExpressTapped:function(e){
var code = e.currentTarget.dataset.order_code;
var code = e.detail.currentTarget.dataset.order_code;
// console.log("查看物流");
tt.navigateTo({
url: '../logisticsDetails/logisticsDetails?order_code=' + code,
... ... @@ -529,7 +524,7 @@ Page({
*/
onReaddTapped:function(e){
// console.log("再次购买tab");
var code = e.currentTarget.dataset.order_code;
var code = e.detail.currentTarget.dataset.order_code;
var that = this;
tt.showModal({
title: '确认将商品再次加入购物车?',
... ... @@ -565,17 +560,14 @@ Page({
* 跳转到订单详情页面
*/
navToOrderDetail: function(e) {
console.log('====================================');
console.log(e);
console.log('====================================');
let order_code = e.currentTarget.dataset.order_code;
if (e.currentTarget.dataset.attribute === "3"){
let order_code = e.detail.currentTarget.dataset.order_code;
if (e.detail.currentTarget.dataset.attribute === "3"){
tt.navigateTo({
url: "visualOrderDetail/visualOrderDetail?order_code=" + order_code + '&page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
});
} else {
tt.navigateTo({
url: "orderDetail/orderDetail?order_code=" + order_code + '&page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
url: "./orderDetail/orderDetail?order_code=" + order_code + '&page_name=' + this.data.current_page_name + '&page_param=' + this.data.current_page_param
});
}
},
... ... @@ -608,7 +600,7 @@ Page({
item.pay_lefttime = pay_lefttime - 1;
item.time_left = that.formatDate(pay_lefttime - 1);
if (item.pay_lefttime == 0){
that.getOrders(that.data.index + 1);
that.getOrders(that.data.selectIndex + 1);
}
}else{
item.pay_lefttime = 0;
... ...
... ... @@ -3,15 +3,18 @@
<!-- 防诈骗提示 -->
<fraudTip bindgoTODefraudPage="goTODefraudPage"></fraudTip>
<!-- 导航 -->
<orderNav data="{{navData}}" bindonSelectChanged="onSelectChanged"></orderNav>
<orderNav data="{{navData}}" selectIndex="{{selectIndex}}" bindonSelectChanged="onSelectChanged"></orderNav>
<!-- 订单列表 -->
<orderListCell orders="{{orders}}" bindnavToOrderDetail="navToOrderDetail" bindonCloseOrderTapped="onCloseOrderTapped" bindonReaddTapped="onReaddTapped" bindonBuyNowTapped="onBuyNowTapped" bindonBuyFromApp="onBuyFromApp" bindonDelOrderTapped="onDelOrderTapped" bindonExpressTapped="onExpressTapped" bindonConfirmTapped="onConfirmTapped" bindgotoGroupBuyDetail="gotoGroupBuyDetail"></orderListCell>
<!-- 空订单 -->
<view tt:if="{{showEmptyContainer}}" style="width:750rpx;height:100%;margin-top:350rpx" class="clearfix">
<image src="../../images/empty@2x.png" style="width:220rpx;height:220rpx"></image>
<view tt:if="{{showEmptyContainer}}" class="emptyContainer">
<image class="emptyIcon" src="../../images/empty@2x.png"></image>
<br />
<view style="font-size:30rpx;text-align:center;margin-top:20rpx">您还没有任何订单,赶快去逛逛吧</view>
<view class="emptyTips">您还没有任何订单,赶快去逛逛吧</view>
<button bindtap="goBackToTab" class="loginBtn">去逛逛</button>
</view>
... ...
... ... @@ -5,6 +5,21 @@ page {
background-color: #f0f0f0;
}
.emptyContainer {
width:750rpx;
height:100%;
margin-top:350rpx
}
.emptyIcon {
width:220rpx;
height:220rpx;
}
.emptyTips {
font-family: PingFang SC;
font-size:30rpx;
text-align:center;
margin-top:20rpx;
}
.loginBtn {
width: 65%;
height: 90rpx;
... ...