Browse Source

申请退款 退款详情 收藏列表(优化) 确认订单页面商品详情接口 登录(完善) 订单详情(完善) 我的频道(完善)

test
Enzo 5 years ago
parent
commit
0f5046d238
  1. 5
      common/api.js
  2. 2
      common/http.js
  3. 5
      common/uploadFile.js
  4. 40
      pages/channel/index.vue
  5. 6
      pages/collect/index.vue
  6. 4
      pages/discover/discover.vue
  7. 27
      pages/goodsDetail/index.vue
  8. 2
      pages/index/index.vue
  9. 8
      pages/order/apply_refund.vue
  10. 108
      pages/order/confirm_order.vue
  11. 4
      pages/order/order.vue
  12. 7
      pages/order/order_details.vue
  13. 7
      pages/order/refund_detail.vue
  14. 7
      pages/order/unpay_details.vue
  15. 4
      pages/user/user.vue

5
common/api.js

@ -12,7 +12,8 @@ export const API_WXLOGIN = '/api/login'; //登录
export const API_INDEX = '/api/index'; //首页
export const API_FAVOURITE = '/api/agent_product/guess'; //猜你喜欢
export const API_CHANNEL = '/api/channel/list'; //频道列表
export const API_CHANNEL = '/api/channel/list'; //全部频道列表
export const API_MYCHANNEL = '/api/user_channel/list'; //我的频道列表
export const API_EDITCHANNEL = '/api/user_channel/update'; //编辑频道
export const API_FINDARTICLE = '/api/article/list'; //发现文章列表
@ -30,7 +31,9 @@ export const API_NOTICEDETAILS = '/api/notice/show'; //公告详情
export const API_REGISTERAGREE = '/api/agent_info/reg_protocol'; //注册协议
export const API_BUYAGREE = '/api/agent_info/buy_protocol'; //购买协议
export const API_CONFIRMDETAILS = '/api/order/price'; //确认购买商品详情
export const API_CREATEORDER = '/api/order/create'; //创建订单
export const API_MESSAGELIST = '/api/message/list'; //消息列表

2
common/http.js

