邓平艺 4 years ago
parent
commit
a400e22280
  1. 5
      colorui/main.css
  2. 12
      common/api.js
  3. 74
      common/uploadFile.js
  4. 3
      components/me-tabs/me-tabs.vue
  5. 3
      main.js
  6. 77
      pages/order/apply-details.vue
  7. 205
      pages/order/apply-refund.vue
  8. 7
      pages/order/confirm-order.vue
  9. 26
      pages/order/index.vue
  10. 15
      pages/order/order-details.vue
  11. 2
      pages/order/unpay-details.vue

5
colorui/main.css

@ -843,9 +843,10 @@ button.cuIcon.lg {
position: absolute;
top: -10upx;
left: -10upx;
font-size: 20upx;
padding: 10upx;
font-size: 28upx;
padding: 22upx;
height: 40upx;
font-weight: 200;
color: #ffffff;
}

12
common/api.js

@ -17,6 +17,18 @@ export const API_ORDER_DETAILS = '/api/order/detail';
//确认订单详情
export const API_COFIRMORDER_DETAILS = '/api/order/confirm';
//订单退款申请落地页
export const API_APPLY_DETAILS = '/api/refund/view';
//订单退款详情
export const API_APPLYPAGE_DETAILS = '/api/refund/detail';
//提交订单退款申请
export const API_SUBMIT_APPLY = '/api/refund/apply';
//退款申请图片上传
export const API_UPPLOAD_APPLY = '/api/refund/uploadImg'
/* 商品详情相关 */
export const API_GOODS_DETAIL = '/api/goods/detail'; // 商品详情
export const API_COLLECT_DEAL = '/api/collect/deal'; // 商品收藏

74
common/uploadFile.js

@ -0,0 +1,74 @@
/*
*上传文件
*@param - filePath :图片的本地资源路径
*@param - dir:表示要传到哪个目录下
*@param - successc:成功回调
*@param - failc:失败回调
*/
const uploadFile = function (filePath, successc, failc) {
if (!filePath || filePath.length < 9) {
wx.showModal({
title: '图片错误',
content: '请重试',
showCancel: false,
})
return;
}
// 上传的服务器地址
let url = this.API.DEVURL;
if (this.API.DEV == 'prod') {
url = this.API.PRODURL;
}
const url_a = this.API.API_UPPLOAD_APPLY;
// 上传图片的目录
var nowTime = formatTime(new Date());
const dir = 'wxmini/images/' + nowTime + '/';
// 获取上传的文件类型 fileType
let fileTypeIndex = filePath.lastIndexOf('.');
let fileType = filePath.substring(fileTypeIndex);
uni.uploadFile({
url: url + url_a,//开发者服务器 url
filePath: filePath,//要上传文件资源的路径
name: 'image',
formData: {
token: uni.getStorageSync('userinfo').token
},
success: function (res) {
console.log('上传文件...', res)
if (res.statusCode != 200 || !res.data) {
failc(new Error('上传错误:' + JSON.stringify(res)))
return;
}
let res_data = JSON.parse(res.data);
successc && successc(res_data.data);
},
fail: function (err) {
failc(err);
},
})
}
// 获取当前日期(年-月-日),并不足十位补零
function formatTime(date) {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('-')
// + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
uploadFile
};

3
components/me-tabs/me-tabs.vue

