Browse Source

登录接口(优化) 获取用户信息接口 图片上传接口 注册协议 购买协议 订单详情 申请退款(待接口完善) 公告详情接口

test
Enzo 4 years ago
parent
commit
4983cc4b46
  1. 12
      common/api.js
  2. 32
      common/mixin.js
  3. 77
      common/uploadFile.js
  4. 4
      main.js
  5. 12
      pages.json
  6. 32
      pages/about/buy_agree.vue
  7. 32
      pages/about/register_agree.vue
  8. 36
      pages/collect/index.vue
  9. 4
      pages/goodsDetail/index.vue
  10. 2
      pages/index/index.vue
  11. 20
      pages/login/index.vue
  12. 31
      pages/message/index.vue
  13. 10
      pages/notice/notice.vue
  14. 85
      pages/order/apply_refund.vue
  15. 98
      pages/order/order.vue
  16. 67
      pages/order/order_details.vue
  17. 162
      pages/order/refund_detail.vue
  18. 45
      pages/order/unpay_details.vue
  19. 47
      pages/user/user.vue

12
common/api.js

@ -25,6 +25,12 @@ export const API_ADVICEDETAILS = '/api/agent_product/show'; //推荐列表详情
export const API_PRODUCTLIST = '/api/channel/product'; //频道产品列表
export const API_SPECIALLIST = '/api/special/show'; //专题列表
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_MESSAGELIST = '/api/message/list'; //消息列表
@ -34,8 +40,14 @@ export const API_CHECKNEWS = '/api/message/read'; //消息标记为已读
export const API_RECOMMOND = '/api/agent_product/recommend'; //我的推荐列表
//用户信息
export const API_GETUSERINFO = '/api/user/profile'; //获取用户消息
//订单
export const API_ORDERLIST = '/api/order/list'; //订单列表
export const API_ORDER_DETAILS = '/api/order/show'; //订单详情
export const API_APPLYREFUND = '/api/order/refund'; //申请退款
export const API_UPPLOAD_APPLY = '/api/upload/image'//退款申请图片上传
//系统

32
common/mixin.js

@ -88,6 +88,36 @@ export default{
}else{
uni.switchTab({url:'/pages/index/index'});
}
}
},
$timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
// 遍历这个对象
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
},
}
}

77
common/uploadFile.js