@ -94,7 +94,7 @@ function $http(url, data = {}, options = {}){
let user_info = uni.getStorageSync('userinfo')
let user_token = user_info.token
options.Authentication = user_token
options.Authentication = user_token || ''
// 发起请求
that.$u.post(url, data, options).then(res => {
resolve(res);

5
common/uploadFile.js

@ -29,8 +29,6 @@ const uploadFile = function (filePath, successc, failc) {
// 获取上传的文件类型 fileType
let fileTypeIndex = filePath.lastIndexOf('.');
let fileType = filePath.substring(fileTypeIndex);
console.log('上传方法的图片',filePath)
uni.uploadFile({
url: url + url_a,//开发者服务器 url
@ -42,13 +40,12 @@ const uploadFile = function (filePath, successc, failc) {
},
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);
successc && successc(res_data.data.path);
},
fail: function (err) {
failc(err);

40
pages/channel/index.vue

@ -36,20 +36,32 @@
select_list: {}, //
channel_list: [],
chanel_id: [],
my_list: [],
content_list: []
}
},
onLoad(){
this.getChannel()
this.getMyChancel()
},
methods: {
//
getMyChancel(){
this.$http(this.API.API_MYCHANNEL).then(res => {
this.my_list = res.data;
if(this.my_list) {
this.getChannel()
}
})
},
updateChannel() {
this.$http(this.API.API_EDITCHANNEL,{channels: this.chanel_id},{showLoading:false}).then(res => {
console.log(res)
this.$msg('添加频道成功')
}).catch(err => {
})
},
//
//
getChannel() {
this.$http(this.API.API_CHANNEL).then(res => {
let list = [];
@ -57,10 +69,11 @@
if(item.pid == 0) {
item.content = [];
list.push(item);
}else {
this.content_list.push(item)
}
})
this.channel_list = list;
res.data.forEach(item => {
this.channel_list.forEach((item2,index) => {
if(item.pid == item2.id) {
@ -71,12 +84,23 @@
}
})
})
this.channel_list.forEach((item,index) => {
item.content.forEach((item2,index2) => {
this.my_list.forEach((item3,index3) => {
console.log(item3)
if(item3 == item2.id) {
this.activaItem(item2,index2,index,item,1)
}
})
})
})
}).catch(err => {
})
},
//
activaItem(item2, index2, index, item){
activaItem(item2, index2, index, item,type){
let select_list = this.select_list;
if(!select_list[item2.name]){
if(Object.keys(select_list).length > 11){
@ -85,9 +109,13 @@
this.select_list[item2.name] = {p_index: index, c_index: index2};
this.chanel_id.push(item2.id);
this.channel_list[index].content[index2].checked = true;
console.log('频道',this.select_list)
}
}
this.updateChannel();
if(type != 1) {
this.updateChannel();
}
},
//
cancelItem(key){

6
pages/collect/index.vue

@ -76,15 +76,15 @@
},
//
switchCollect(index,if_collect){
let goods_id = this.list[index].id;
let goods_id = this.list[index].agent_product_id;
if(if_collect) {
this.$http(this.API.API_DELCOLLECT, {id:goods_id}).then(res => {
this.$http(this.API.API_DELCOLLECT, {agent_product_id:goods_id}).then(res => {
this.$msg('取消收藏成功!')
console.log(res)
this.list[index].is_collect = false;
})
}else {
this.$http(this.API.API_ADDCOLLECT, {id:goods_id}).then(res => {
this.$http(this.API.API_ADDCOLLECT, {agent_product_id:goods_id}).then(res => {
this.$msg('添加收藏成功!')
console.log(res)
this.list[index].is_collect = true;

4
pages/discover/discover.vue

@ -19,8 +19,8 @@
</view>
<!-- 加载 -->
<view class="loading-more lf-p-b-40">
<text v-if="article_list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
<lf-nocontent v-else></lf-nocontent>
<text v-if="article_list.length && loadingClass==false" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
<lf-nocontent v-if="!article_list.length && loadingClass==false"></lf-nocontent>
</view>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>

27
pages/goodsDetail/index.vue

@ -93,7 +93,7 @@
current: 0, //
goods_id: 0,
goods_detail: {},
is_collect: 0, // 10
is_collect: false, // 10
skeletonLoading: true
}
},
@ -130,10 +130,20 @@
this.$url('/pages/login/index?type=userinfo');
return;
}
this.$http(this.API.API_COLLECT_DEAL, {goods_id: this.goods_id}).then(res => {
this.$msg(res.msg);
this.is_collect = Boolean(res.data.is_collect);
})
if(this.is_collect) {
this.$http(this.API.API_DELCOLLECT, {agent_product_id:this.goods_id}).then(res => {
this.$msg('取消收藏成功!')
this.is_collect = false
console.log(res)
})
}else {
this.$http(this.API.API_ADDCOLLECT, {agent_product_id:this.goods_id}).then(res => {
this.$msg('添加收藏成功!')
this.is_collect = true
console.log(res)
})
}
},
//
makePhoneCall(phoneStr){
@ -154,8 +164,7 @@
//
toAddOrder(){
let goods_id = this.goods_detail.id;
let goods_specs_id = this.goods_detail.specs[0].id
this.$url('/pages/order/confirm_order?goods_id='+ goods_id +'&goods_specs_id='+ goods_specs_id);
this.$url('/pages/order/confirm_order?goods_id='+ goods_id);
},
//
lookImg(index){
@ -253,8 +262,8 @@
flex-wrap: wrap;
padding: 30rpx 0 10rpx 0;
.label-item{
width: 162rpx;
// padding: 20rpx;
width: max-content;
padding: 20rpx;
height: 70rpx;
border-radius: 10rpx;
border: 2rpx solid #1998FE;

2
pages/index/index.vue

@ -127,7 +127,7 @@
notice: []
}
},
onLoad() {
onShow() {
// this.addRandomData();
this.getIndexData()
this.getFavourite()

8
pages/order/apply_refund.vue

@ -190,10 +190,8 @@
for (let i = 0; i < that.img_list.length; i++) {
let upload_img = new Promise((resolve, reject) => {
that.uploadFile(that.img_list[i], (res) => {
console.log('标记1',res)
resolve(res);
}, (err) => {
console.log('标记1',err)
reject(err);
});
})
@ -205,10 +203,9 @@
return
}
Promise.all(uploads).then((result) => {
console.log('图片上传...', result.path)
let img_url_list = [];
if(result.length > 0){
img_url_list = JSON.stringify(result.path);
img_url_list = result;
}
if(img_url_list) {
that.realSubmitInfo(img_url_list);
@ -216,7 +213,6 @@
}).catch(err => {
console.log(err)
that.is_publish = false; //
uni.showModal({
title: '',
@ -246,7 +242,7 @@
console.log(that.order_id)
setTimeout(() => {
console.log(that.order_id)
that.$url('/pages/order/apply-details?order_id='+that.order_id,{type:'launch'})
that.$url('/pages/order/refund_detail?order_id='+that.order_id,{type:'launch'})
},1000)
}

108
pages/order/confirm_order.vue

@ -1,21 +1,21 @@
<template>
<view>
<view v-if="$isRight(goods_details)">
<view class="lf-bg-white lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32">
<view class="lf-row-between">
<image src="../../static/logo.png" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
<image :src="goods_details.product.picture" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
<view class="flex-sub padding-left-sm">
<view class="bref-box lf-font-32 lf-color-333 lf-line-2" style="height: 88rpx;line-height: 44rpx;">
南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳
{{goods_details.product.title}}
</view>
<view class="flex lf-m-t-25 align-center text-center">
<text class="block lf-color-gray lf-font-24" style="line-height: 40rpx;">数量</text>
<text class="lf-m-l-10 lf-color-gray lf-font-24">x 1</text>
<text class="lf-m-l-10 lf-color-gray lf-font-24">x {{goods_details.num}}</text>
</view>
<view class="flex align-center text-center lf-m-t-25">
<lf-price :price="599.00" />
<lf-price :price="goods_details.price" />
<view class="lf-m-l-20 lf-line-through lf-color-gray">
599.00
{{goods_details.original_price}}
</view>
</view>
</view>
@ -25,51 +25,72 @@
<view class="bg-white">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">优惠</text>
<text class="lf-color-price lf-font-28">活动优惠-50</text>
<view v-if="goods_details.coupon != ''">
<text class="lf-color-price lf-font-28 lf-m-r-10" v-for="(item,index) of goods_details.coupon">{{item.tag}}</text>
</view>
<view v-else>
<text class="lf-color-price lf-font-28 lf-m-r-10">暂无优惠</text>
</view>
</view>
</view>
<self-line/>
<view class="bg-white">
<view class="bg-white" v-if="btn_type!=2">
<view class="cu-bar padding-lr solid-bottom">
<text class="lf-color-555 lf-font-28">联系人</text>
<input type="text" class="lf-color-999 lf-font-28 lf-text-right" placeholder="请输入联系人" />
<input type="text" v-model="contact" class="lf-color-999 lf-font-28 lf-text-right" placeholder="请输入联系人" />
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">联系方式</text>
<input type="text" class="lf-color-999 lf-font-28 lf-text-right" placeholder="请输入联系电话" maxlength="11" />
<input type="text" v-model="phone" class="lf-color-999 lf-font-28 lf-text-right" placeholder="请输入联系电话" maxlength="11" />
</view>
</view>
<self-line/>
<view class="bg-white">
<view class="bg-white" v-if="btn_type!=2">
<view class="lf-p-t-30 lf-p-l-32 lf-p-b-36">
<view class="lf-font-28 lf-color-555">支付方式</view>
</view>
<view class="lf-p-r-32 lf-p-l-32">
<button class="cu-btn bg-white margin-self border-green" @tap="$url('/pages/order/order-details?order_id='+order_id,{type: 'launch'})">
<button class="cu-btn bg-white margin-self" :class="pay_type==0?'border-green':'border'" @tap="payStatus(0)">
<text class="lf-iconfont lf-icon-weixin text-green lf-font-44 lf-m-r-23"></text>
<text class="lf-font-32 text-green">微信支付</text>
<text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" style="position: absolute;right: 22rpx;"></text>
<text class="lf-font-32" :class="pay_type==0?'text-green':'lf-color-333'">微信支付</text>
<text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==0" style="position: absolute;right: 22rpx;"></text>
</button>
</view>
<view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
<button class="cu-btn bg-white margin-self" :class="pay_type==1?'border-green':'border'" @tap="payStatus(1)">
<text class="lf-font-32" :class="pay_type==1?'text-green':'lf-color-333'">定金支付</text>
<text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==1" style="position: absolute;right: 22rpx;"></text>
</button>
</view>
<view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
<button class="cu-btn bg-white margin-self border" @tap="$url('/pages/order/order-details?order_id='+order_id,{type: 'launch'})">
<text class="lf-font-32 lf-color-333">线下支付</text>
<button class="cu-btn bg-white margin-self" :class="pay_type==2?'border-green':'border'" @tap="payStatus(2)">
<text class="lf-font-32" :class="pay_type==2?'text-green':'lf-color-333'">首款支付</text>
<text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==2" style="position: absolute;right: 22rpx;"></text>
</button>
</view>
<view class="lf-p-r-32 lf-p-l-32 lf-m-t-30">
<button class="cu-btn bg-white margin-self" :class="pay_type==3?'border-green':'border'" @tap="payStatus(3)">
<text class="lf-font-32" :class="pay_type==3?'text-green':'lf-color-333'">线下支付</text>
<text class="lf-iconfont lf-icon-dui lf-font-44 lf-color-primary" v-if="pay_type==3" style="position: absolute;right: 22rpx;"></text>
</button>
</view>
</view>
<view class="btn-bottom solid-top1">
<view class="padding-lr lf-p-t-10 lf-p-b-10 bg-white flex justify-between align-center shadow">
<view class="flex align-center">
<text class="lf-font-24 lf-font-555">应付款</text>
<lf-price :price="549.00" />
<lf-price :price="goods_details.final_price" />
</view>
<button class="btn" @tap="submit">
<text class="lf-font-32 text-white" v-if="type == 1">立即付款</text>
<text class="lf-font-32 text-white" v-else>下单付</text>
<text class="lf-font-32 text-white" v-if="btn_type == 1">下单付款</text>
<text class="lf-font-32 text-white" v-else>支付尾</text>
</button>
</view>
</view>
@ -77,6 +98,55 @@
</template>
<script>
export default {
data() {
return {
goods_id: 0,
goods_details: {},
contact: '',
phone: '',
pay_type: 0,
btn_type: 1
}
},
onLoad(e) {
this.goods_id = e.goods_id;
this.btn_type = e.btn_type
if(this.goods_id) {
this.getGoodsData(this.pay_type);
}
},
methods: {
payStatus(type) {
if(type == this.pay_type) {
this.pay_type = type;
return
}else {
this.pay_type = type;
this.getGoodsData(type);
}
},
getGoodsData(type){
this.$http(this.API.API_CONFIRMDETAILS,{id: this.goods_id,num: 1,pay_type: type}).then(res => {
this.goods_details = res.data;
console.log(res)
})
},
submit() {
if(!this.contact) {
this.$msg('请输入联系人!');
return;
}
if(!this.phone) {
this.$msg('请输入联系电话!');
return;
}
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => {
console.log(res);
})
}
}
}
</script>
<style>

4
pages/order/order.vue

@ -22,8 +22,8 @@
</view>
<view class="lf-row-between price lf-m-t-16" style="padding-right: 6rpx;">
<lf-price :price="item.price" style="margin-top: 10rpx;" />
<button class="lf-font-24 radius-order col-btn0" v-if="item.status == 0">立即付款</button>
<button class="lf-font-24 radius-order col-btn0" v-if="item.status == 1">支付尾款</button>
<button class="lf-font-24 radius-order col-btn0" v-if="item.status == 0" @click="$url('/pages/order/confirm_order?goods_id='+item.id+'&btn_type=1')">立即付款</button>
<button class="lf-font-24 radius-order col-btn0" v-if="item.status == 1" @click="$url('/pages/order/confirm_order?goods_id='+item.id+'&btn_type=2')">支付尾款</button>
<button class="lf-font-24 radius-order col-btn1" v-if="item.status == 2 || item.status == 3">立即使用</button>
<button class="lf-font-24 radius-order col-btn16" v-if="item.status == 16">已使用</button>
<button class="lf-font-24 radius-order col-btn6" v-if="item.status == 6">等待审核</button>

7
pages/order/order_details.vue

@ -52,7 +52,12 @@
<view class="bg-white">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">优惠</text>
<text class="lf-font-28 lf-color-price">活动优惠-50</text>
<view v-if="orderDetails.coupon != ''">
<text class="lf-color-price lf-font-28 lf-m-r-10" v-for="(item,index) of orderDetails.coupon">{{item.tag}}</text>
</view>
<view v-else>
<text class="lf-color-price lf-font-28 lf-m-r-10">暂无优惠</text>
</view>
</view>
</view>

7
pages/order/refund_detail.vue

@ -2,7 +2,7 @@
<view v-if="isRight(orderDetails)">
<view class="lf-bg-white lf-p-t-30 lf-p-b-30 lf-p-l-32 lf-p-r-32">
<view class="lf-row-between">
<image src="../../static/logo.png" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
<image :src="orderDetails.picture" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
<view class="flex-sub padding-left-sm">
<view class="bref-box lf-font-32 lf-color-333 lf-line-2" style="height: 88rpx;line-height: 44rpx;">
{{orderDetails.title}}
@ -40,14 +40,14 @@
<view class="bg-white lf-m-b-6">
<view class="lf-p-t-30 lf-p-l-32 lf-p-r-32 lf-p-b-36">
<view class="lf-font-28 lf-color-black lf-m-b-20 lf-font-bold">退款说明</view>
<view>南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳</view>
<view>{{orderDetails.refund_info.desc}}</view>
</view>
</view>
<view class="cu-form-group solid-bottom" style="padding-bottom: 20rpx;" v-if="img_list.length != 0">
<view class="grid col-4 grid-square flex-sub">
<view style="width: 212rpx;height: 212rpx;border-radius: 10rpx;" class="bg-img" v-for="(item,index) of img_list" :key="index">
<image :src="item.path" @tap="showImg(index)" style="width: 216rpx;height: 216rpx;" mode="aspectFill"></image>
<image :src="item" @tap="showImg(index)" style="width: 216rpx;height: 216rpx;" mode="aspectFill"></image>
</view>
</view>
</view>
@ -91,6 +91,7 @@
id: this.order_id
}).then(res => {
this.orderDetails = res.data
this.img_list = res.data.refund_info.pictures
console.log(res.data)
}).catch(err => {

7
pages/order/unpay_details.vue

@ -48,7 +48,12 @@
<view class="bg-white">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">优惠</text>
<text class="lf-font-28 lf-color-price">活动优惠-50</text>
<view v-if="orderDetails.coupon != ''">
<text class="lf-color-price lf-font-28 lf-m-r-10" v-for="(item,index) of orderDetails.coupon">{{item.tag}}</text>
</view>
<view v-else>
<text class="lf-color-price lf-font-28 lf-m-r-10">暂无优惠</text>
</view>
</view>
</view>

4
pages/user/user.vue

@ -7,7 +7,7 @@
<view class="lf-font-36 align-center text-center text-white lf-m-t-30">
{{userInfo.nickname}}
</view>
<image class="bg-img" :src="userInfo.avatar" mode="aspectFill" style="filter: blur(4px);"></image>
<image class="bg-img" :src="userInfo.avatar" mode="aspectFill" style="filter: blur(3px);"></image>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/order/order')">
@ -177,7 +177,7 @@
this.getRecommond();
}
},
onLoad() {
onShow() {
this.verifyUserInfo()
this.getRecommond()
}

Loading…
Cancel
Save