@ -175,7 +175,6 @@
color: black;
background-color: white;
border-radius: 10px;
margin: 2px 0;
height: 27px!important;
line-height: 27px!important;
}
@ -185,7 +184,7 @@
// item
.tabs-flex {
display: flex;
align-items: center;
.tab-item {
flex: 1;
background-color: #FE9903;

3
main.js

@ -3,6 +3,7 @@ import App from './App'
import mixin from '@/common/mixin.js';
import * as API from '@/common/api.js';
import * as $shared from '@/common/shared.js';
import { uploadFile } from '@/common/uploadFile.js'
Vue.config.productionTip = false
@ -14,6 +15,8 @@ Vue.prototype.API = API;
// 全局共享方法
Vue.prototype.$shared = $shared;
Vue.prototype.uploadFile = uploadFile
// 引入全局uView
import uView from 'uview-ui'
Vue.use(uView);

77
pages/order/apply-details.vue

@ -6,19 +6,19 @@
<skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
<view class="flex justify-between align-start padding-top-sm padding-lr">
<image src="@/static/tu.png" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
<image :src="orderDetails.order.goods.cover" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
<view class="flex-sub padding-left-sm">
<view class="bref-box margin-top-xs">
网红辣椒棒 魔鬼辣椒挑战全网第一辣 网红优惠季
{{orderDetails.order.goods.name}}
</view>
<text class="block margin-top-sm text-gray text-sm">数量 <text class="margin-left text-gray">x1</text></text>
<text class="block margin-top-sm text-gray text-sm">数量 <text class="margin-left text-gray">x {{orderDetails.order.number}}</text></text>
<view class="flex justify-between margin-top-sm">
<view class="text-red text-price text-lg">
19.90
{{orderDetails.order.selling_price}}
</view>
<view>
<button class="cu-btn border-blue bg-white text-blue round margin-left-sm text-sm">等待审核</button>
<button class="cu-btn line-gray bg-white border round margin-left-sm text-sm">等待审核</button>
</view>
</view>
</view>
@ -32,19 +32,19 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">订单金额</text>
<view class="text-price">
19.90
{{orderDetails.order.amount}}
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">扣费率</text>
<view>
<text>30%</text>
<text>{{orderDetails.refund_rate}}%</text>
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">扣费金额</text>
<view class="text-price">
3.90
{{orderDetails.refund_rate_amount}}
</view>
</view>
</view>
@ -56,14 +56,14 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">可退金额</text>
<view class="text-price">
16.00
{{orderDetails.refund_amount}}
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">订单编号</text>
<view>
<text class="margin-right">67432428794847982374</text>
<text class="text-orange text-sm" @tap="copy('67432428794847982374')">复制</text>
<text class="margin-right">{{orderDetails.order_sn}}</text>
<text class="text-orange text-sm" @tap="copy(orderDetails.order_sn)">复制</text>
</view>
</view>
</view>
@ -74,7 +74,7 @@
<view class="padding-top padding-lr bg-white">
<view class="cu-self menu">
<view class="text-gray">
由于产品的特殊性在申请的过程中供应商会向您收取部分费用如有疑问可参与产品的售后说明或咨询客服
{{checkArea}}
</view>
</view>
</view>
@ -83,19 +83,13 @@
<view class="text-df text-bold">退款说明</view>
</view>
<view class="cu-self menu margin-top">
<view class="text-gray">看着不是很新鲜了然后还有一些都烂了看着不是很新鲜了然后还有一些都烂了看着不是很新鲜了然后还有一些都烂了看着不是很新鲜了然后还有一些都烂了看着不是很新鲜了然后还有一些都烂了</view>
<view class="text-gray">{{orderDetails.comment}}</view>
</view>
</view>
<view class="cu-form-group solid-bottom">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img">
<image src="../../static/tu.png" @tap="showImg" mode="aspectFill"></image>
</view>
<view class="bg-img">
<image src="../../static/tu.png" @tap="showImg" mode="aspectFill"></image>
</view>
<view class="bg-img">
<image src="../../static/tu.png" @tap="showImg" mode="aspectFill"></image>
<view class="bg-img" v-for="(item,index) of images" :key="index">
<image :src="item.path" @tap="showImg" mode="aspectFill"></image>
</view>
</view>
</view>
@ -114,46 +108,41 @@
hostImg: '',
//
serverImg:'',
orderId:1,
orderDetails: {},
checkArea: '',
images: []
}
},
computed: {
},
onLoad(e) {
setTimeout(()=>{
this.skeletonLoading = false
},1000)
this.orderId = e.orderid
if(this.orderId) {
this.getOrderDetails()
}
},
methods: {
//
ChooseImage(e) {
uni.chooseImage({
count: 1,
success: e => {
this.hostImg = e.tempFilePaths[0];
getOrderDetails() {
this.$http(this.API.API_APPLYPAGE_DETAILS, {order_id: this.orderId}).then(res => {
if(res.code == 0) {
this.orderDetails = res.data.refund
this.checkArea = res.data.agreement.tips
this.images = res.data.refund.images
this.skeletonLoading = false
}
}).catch(err => {
});
},
//
showImg() {
uni.previewImage({
urls: ['../../static/tu.png']
});
},
//
DelImg() {
uni.showModal({
title: '提示',
content: '即将取消上传这张图片,请确认?',
success: e => {
if (!e.confirm) return;
this.hostImg = '';
this.serverImg = '';
}
});
},
//
copy(text) {
uni.setClipboardData({

205
pages/order/apply-refund.vue

@ -6,16 +6,16 @@
<skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
<view class="flex justify-between align-start padding-top-sm padding-lr">
<image src="@/static/tu.png" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
<image :src="applyDetails.order.goods.cover" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
<view class="flex-sub padding-left-sm">
<view class="bref-box margin-top-xs">
网红辣椒棒 魔鬼辣椒挑战全网第一辣 网红优惠季
{{applyDetails.order.goods.name}}
</view>
<text class="block margin-top-sm text-gray text-sm">数量 <text class="margin-left text-gray">x1</text></text>
<text class="block margin-top-sm text-gray text-sm">数量 <text class="margin-left text-gray">x{{applyDetails.order.number}}</text></text>
<view class="flex justify-between margin-top-sm">
<view class="text-red text-price text-lg">
19.90
{{applyDetails.order.selling_price}}
</view>
</view>
</view>
@ -30,19 +30,19 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">订单金额</text>
<view class="text-price">
19.90
{{applyDetails.order.amount}}
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">扣费率</text>
<view>
<text>30%</text>
<text>{{applyDetails.order.refund_rate}}%</text>
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">扣费金额</text>
<view class="text-price">
3.90
{{applyDetails.order.refund_rate_amount}}
</view>
</view>
</view>
@ -55,19 +55,19 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">可退金额</text>
<view class="text-price">
16.00
{{applyDetails.order.refund_amount}}
</view>
</view>
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="text-gray">订单编号</text>
<view>
<text class="margin-right">67432428794847982374</text>
<text class="text-orange text-sm" @tap="copy('67432428794847982374')">复制</text>
<text class="margin-right">{{applyDetails.order.order_sn}}</text>
<text class="text-orange text-sm" @tap="copy(applyDetails.order.order_sn)">复制</text>
</view>
</view>
<view class="cu-bar padding-lr solid-bottom">
<text class="text-gray">退款说明</text>
<input type="text" class="text-right text-df" placeholder="请输入反馈信息" />
<input type="text" v-model="applyInfo" class="text-right text-df" placeholder="请输入反馈信息" />
</view>
</view>
</skeleton>
@ -76,7 +76,7 @@
<view class="padding-top padding-lr bg-white">
<view class="cu-self menu">
<view class="text-gray">
由于产品的特殊性在申请的过程中供应商会向您收取部分费用如有疑问可参与产品的售后说明或咨询客服
{{applyDetails.agreement.tips}}
</view>
</view>
</view>
@ -87,17 +87,28 @@
</view>
<view class="cu-form-group solid-bottom">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in img_list" :key="index" @tap="showImg(item)" :data-url="img_list[index]">
<image :src="img_list[index]" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg(index)" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage" v-if="img_list.length<3">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
<!-- <view class="grid col-4 grid-square flex-sub">
<view class="solids" @tap="ChooseImage" v-if="hostImg == ''"><text class="cuIcon-cameraadd"></text></view>
<view class="bg-img" v-else>
<image :src="hostImg" @tap="showImg" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg"><text class="cuIcon-close"></text></view>
</view>
</view>
</view> -->
</view>
<view class="padding-top-sm padding-lr-lg">
<button class="cu-btn block bg-orange lg margin-top round" @tap="$routerGo('/pages/order/apply-details')">
<button class="cu-btn block bg-orange lg margin-top round" @tap="subimitApply()">
<text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
<text class="text-df text-white">确认申请</text>
</button>
@ -116,56 +127,194 @@
hostImg: '',
//
serverImg:'',
orderId: 1,
applyDetails: {},
applyInfo: '',
imageOnline: '',
is_wx_reduce: true,
img_list: [], //
}
},
computed: {
},
onLoad(e) {
this.orderId = e.orderId
if(this.orderId) {
this.getApplyDetails()
}
setTimeout(()=>{
this.skeletonLoading = false
},1000)
},
methods: {
getApplyDetails() {
this.$http(this.API.API_APPLY_DETAILS, {order_id: this.orderId}).then(res => {
if(res.code == 0) {
this.applyDetails = res.data
this.skeletonLoading = false
console.log(this.applyDetails)
}
}).catch(err => {
});
},
checkImgInfo(tempFilePath, suc){
uni.getImageInfo({
src: tempFilePath,
success (res) {
let type = res.type;
console.log('checkImgInfo...', type);
if(type == 'png' || type == 'jpeg' || type == 'jpg'){
suc && suc(true);
} else {
suc && suc(false);
}
},
fail(err) {
suc && suc(false);
}
})
},
subimitApply() {
if(!this.applyInfo) {
this.$msg('请先输入反馈信息!')
return
}
this.upload()
},
//
ChooseImage(e) {
let that = this;
uni.chooseImage({
count: 1,
success: e => {
this.hostImg = e.tempFilePaths[0];
this.upload(this.hostImg)
sizeType: ['original'], // originalcompressed
sourceType: ['album', 'camera'], // album camera 使
success: res => {
that.hostImg = res.tempFilePaths[0];
console.log('元数据')
console.log(res)
// this.upload(this.hostImg)
let tempFile = res.tempFiles.shift();
let tempFilePath = res.tempFilePaths.shift();
that.checkImgInfo(tempFilePath, (res) => {
// pngjpeg
if(res){
if(tempFile.size > 10000000){
uni.showModal({
title: '',
content: '您选择的图片过大:'+ (tempFile.size / 1024000).toFixed(2) +"M,请点击确定重新上传",
success: res2 => {
if(res2.confirm){
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res3) => {
let tempFilePath = res3.tempFilePaths.shift();
that.is_wx_reduce = true;
that.img_list.push(tempFilePath);
}
})
}
}
})
} else{
that.img_list.push(tempFilePath);
}
} else {
uni.showModal({
title: '',
content: '选择的图片须为jpg、jpeg或png格式',
showCancel: false,
confirmColor: '#1697EE'
})
}
});
}
});
},
//
upload(url){
this.$http.upload({
url: '/user/api/file/image',
data: url,
}).then(res=>{
let imgurl = JSON.parse(res.data)
this.serverImg=imgurl.data;
let that = this;
let uploads = [];
// banner
if (that.img_list.length > 0) {
for (let i = 0; i < that.img_list.length; i++) {
let upload_img = new Promise((resolve, reject) => {
that.uploadFile(that.img_list[i], (res) => {
resolve(res);
}, (err) => {
reject(err);
});
})
uploads.push(upload_img);
}
}
Promise.all(uploads).then((result) => {
console.log('图片上传...', result)
let img_url_list = [];
if(result.length > 0){
img_url_list = JSON.stringify(result);
}
if(img_url_list) {
that.realSubmitInfo(img_url_list);
}
}).catch(err => {
console.log(err)
that.is_publish = false; //
uni.showModal({
title: '',
content: '图片上传失败,请重新提交',
confirmColor: '#1697EE'
})
})
},
//
realSubmitInfo(img_url_list){
let that = this;
uni.showToast({
title: '请求中',
icon: "loading",
duration: 10000
})
that.$http(that.API.API_SUBMIT_APPLY, {order_id: that.orderId,comment: that.applyInfo,images:img_url_list}).then(res => {
if(res.code == 0) {
that.$msg('提交成功')
that.img_list = []
that.applyInfo = ''
setTimeout(() => {
that.$routerGo('/pages/order/apply-details?orderId='+that.orderId)
},1000)
}
}).catch(err => {
});
},
//
showImg() {
showImg(image) {
// let image = this.img_list[index];
uni.previewImage({
urls: [this.hostImg]
urls: [image],
});
},
//
DelImg() {
DelImg(index) {
uni.showModal({
title: '提示',
content: '即将取消上传这张图片,请确认?',
success: e => {
if (!e.confirm) return;
this.hostImg = '';
this.serverImg = '';
this.img_list.splice(index, 1);
}
});
},

7
pages/order/confirm-order.vue

@ -151,7 +151,14 @@
submit(){
if(this.ifchoose == true) {
if(this.ifCheck == false) {
uni.showModal({
title: '提示',
content: '是否同意前往手机授权?',
success: e => {
if (!e.confirm) return;
this.$routerGo('/pages/login/index?type=phone')
}
});
}else {
this.$http(this.API.API_PRPAID, {
goods_id: this.goods_id,

26
pages/order/index.vue

@ -2,15 +2,15 @@
<view>
<!-- 当设置tab-width,指定每个tab宽度时,则不使用flex布局,改用水平滑动 -->
<view class="padding-lr margin-bottom">
<me-tabs v-model="current" :tabs="tab_list" :fixed="true"></me-tabs>
<me-tabs v-model="current" :tabs="tab_list" :fixed="true" @change="change"></me-tabs>
<!-- <u-tabs :list="tab_list" :is-scroll="true" :show-bar="false" :current="current" @change="change"></u-tabs> -->
</view>
<view class="com" v-for="(tab, tabIndex) in tab_list" v-if="tabIndex == current" :key="tab.id">
<view class="flex-direction justify-around list" v-for="(item, index) in tab.list" :key="item.id" @click="goDetails(item)">
<view class="flex-direction justify-around list" v-for="(item, index) in tab.list" :key="item.id" @tap="goDetails(tabIndex,index)">
<view class="lf-row-between">
<view class="left">
<view class="left" style="position: relative;">
<image :src="item.goods.cover" mode=""></image>
<!-- <view class="cu-tag badge" style="position: relative;top: -100px;">待付款</view> -->
<view class="cu-tag badge tag-self text-lg" :style="{'background-color':item.state_text.bg_color,'color':item.state_text.color}">{{item.state_text.text}}</view>
</view>
<view class="right">
<view class="lf-line-2 title">{{item.goods.name}}</view>
@ -34,7 +34,7 @@
{{item.created_at_text}}
</view>
<view class="text-orange padding-top" v-if="item.state==1">
请在10分钟内付款
{{item.comment_text}}
</view>
</view>
</view>
@ -113,10 +113,17 @@
// tab
change(index) {
this.current = index;
this.getUserOrder();
},
goDetails(item) {
goDetails(tabIndex,index) {
// this.$routerGo('/pages/order/order-details?orderid=55')
console.log(tabIndex,index)
let item = this.tab_list[tabIndex].list[index]
if (item.state == 1) {
this.$routerGo('/pages/order/unpay-details?orderid=' + item.id)
} else if(item.state == 4){
this.$routerGo('/pages/order/apply-details?orderid=' + item.id)
}else {
this.$routerGo('/pages/order/order-details?orderid=' + item.id)
}
@ -201,6 +208,13 @@
</script>
<style lang="scss">
.tag-self {
position: absolute!important;
top: 0!important;
border-radius: 17px 0 10px 0!important;
width: max-content;
height: 24px!important;
}
.title {
font-size: 28rpx;
color: $u-content-color;

15
pages/order/order-details.vue

@ -19,8 +19,8 @@
{{Number(orderDetails.selling_price || 0)}}
</view>
<view>
<button v-if="orderDetails.state == 2" class="cu-btn line-orange round margin-left-sm text-sm" @tap="$routerGo('/pages/order/apply-refund')">申请退款</button>
<button v-if="orderDetails.state == 5" class="cu-btn line-gray bg-white border round margin-left-sm text-sm">退款中</button>
<button v-if="orderDetails.state == 2" class="cu-btn line-orange round margin-left-sm text-sm" @tap="$routerGo('/pages/order/apply-refund?orderId='+orderDetails.id)">申请退款</button>
<button v-else class="cu-btn line-gray bg-white border round margin-left-sm text-sm">{{orderDetails.state_text.text}}</button>
</view>
</view>
</view>
@ -70,19 +70,22 @@
<!-- :icon="require('@/static/images/system/user-default.jpg')" -->
</view>
<view class="flex justify-around align-center text-center margin-top-sm">
<view @tap="refreshCode()">
<view @tap="refreshCode()" v-if="orderDetails.state==2">
<image class="margin-right" src="@/static/images/system/refresh.png" mode="widthFix" style="width: 20px;height: 20px;"></image>
</view>
<view class="text-lg">{{checkArea}}</view>
<view class="text-orange text-sm margin-left" @tap="copy('SP738644872')">复制</view>
</view>
<view class="margin-top-sm text-green text-sm">
待使用
<view class="margin-top-sm text-gray text-sm" v-if="orderDetails.refund_text">
{{orderDetails.refund_text}}
</view>
<view class="margin-top-sm text-green text-sm" v-if="orderDetails.state == 2">
{{orderDetails.confirm_code_text}}
</view>
</view>
<view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top">
<view class="flex align-center">
<text class="text-gray text-sm">付款</text>
<text class="text-gray text-sm">付款</text>
<view class="text-lg text-price text-red">
{{Number(orderDetails.amount || 0)}}
</view>

2
pages/order/unpay-details.vue

@ -16,7 +16,7 @@
<view class="flex justify-between margin-top-sm">
<view class="text-red text-price text-lg">
<amount :value="Number(orderDetails.selling_price || 0)" :is-round-up="false" :precision="2" :duration="800" transition></amount>
{{Number(orderDetails.selling_price || 0)}}
</view>
<view>
<button v-if="orderDetails.state == 2" class="cu-btn line-orange round margin-left-sm text-sm" @tap="$routerGo('/pages/order/apply-refund')">申请退款</button>

Loading…
Cancel
Save