diff --git a/common/api.js b/common/api.js
index 4a61a53..322eafb 100644
--- a/common/api.js
+++ b/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'//退款申请图片上传
//系统
diff --git a/common/mixin.js b/common/mixin.js
index e48c468..99cef88 100644
--- a/common/mixin.js
+++ b/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;
+ },
+
}
}
\ No newline at end of file
diff --git a/common/uploadFile.js b/common/uploadFile.js
new file mode 100644
index 0000000..69c50bf
--- /dev/null
+++ b/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
+};
\ No newline at end of file
diff --git a/main.js b/main.js
index 6c139c5..fe46c6f 100644
--- a/main.js
+++ b/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);
diff --git a/pages.json b/pages.json
index b7af771..e298fa4 100644
--- a/pages.json
+++ b/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": {
diff --git a/pages/about/buy_agree.vue b/pages/about/buy_agree.vue
new file mode 100644
index 0000000..9f9a8fa
--- /dev/null
+++ b/pages/about/buy_agree.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/about/register_agree.vue b/pages/about/register_agree.vue
new file mode 100644
index 0000000..fbd3265
--- /dev/null
+++ b/pages/about/register_agree.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/collect/index.vue b/pages/collect/index.vue
index dac5d56..fea6d94 100644
--- a/pages/collect/index.vue
+++ b/pages/collect/index.vue
@@ -5,7 +5,7 @@
{{ item.product.title }}
- {{ timer(item.created_at*1000) || '' }}
+ {{ $timer(item.created_at*1000) || '' }}
@@ -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){
diff --git a/pages/goodsDetail/index.vue b/pages/goodsDetail/index.vue
index bbb495c..1ddde8d 100644
--- a/pages/goodsDetail/index.vue
+++ b/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);
})
},
// 拨打电话
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 1c8fb21..003eefd 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -12,7 +12,7 @@
{{item.title}}
- 详情
+ 详情
diff --git a/pages/login/index.vue b/pages/login/index.vue
index e6ddb9b..079f53f 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -23,15 +23,15 @@
-
+
请认真阅读并同意
- 《{{ agreement.title }}》
+ 《用户协议》
,在小程序下单购买即表示您已默认同意
- 《{{ agreement.title }}》
+ 《用户协议》
的所有条款。
@@ -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 // 已在公共参数传
diff --git a/pages/message/index.vue b/pages/message/index.vue
index db2c990..139d957 100644
--- a/pages/message/index.vue
+++ b/pages/message/index.vue
@@ -7,7 +7,7 @@
收到一条新消息
- {{timer(item.created_at*1000) || ''}}
+ {{$timer(item.created_at*1000) || ''}}
{{item.title}}
@@ -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)
},
diff --git a/pages/notice/notice.vue b/pages/notice/notice.vue
index 8186775..174ab79 100644
--- a/pages/notice/notice.vue
+++ b/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;
})
}
diff --git a/pages/order/apply_refund.vue b/pages/order/apply_refund.vue
index 0d1aa15..7db712c 100644
--- a/pages/order/apply_refund.vue
+++ b/pages/order/apply_refund.vue
@@ -1,22 +1,22 @@
-
+
-
+
- 南澳站·潮玩旅游胜地 身处亚热带风情/玩转南澳
+ {{orderDetails.title}}
数量
- x 1
+ x {{orderDetails.num}}
-
-
- 599.00
-
+
+
@@ -25,12 +25,12 @@
可退金额
- 549.00
+ {{orderDetails.price}}
订单编号
- 2368492461046128742764
+ {{orderDetails.order_no}}
@@ -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) => {
// 过滤不是图片不是png、jpeg 格式
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(() => {
diff --git a/pages/order/order.vue b/pages/order/order.vue
index b974fa5..cef561f 100644
--- a/pages/order/order.vue
+++ b/pages/order/order.vue
@@ -22,21 +22,22 @@
-
-
-
-
-
+
+
+
+
+
+
- {{timer(item.created_at*1000)}}
+ {{$timer(item.created_at*1000)}}
-
- 请在10分钟内付款
+
+ {{item.status_text}}
@@ -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 @@