@ -0,0 +1,77 @@
/*
*上传文件
*@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);
console.log('上传方法的图片',filePath)
uni.uploadFile({
url: url + url_a,//开发者服务器 url
filePath: filePath,//要上传文件资源的路径
name: 'image',
header: {
appid: 'wx0e8ebcd9ca9e4b97',
Authentication: 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
};

4
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,9 @@ Vue.mixin(mixin);
Vue.prototype.API = API;
// 全局共享方法
Vue.prototype.$shared = $shared;
Vue.prototype.uploadFile = uploadFile
// 引入全局uView
import uView from 'uview-ui';
Vue.use(uView);

12
pages.json

@ -125,6 +125,18 @@
"navigationBarTitleText": "关于我们"
}
},
{
"path": "pages/about/register_agree",
"style": {
"navigationBarTitleText": "注册协议"
}
},
{
"path": "pages/about/buy_agree",
"style": {
"navigationBarTitleText": "购买协议"
}
},
{
"path": "pages/channel/index",
"style": {

32
pages/about/buy_agree.vue

@ -0,0 +1,32 @@
<template>
<view>
<rich-text :nodes="content" v-if="$isRight(content)"></rich-text>
<lf-nocontent v-else></lf-nocontent>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>
<script>
export default {
data(){
return {
content: ''
}
},
onLoad(){
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_BUYAGREE).then(res => {
this.content = res.data?.buy_protocol;
})
}
}
}
</script>
<style lang="scss" scoped="scoped">
</style>

32
pages/about/register_agree.vue

@ -0,0 +1,32 @@
<template>
<view>
<rich-text :nodes="content" v-if="$isRight(content)"></rich-text>
<lf-nocontent v-else></lf-nocontent>
<!-- 回到顶部 -->
<u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
</view>
</template>
<script>
export default {
data(){
return {
content: ''
}
},
onLoad(){
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_REGISTERAGREE).then(res => {
this.content = res.data?.reg_protocol;
})
}
}
}
</script>
<style lang="scss" scoped="scoped">
</style>

36
pages/collect/index.vue

@ -5,7 +5,7 @@
<image class="goods-img" mode="aspectFill" :src="item.product.picture" @click="enterDetail(item.id)"></image>
<view style="width: 458rpx;">
<view class="lf-font-28 lf-line-2" style="height: 80rpx;" @click="enterDetail(item.id)">{{ item.product.title }}</view>
<view class="lf-m-t-15 lf-font-24 lf-color-gray">{{ timer(item.created_at*1000) || '' }}</view>
<view class="lf-m-t-15 lf-font-24 lf-color-gray">{{ $timer(item.created_at*1000) || '' }}</view>
<view class="lf-row-between lf-m-t-20">
<lf-price price="3599.00"></lf-price>
@ -95,39 +95,7 @@
//
enterDetail(id){
this.$url('/pages/goodsDetail/index?goods_id='+ id);
},
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
},
}
},
onReachBottom(){
if(this.isPage){

4
pages/goodsDetail/index.vue

@ -115,7 +115,7 @@
this.$http(this.API.API_ADVICEDETAILS, {id: this.goods_id}).then(res => {
this.skeletonLoading = false;
this.goods_detail = res.data;
// this.is_collect = Boolean(res.data.user.is_collect) || false;
this.is_collect = Boolean(res.data.is_collect) || false;
}).catch(err => {
this.skeletonLoading = false;
setTimeout(() => {
@ -132,7 +132,7 @@
}
this.$http(this.API.API_COLLECT_DEAL, {goods_id: this.goods_id}).then(res => {
this.$msg(res.msg);
this.is_collect = Boolean(res.data.user.is_collect);
this.is_collect = Boolean(res.data.is_collect);
})
},
//

2
pages/index/index.vue

@ -12,7 +12,7 @@
<text class="lf-iconfont lf-icon-tongzhi lf-text-vertical"></text>
<view class="lf-m-l-12 lf-line-1" style="max-width: 510rpx;">{{item.title}}</view>
</view>
<view class="message-btn" hover-class="lf-opacity" @click="$url('/pages/notice/article')">详情</view>
<view class="message-btn" hover-class="lf-opacity" @click="$url('/pages/notice/notice?notice_id='+item.id)">详情</view>
</view>
<!-- 频道 -->
<view class="lf-row-between lf-m-b-10">

20
pages/login/index.vue

@ -23,15 +23,15 @@
</block>
</view>
<!-- 服务条款 -->
<view class="fixed-bottom lf-flex" v-show="agreement.title">
<view class="fixed-bottom lf-flex">
<checkbox-group @change="checkboxChange" style="display: inline-block;">
<checkbox class="lf-text-vertical" :checked="checked"></checkbox>
</checkbox-group>
<view class="lf-m-l-10 lf-font-24 lf-color-gray" style="display: inline-block;">
<text>请认真阅读并同意</text>
<text @click="enterAgree" class="text-orange">{{ agreement.title }}</text>
<text @click="enterAgree" class="text-orange">用户协议</text>
<text>在小程序下单购买即表示您已默认同意</text>
<text @click="enterAgree" class="text-orange">{{ agreement.title }}</text>
<text @click="enterAgree" class="text-orange">用户协议</text>
<text>的所有条款</text>
</view>
</view>
@ -51,21 +51,14 @@
},
onLoad(options){
this.type = options.type || this.type;
this.getAgree();
getApp().globalData.wxlogin().then(res => {
this.userInfo = res;
});
},
methods: {
//
getAgree(){
this.$http(this.API.API_WXLOGIN_VIEW).then(res => {
this.agreement = res.data?.agreement;
})
},
//
enterAgree(){
this.$url('/pages/agreement/agreement?id='+ this.agreement.article_id);
this.$url('/pages/about/register_agree');
},
//
checkboxChange(event){
@ -73,12 +66,13 @@
},
//
getPhoneNumber(event){
console.log('=====',this.API.API_GETUSERINFO)
console.log(event);
if(event.detail.errMsg == 'getPhoneNumber:ok'){
let encryptedData = event.detail.encryptedData;
let iv = event.detail.iv;
// let userInfo = uni.getStorageSync('userinfo') || {};
this.$http(this.API.API_WECHAT_SETPHONE, {
this.$http(this.API.API_GETUSERINFO, {
encryptedData,
iv,
// token: userInfo.token //
@ -105,7 +99,7 @@
let signature = result.signature;
// let userInfo = uni.getStorageSync('userinfo') || {};
this.$http(this.API.API_WECHAT_SETPROFILE, {
this.$http(this.API.API_GETUSERINFO, {
encryptedData,
iv,
// token: userInfo.token //

31
pages/message/index.vue

@ -7,7 +7,7 @@
<text class="gray" v-else></text>
<text class="lf-font-28 lf-m-l-10">收到一条新消息</text>
</view>
<view class="lf-color-gray lf-font-22">{{timer(item.created_at*1000) || ''}} </view>
<view class="lf-color-gray lf-font-22">{{$timer(item.created_at*1000) || ''}} </view>
</view>
<view class="lf-font-24 lf-color-555">{{item.title}}</view>
</view>
@ -36,35 +36,6 @@
this.getMessageList()
},
methods: {
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
},
goDetails(id) {
this.$url('/pages/message/detail?news_id='+id)
},

10
pages/notice/notice.vue

@ -11,15 +11,17 @@
export default {
data(){
return {
content: ''
content: '',
notice_id: 0
}
},
onLoad(){
// this.getData();
onLoad(e){
this.notice_id = e.notice_id
this.getData();
},
methods: {
getData(){
this.$http(this.API.API_ARTICLE_QA).then(res => {
this.$http(this.API.API_NOTICEDETAILS,{id:this.notice_id}).then(res => {
this.content = res.data?.content;
})
}

85
pages/order/apply_refund.vue

@ -1,22 +1,22 @@
<template>
<view>
<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}}
</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 {{orderDetails.num}}</text>
</view>
<view class="flex align-center text-center lf-m-t-25">
<lf-price :price="599.00" />
<view class="lf-m-l-20 lf-line-through lf-color-gray">
599.00
</view>
<lf-price :price="orderDetails.price" />
<!-- <view class="lf-m-l-20 lf-line-through lf-color-gray">
{{orderDetails.price}}
</view> -->
</view>
</view>
</view>
@ -25,12 +25,12 @@
<view class="bg-white padding-lr">
<view class="cu-bar lf-border-bottom">
<text class="lf-color-555 lf-font-28">可退金额</text>
<text class="text-price lf-font-36 lf-color-price">549.00</text>
<text class="text-price lf-font-36 lf-color-price">{{orderDetails.price}}</text>
</view>
<view class="cu-bar flex justify-between align-center text-center">
<text class="lf-color-555 lf-font-28">订单编号</text>
<view>
<text class="lf-font-28 text-black1">2368492461046128742764</text>
<text class="lf-font-28 text-black1">{{orderDetails.order_no}}</text>
<!-- <text class="text-orange lf-font-28" @click="copy(2368492461046128742764)">复制</text> -->
</view>
</view>
@ -79,9 +79,37 @@
hostImg: '',
img_list: [], //
applyInfo: '', // 退
order_id: 0,
orderDetails: {}
}
},
onLoad(e) {
this.order_id = e.order_id
if(this.order_id) {
this.getOrderDetails()
}
},
methods: {
subimitApply() {
if(!this.applyInfo) {
this.$msg('请先输入反馈信息!')
return
}
this.upload()
},
getOrderDetails() {
this.$http(this.API.API_ORDER_DETAILS, {
id: this.order_id
}).then(res => {
this.orderDetails = res.data
console.log(res.data)
}).catch(err => {
setTimeout(() => {
this.$toBack()
}, 1000)
});
},
dynamicLength(){
return parseInt(this.applyInfo.length);
},
@ -113,6 +141,7 @@
that.hostImg = res.tempFilePaths[0];
let tempFile = res.tempFiles.shift();
let tempFilePath = res.tempFilePaths.shift();
console.log('临时路径',res)
that.checkImgInfo(tempFilePath, (res) => {
// pngjpeg
if(res){
@ -137,6 +166,7 @@
})
} else{
that.img_list.push(tempFilePath);
console.log('图片数组',that.img_list)
}
} else {
uni.showModal({
@ -160,8 +190,10 @@
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);
});
})
@ -173,10 +205,10 @@
return
}
Promise.all(uploads).then((result) => {
console.log('图片上传...', result)
console.log('图片上传...', result.path)
let img_url_list = [];
if(result.length > 0){
img_url_list = JSON.stringify(result);
img_url_list = JSON.stringify(result.path);
}
if(img_url_list) {
that.realSubmitInfo(img_url_list);
@ -193,6 +225,35 @@
})
})
},
//
realSubmitInfo(img_url_list){
let that = this;
console.log('上次时的图片数组',img_url_list)
let params = {id: that.order_id,desc: that.applyInfo,pictures:img_url_list}
if(img_url_list.length == 0) {
delete params.images;
}
uni.showToast({
title: '请求中',
icon: "loading",
duration: 10000
})
that.$http(that.API.API_APPLYREFUND, params).then(res => {
if(res.code == 0) {
that.$msg('提交成功')
that.img_list = []
that.applyInfo = ''
console.log(that.order_id)
setTimeout(() => {
console.log(that.order_id)
that.$url('/pages/order/apply-details?order_id='+that.order_id,{type:'launch'})
},1000)
}
}).catch(err => {
});
},
//
showImg(index) {
this.$u.throttle(() => {

98
pages/order/order.vue

@ -22,21 +22,22 @@
</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">立即付款</button>
<!-- <button class="cu-btn1 lf-color-green lf-border-green">立即使用</button> -->
<!-- <button class="cu-btn1 lf-color-blue lf-border-blue">已使用</button> -->
<!-- <button class="cu-btn1 lf-color-gray lf-border-gray">等待审核</button> -->
<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-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>
<button class="lf-font-24 radius-order col-btn7" v-if="item.status == 7">退款成功</button>
</view>
</view>
</view>
<view>
<view class="solid-top flex justify-between align-center text-center">
<view class="text-gray lf-font-28" style="padding: 20rpx;">
{{timer(item.created_at*1000)}}
{{$timer(item.created_at*1000)}}
</view>
<view class="lf-color-price" style="padding: 20rpx 24rpx 20rpx 20rpx;">
请在10分钟内付款
<view :class="'col-status'+item.status" style="padding: 20rpx 24rpx 20rpx 20rpx;">
{{item.status_text}}
</view>
</view>
</view>
@ -131,14 +132,13 @@
}
},
goDetails(tabIndex,index) {
console.log(tabIndex,index)
let item = this.tab_list[tabIndex].list[index]
if (item.state == 1) {
this.$routerGo('/pages/order/unpay-details?order_id=' + item.id)
} else if(item.state == 4){
this.$routerGo('/pages/order/refund_detail?order_id=' + item.id)
if (item.status == 1) {
this.$url('/pages/order/unpay_details?order_id=' + item.id)
}else if(item.status == 6){
this.$url('/pages/order/refund_detail?order_id=' + item.id)
}else {
this.$routerGo('/pages/order/order-details?order_id=' + item.id)
this.$url('/pages/order/order_details?order_id=' + item.id)
}
},
@ -204,35 +204,6 @@
tab_item.list = []
tab_item.loadingText = '正在加载中';
this.getUserOrder(options);
},
timer(value, fmt) {
if(!value) return;
let newTime = new Date(value)
if(!fmt){
fmt = 'yyyy-MM-dd hh:mm';
}
if(/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (newTime.getFullYear() + '').substr(4 - RegExp.$1.length));
}
let o = {
'M+': newTime.getMonth() + 1,
'd+': newTime.getDate(),
'h+': newTime.getHours(),
'm+': newTime.getMinutes(),
's+': newTime.getSeconds()
};
function padLeftZero(str) {
return ('00'+str).substr(str.length);
}
//
for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) {
// console.log(`${k}`)
let str = o[k] + '';
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
}
}
return fmt;
}
},
onPullDownRefresh() {
@ -242,6 +213,47 @@
</script>
<style lang="scss">
.col-status2 {
color: #0BCE5F!important;
}
.col-status3 {
color: #0BCE5F!important;
}
.col-status0 {
color: #FF0000!important;
}
.col-status1 {
color: #FF0000!important;
}
.col-status16 {
color: #1998FE!important;
}
.col-status6 {
color: #555555!important;
}
.col-status7 {
color: #555555!important;
}
.col-btn1 {
color: #0BCE5F!important;
border: 1px solid #0BCE5F!important;
}
.col-btn0 {
color: #FF0000!important;
border: 1px solid #FF0000!important;
}
.col-btn16 {
color: #1998FE!important;
border: 1px solid #1998FE!important;
}
.col-btn6 {
color: #555555!important;
border: 1px solid #555555!important;
}
.col-btn7 {
color: #555555!important;
border: 1px solid #555555!important;
}
page {
background-color: #F6F6F6;
}

67
pages/order/order_details.vue

@ -1,23 +1,23 @@
<template>
<view>
<!-- 商品信息 -->
<block>
<block v-if="isRight(orderDetails)">
<view class="bg-white">
<view class="flex justify-between align-start" style="padding: 32rpx 32rpx 30rpx 32rpx;">
<image src="../../static/logo.png" mode="aspectFill"
<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-line-2 text-black1 lf-font-28 lf-font-bold"
style="height: 88rpx;line-height: 44rpx;">
南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳
{{orderDetails.title}}
</view>
<text class="block lf-color-gray lf-font-28" style="margin-top: 20rpx;line-height: 40rpx;">数量
<text class="margin-left margin-right-xs lf-color-gray">x</text>1</text>
<text class="margin-left margin-right-xs lf-color-gray">x</text>{{orderDetails.num}}</text>
<view class="flex justify-between" style="margin-top: 28rpx;">
<lf-price :price="599" style="margin-top: 8rpx;" />
<lf-price :price="orderDetails.price" style="margin-top: 8rpx;" />
<view>
<!-- <button class="cu-btn1 lf-color-gray lf-border-gray">申请退款</button> -->
<button v-if="orderDetails.status == 2 || orderDetails.status == 3" class="cu-btn1 lf-color-gray lf-border-gray" @tap="$url('/pages/order/apply_refund?order_id='+orderDetails.id)">申请退款</button>
</view>
</view>
</view>
@ -30,17 +30,17 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="lf-color-555 lf-font-28">订单编号</text>
<view>
<text class="margin-right lf-font-28 text-black1">2368492461046128742764</text>
<text class="text-orange lf-font-28" @click="copy(2368492461046128742764)">复制</text>
<text class="margin-right lf-font-28 text-black1">{{orderDetails.order_no}}</text>
<text class="text-orange lf-font-28" @click="copy(orderDetails.order_no)">复制</text>
</view>
</view>
<view class="cu-bar padding-lr solid-bottom">
<text class="lf-color-555 lf-font-28">下单时间</text>
<text class="lf-font-28 text-black1">2021-7-6 22:34:14</text>
<text class="lf-font-28 text-black1">{{ $timer(orderDetails.created_at*1000)}}</text>
</view>
<view class="cu-bar padding-lr solid-bottom">
<text class="lf-color-555 lf-font-28">付款时间</text>
<text class="lf-font-28 text-black1">2021-7-6 22:34:14</text>
<text class="lf-font-28 text-black1">{{orderDetails.paid_at}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">支付方式</text>
@ -83,27 +83,35 @@
</view>
<view style="margin-top: 44rpx;" v-else>
<view class="lf-color-999 lf-font-28">
已使用
{{orderDetails.status_text}}
</view>
</view>
</view>
<view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top1 btn-bottom">
<view class="flex align-center">
<text class="lf-color-555 lf-font-28" style="margin-right: 20rpx;">实付款</text>
<lf-price :price="549" />
<lf-price :price="orderDetails.price" />
</view>
<button class="btn bg-green" @tap="submit">
<button class="btn bg-green" v-if="orderDetails.status == 2 || orderDetails.status == 3">
<text class="lf-font-32 text-white">立即使用</text>
</button>
<!-- <button class="btn bg-blue">
<button class="btn bg-blue" v-if="orderDetails.status == 16">
<text class="lf-font-32 text-white">已使用</text>
</button>
<button class="btn lf-bg-gray">
<button class="btn lf-bg-gray" v-if="orderDetails.status == 6">
<text class="lf-font-32 text-white">等待审核</text>
</button> -->
</button>
<button class="btn lf-bg-gray" v-if="orderDetails.status == 7">
<text class="lf-font-32 text-white">退款成功</text>
</button>
<button class="btn lf-bg-gray" v-if="orderDetails.status == -1">
<text class="lf-font-32 text-white">已取消</text>
</button>
</view>
</view>
</block>
@ -122,14 +130,26 @@
skeletonLoading: true,
loading: false,
order_id: 1,
orderDetails: {},
orderDetails: {
},
checkArea: 'USI782936437829'
}
},
computed: {
total(){
return this.num * this.price
},
isRight(){
return function(val){
return this.$shared.isRight(val);
}
}
},
onLoad(e) {
this.order_id = e.order_id
if (this.order_id) {
// this.getOrderDetails()
this.getOrderDetails()
}
},
methods: {
@ -143,13 +163,12 @@
},
getOrderDetails() {
this.$http(this.API.API_ORDER_DETAILS, {
order_id: this.order_id
id: this.order_id
}).then(res => {
if (res.code == 0) {
this.orderDetails = res.data
this.checkArea = res.data.confirm_code
this.skeletonLoading = false
}
this.orderDetails = res.data
this.checkArea = res.data.order_no
this.skeletonLoading = false
console.log(res.data)
}).catch(err => {
setTimeout(() => {

162
pages/order/refund_detail.vue

@ -1,22 +1,22 @@
<template>
<view>
<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>
<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}}
</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 {{orderDetails.num}}</text>
</view>
<view class="flex align-center text-center lf-m-t-25">
<lf-price :price="599.00" />
<view class="lf-m-l-20 lf-line-through lf-color-gray">
<lf-price :price="orderDetails.price" />
<!-- <view class="lf-m-l-20 lf-line-through lf-color-gray">
599.00
</view>
</view> -->
</view>
</view>
</view>
@ -25,12 +25,12 @@
<view class="bg-white padding-lr">
<view class="cu-bar lf-border-bottom">
<text class="lf-color-555 lf-font-28">可退金额</text>
<text class="text-price lf-font-36 lf-color-price">549.00</text>
<text class="text-price lf-font-36 lf-color-price">{{orderDetails.price}}</text>
</view>
<view class="cu-bar flex justify-between align-center text-center">
<text class="lf-color-555 lf-font-28">订单编号</text>
<view>
<text class="lf-font-28 text-black1">2368492461046128742764</text>
<text class="lf-font-28 text-black1">{{orderDetails.order_no}}</text>
<!-- <text class="text-orange lf-font-28" @click="copy(2368492461046128742764)">复制</text> -->
</view>
</view>
@ -57,7 +57,7 @@
<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="orderDetails.price" />
</view>
<button class="btn" @tap="submit">
@ -73,117 +73,31 @@
data() {
return {
hostImg: '',
orderDetails: {},
img_list: [{path: 'https://t7.baidu.com/it/u=2168645659,3174029352&fm=193&f=GIF'}], //
order_id: 1
}
},
computed: {
isRight(){
return function(val){
return this.$shared.isRight(val);
}
}
},
methods: {
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);
}
})
},
//
ChooseImage(e) {
let that = this;
uni.chooseImage({
count: 1,
sizeType: ['original'], // originalcompressed
sourceType: ['album', 'camera'], // album camera 使
success: res => {
that.hostImg = res.tempFilePaths[0];
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'
})
}
});
}
});
},
getOrderDetails() {
this.$http(this.API.API_ORDER_DETAILS, {
id: this.order_id
}).then(res => {
this.orderDetails = res.data
console.log(res.data)
//
upload(url){
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);
}
}
if(uploads.length == 0) {
that.realSubmitInfo([]);
return
}
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'
})
})
setTimeout(() => {
this.$toBack()
}, 1000)
});
},
//
showImg(index) {
@ -196,25 +110,19 @@
})
}, 200);
},
//
DelImg(index) {
uni.showModal({
title: '提示',
content: '即将取消上传这张图片,请确认?',
success: e => {
if (!e.confirm) return;
this.img_list.splice(index, 1);
}
});
},
//
copy(text) {
uni.setClipboardData({
data: text
});
},
}
},
onLoad(e) {
this.order_id = e.order_id
if (this.order_id) {
this.getOrderDetails()
}
},
}
</script>

45
pages/order/unpay_details.vue

@ -1,21 +1,21 @@
<template>
<view>
<!-- 商品信息 -->
<block>
<block v-if="isRight(orderDetails)">
<view class="bg-white">
<view class="flex justify-between align-start" style="padding: 32rpx 32rpx 30rpx 32rpx;">
<image src="../../static/logo.png" mode="aspectFill"
<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-line-2 text-black1 lf-font-28 lf-font-bold"
style="height: 88rpx;line-height: 44rpx;">
南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳
{{orderDetails.title}}
</view>
<text class="block lf-color-gray lf-font-28" style="margin-top: 20rpx;line-height: 40rpx;">数量
<text class="margin-left margin-right-xs lf-color-gray">x</text>1</text>
<text class="margin-left margin-right-xs lf-color-gray">x</text>{{orderDetails.num}}</text>
<view class="flex justify-between" style="margin-top: 28rpx;">
<lf-price :price="599" style="margin-top: 8rpx;" />
<lf-price :price="orderDetails.price" style="margin-top: 8rpx;" />
<view>
<!-- <button class="cu-btn1 lf-color-gray lf-border-gray">申请退款</button> -->
</view>
@ -30,13 +30,13 @@
<view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
<text class="lf-color-555 lf-font-28">订单编号</text>
<view>
<text class="margin-right lf-font-28 text-black1">2368492461046128742764</text>
<text class="text-orange lf-font-28" @click="copy(2368492461046128742764)">复制</text>
<text class="margin-right lf-font-28 text-black1">{{orderDetails.order_no}}</text>
<text class="text-orange lf-font-28" @click="copy(orderDetails.order_no)">复制</text>
</view>
</view>
<view class="cu-bar padding-lr solid-bottom">
<text class="lf-color-555 lf-font-28">下单时间</text>
<text class="lf-font-28 text-black1">2021-7-6 22:34:14</text>
<text class="lf-font-28 text-black1">{{$timer(orderDetails.created_at*1000)}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">支付方式</text>
@ -57,13 +57,14 @@
<view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top1 btn-bottom">
<view class="flex align-center">
<text class="lf-color-555 lf-font-28" style="margin-right: 20rpx;">待付款</text>
<lf-price :price="549" />
<lf-price :price="orderDetails.price" />
</view>
<button class="btn lf-bg-red" @tap="submit">
<text class="lf-font-32 text-white">立即使用</text>
<button class="btn bg-red" @tap="submit" v-if="orderDetails.status == 1">
<text class="lf-font-32 text-white">支付尾款</text>
</button>
</view>
</view>
</block>
@ -79,26 +80,28 @@
loading: false,
order_id: 1,
orderDetails: {},
checkArea: 'USI782936437829'
}
},
onLoad(e) {
this.order_id = e.order_id
if (this.order_id) {
// this.getOrderDetails()
this.getOrderDetails()
}
},
computed: {
isRight(){
return function(val){
return this.$shared.isRight(val);
}
}
},
methods: {
getOrderDetails() {
this.$http(this.API.API_ORDER_DETAILS, {
order_id: this.order_id
id: this.order_id
}).then(res => {
if (res.code == 0) {
this.orderDetails = res.data
this.checkArea = res.data.confirm_code
this.skeletonLoading = false
}
this.orderDetails = res.data
console.log(this.orderDetails)
}).catch(err => {
setTimeout(() => {
this.$toBack()
@ -121,7 +124,7 @@
padding: 0;
width: 212rpx;
height: 82rpx;
background-color: #1998FE;
background-color: #FF0000;
color: #FFFFFF;
line-height: 80rpx;
font-size: 32rpx;

47
pages/user/user.vue

@ -2,12 +2,12 @@
<view>
<view class="flex-direction justify-between align-center text-center lf-p-t-30 lf-p-b-30" style="height: 340rpx;position: relative;">
<view>
<image src="../../static/logo.png" mode="aspectFill" style="width: 200rpx;height: 200rpx;border-radius: 50%;border: 2rpx solid #FFFFFF;" @click="lookImg('')"></image>
<image :src="userInfo.avatar" mode="aspectFill" style="width: 200rpx;height: 200rpx;border-radius: 50%;border: 2rpx solid #FFFFFF;" @click="lookImg('')"></image>
</view>
<view class="lf-font-36 align-center text-center text-white lf-m-t-30">
小小的小可爱
{{userInfo.nickname}}
</view>
<image class="bg-img" src="https://picsum.photos/seed/picsum/375/340"></image>
<image class="bg-img" :src="userInfo.avatar" mode="aspectFill" style="filter: blur(4px);"></image>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/order/order')">
@ -101,10 +101,48 @@
loading_text: '已加载全部数据~',
list: [],
page: 1,
isPage: false
isPage: false,
showLogin: true,
userInfo: {
avatar: '',
nickname:'',
id: ''
}
}
},
computed: {
hidePhone(){
return function(tel){
if(tel.length == 11){
var reg = /^(\d{3})\d{4}(\d{4})$/;
var new_phone = tel.replace(reg, "$1****$2");
return new_phone;
}else{
return tel;
}
}
},
isRight(){
return function(val){
return this.$shared.isRight(val);
}
}
},
methods: {
//
verifyUserInfo(){
let userInfo = uni.getStorageSync('userinfo') || {};
this.userInfo = uni.getStorageSync('userinfo') || {}
if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
if(this.showLogin){
this.showLogin = false;
this.$url('/pages/login/index?type=userinfo');
}else{
this.showLogin = true;
this.$url('/pages/index/index', {type: 'switch'});
}
}
},
getRecommond() {
this.$http(this.API.API_RECOMMOND,{page: this.page}).then(res => {
let isPage = res.data.next_page_url == null?false:true;
@ -140,6 +178,7 @@
}
},
onLoad() {
this.verifyUserInfo()
this.getRecommond()
}
}

Loading…
Cancel
Save