diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..922878f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,11 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "ydui-district": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/ydui-district/-/ydui-district-1.1.0.tgz", + "integrity": "sha512-MBhvfaR5Gkn6MUmEnrH1A7IFB5igALuDgtIF+gz3dRwNwW9+KOmih7z+xZFfGluMsEbWaT7C3lWOckYsLZQnFg==" + } + } +} diff --git a/pages.json b/pages.json index 8c1d3a5..bc24705 100644 --- a/pages.json +++ b/pages.json @@ -10,7 +10,8 @@ { "path": "pages/user/user", "style": { - "navigationBarTitleText": "uni-app" + "navigationBarTitleText": "我的", + "navigationStyle": "custom" } }, { @@ -90,6 +91,66 @@ "style" : { "navigationBarTitleText" : "填写订单" } + }, + { + "path" : "user/profile", + "style" : { + "navigationBarTitleText" : "个人信息" + } + }, + { + "path": "user/changeNickname", + "style": { + "navigationBarTitleText": "修改姓名" + } + }, + { + "path": "user/logout", + "style": { + "navigationBarTitleText": "注销账号" + } + }, + { + "path": "user/coupon", + "style": { + "navigationBarTitleText": "优惠券" + } + }, + { + "path": "order/orderCoupon", + "style": { + "navigationBarTitleText": "选择优惠券" + } + }, + { + "path": "user/travelerList", + "style": { + "navigationBarTitleText": "常用信息" + } + }, + { + "path": "user/myContactsAdd", + "style": { + "navigationBarTitleText": "联系人信息" + } + }, + { + "path": "user/myAddressAdd", + "style": { + "navigationBarTitleText": "收货地址" + } + }, + { + "path": "user/privacyInfo", + "style": { + "navigationBarTitleText": "详情" + } + }, + { + "path": "order/trades", + "style": { + "navigationBarTitleText": "全部订单" + } } ] }], diff --git a/pages/coupon/coupon.vue b/pages/coupon/coupon.vue index fc451ca..6d85020 100644 --- a/pages/coupon/coupon.vue +++ b/pages/coupon/coupon.vue @@ -1,5 +1,15 @@ @@ -12,20 +22,77 @@ }, data() { return { - + headImg: '', + list: [] } }, - onLoad() { - + mounted() { + // 头图 + this.getHeadImg(2370).then(res => {this.headImg = res}) + this.getList() }, methods: { - + getList() { + this.Post({ + limit: 100, + page: 1, + class_id: 143, + type: 2, + }, '/api/multimedia/media_list').then(res => { + if (res) { + this.list = res.data.data + } + }) + } } } - + \ No newline at end of file diff --git a/pages/user/user.vue b/pages/user/user.vue index 28110be..8ff162f 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -1,5 +1,86 @@ @@ -12,23 +93,585 @@ }, data() { return { - + dfkList: [], + differTimeList: [], + nowDateTime: '', //当前时间秒数 + userInfo: {}, + orderList: [{ + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dfki.png', + title: '待付款', + status: 'WAIT_PAYMENT' + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dfh.png', + title: '待发货', + status: 'WAIT_POST' + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dsy.png', + title: '待使用', + status: '' + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dcx.png', + title: '待出行', + status: 'WAIT_USE' + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dsh.png', + title: '待收货', + status: 'WAIT_DELIVERY' + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/tksh.png', + title: '退款/售后', + status: 'NEED_REFUND' + }, + ], + cyList: [ + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/yhq.png', + title: '优惠券', + path: '/subPackages/user/coupon', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/cxr.png', + title: '出行人', + path: '/subPackages/user/travelerList?showType=0', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/lxwm.png', + title: '联系客服', + path: '', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/shdz.png', + title: '收货地址', + path: '/subPackages/user/travelerList?showType=1', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/shhx.png', + title: '商户核销', + path: '', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/yhxy.png', + title: '用户协议', + path: '/subPackages/user/privacyInfo?id=9', + isShow: true + }, + { + src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/yszc.png', + title: '隐私管理', + path: '/subPackages/user/privacyInfo?id=12', + isShow: true + } + ], } }, - onLoad() { + onShow() { + // 根据token获取个人信息 + this.Post({ + token: '' + },'/api/uservice/user/getMyInfo').then(res => { + this.$store.commit('changeUserInfo', res.data); + }) + + this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} + console.log(this.userInfo) + uni.setStorageSync('isFlag', true) + // this.dfkList = [] + // this.nowDateTime = parseInt(new Date().getTime() / 1000) + // this.Post({}, "/api/user/userInfo").then((res) => { + // if (res.data) { + // this.userInfo = res.data; + // // this.getDfk() + // // 是否展示商户核销 + // this.Post({},'/api/merchants/is_merchant').then(res => { + // this.cyList[6].isShow = res.data + // }) + // } + // }); + }, + // 导航栏点击事件 + onTabItemTap() { + this.qdTracker('navButtonClick', {buttonName: '我的', buttonSort: '3'}) }, methods: { + // 个人信息或登录 + gotoProfile() { + // 有token去个人信息,没有去登录 + if(this.userInfo.token) { + uni.navigateTo({ + url: '/subPackages/user/profile' + }) + }else { + uni.navigateTo({ + url: '/pages/login/login' + }) + } + }, + timeup(index) { + // return this.dfkList.splice(index,1) + }, + setOrderId(id) { + let that = this; + that.orderId = id; + that.Post({ + order_id: id, + type: "miniprogram", + platform: 'miniprogram' + }, + '/api/pay/unify' + ).then(res => { + if (res.data) { + uni.requestPayment({ + nonceStr: res.data.nonceStr, + package: res.data.package, + paySign: res.data.paySign, + signType: res.data.signType, + timeStamp: res.data.timeStamp + }); + } + }); + }, + // 待付款 + getDfk() { + this.differTimeList = [] + let params = { + offset: this.dfkList.length, + limit: 10, + status: 'WAIT_PAYMENT', + } + this.Post(params, '/api/order/orderList').then(res => { + this.isLoading = false + if (res) { + this.dfkList = [...this.dfkList, ...res.data] + this.dfkList.forEach(item => { + // 获取时间差,订单关闭时间-当前时间,若存在即展示倒计时differTimeList + let del; + if (moment(item.close_time).diff(moment()) > 0) { + del = moment.utc(moment(item.close_time).diff(moment())).format('HH:mm:ss') + } else { + del = '00:00:00' + } + this.differTimeList.push(del) + }) + console.log(this.differTimeList); + console.log('this.differTimeList:' + this.differTimeList[0].slice(0, 2)) + } + }) + }, + goToOrderDetail(item) { + uni.navigateTo({ + url: '/subPackages/order/detail?id=' + item.order_id + }); + }, + getChild(list) { + let arr = [] + for (let i = 0; i < list.length; i++) { + if (list[i].product_model == "ticket") { + console.log(list[i]); + arr.push(list[i]) + break + } + } + console.log(arr); + if (arr.length > 0) { + return arr[0] + } else { + return list[0] + } + }, + goCoupon() { + uni.navigateTo({ + url: "/subPackages/user/coupon", + }); + }, + goKeFu() { + uni.navigateTo({ + url: "/subPackages/publicservices/ServiceOnline", + }); + }, + // open(){ + // this.$refs.popup.open('center') + // }, + gotoUrl(path, index) { + if (index == 2) { + // this.$refs.popup.open() + return; + } + uni.navigateTo({ + url: path + }) + }, + qidai() { + uni.showToast({ + title: '功能建设中...', + icon: 'none' + }) + }, + goTrades(item) { + if (item) { + uni.navigateTo({ + url: "/subPackages/order/trades?type=" + item.title, + }); + } else { + uni.navigateTo({ + url: "/subPackages/order/trades", + }); + } + }, + //判断是否关注公众号 + isGz(item) { + this.$refs.pop.openPop( + 'https://yjks.oss-cn-shanghai.aliyuncs.com/uploads/20230517/db9eb60e0abfea8be1075b406fefe551.jpg'); + // this.Post({}, '/api/wechat/getSubcribeInfo').then(res => { + // if (res.data) { + // uni.navigateTo({ + // url:'/subPackages/webPage/webPage?url='+'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzU2NjQwNTYxNg==#wechat_redirect' + // }) + // } else { + // console.log(this.$refs.pop); + // } + // }); + }, } } - + \ No newline at end of file diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index f02e1d5..dd27cf0 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -91,7 +91,7 @@ Vue.prototype.showImg = img => { return img; } else { // return Vue.prototype.NEWAPIURL + img; - return 'https://swsz.api.js-dyyj.com'+img; + return 'https://static.ticket.sz-trip.com'+img; } } diff --git a/static/js/mmmm-image-tools/index.js b/static/js/mmmm-image-tools/index.js new file mode 100644 index 0000000..acf40bc --- /dev/null +++ b/static/js/mmmm-image-tools/index.js @@ -0,0 +1,196 @@ +function getLocalFilePath(path) { + if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) { + return path + } + if (path.indexOf('file://') === 0) { + return path + } + if (path.indexOf('/storage/emulated/0/') === 0) { + return path + } + if (path.indexOf('/') === 0) { + var localFilePath = plus.io.convertAbsoluteFileSystem(path) + if (localFilePath !== path) { + return localFilePath + } else { + path = path.substr(1) + } + } + return '_www/' + path +} + +function dataUrlToBase64(str) { + var array = str.split(',') + return array[array.length - 1] +} + +var index = 0 +function getNewFileId() { + return Date.now() + String(index++) +} + +function biggerThan(v1, v2) { + var v1Array = v1.split('.') + var v2Array = v2.split('.') + var update = false + for (var index = 0; index < v2Array.length; index++) { + var diff = v1Array[index] - v2Array[index] + if (diff !== 0) { + update = diff > 0 + break + } + } + return update +} + +export function pathToBase64(path) { + return new Promise(function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + if (typeof FileReader === 'function') { + var xhr = new XMLHttpRequest() + xhr.open('GET', path, true) + xhr.responseType = 'blob' + xhr.onload = function() { + if (this.status === 200) { + let fileReader = new FileReader() + fileReader.onload = function(e) { + resolve(e.target.result) + } + fileReader.onerror = reject + fileReader.readAsDataURL(this.response) + } + } + xhr.onerror = reject + xhr.send() + return + } + var canvas = document.createElement('canvas') + var c2x = canvas.getContext('2d') + var img = new Image + img.onload = function() { + canvas.width = img.width + canvas.height = img.height + c2x.drawImage(img, 0, 0) + resolve(canvas.toDataURL()) + canvas.height = canvas.width = 0 + } + img.onerror = reject + img.src = path + return + } + if (typeof plus === 'object') { + plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) { + entry.file(function(file) { + var fileReader = new plus.io.FileReader() + fileReader.onload = function(data) { + resolve(data.target.result) + } + fileReader.onerror = function(error) { + reject(error) + } + fileReader.readAsDataURL(file) + }, function(error) { + reject(error) + }) + }, function(error) { + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + wx.getFileSystemManager().readFile({ + filePath: path, + encoding: 'base64', + success: function(res) { + resolve('data:image/png;base64,' + res.data) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} + +export function base64ToPath(base64) { + return new Promise(function(resolve, reject) { + if (typeof window === 'object' && 'document' in window) { + base64 = base64.split(',') + var type = base64[0].match(/:(.*?);/)[1] + var str = atob(base64[1]) + var n = str.length + var array = new Uint8Array(n) + while (n--) { + array[n] = str.charCodeAt(n) + } + return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type }))) + } + var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/) + if (extName) { + extName = extName[1] + } else { + reject(new Error('base64 error')) + } + var fileName = getNewFileId() + '.' + extName + if (typeof plus === 'object') { + var basePath = '_doc' + var dirPath = 'uniapp_temp' + var filePath = basePath + '/' + dirPath + '/' + fileName + if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) { + plus.io.resolveLocalFileSystemURL(basePath, function(entry) { + entry.getDirectory(dirPath, { + create: true, + exclusive: false, + }, function(entry) { + entry.getFile(fileName, { + create: true, + exclusive: false, + }, function(entry) { + entry.createWriter(function(writer) { + writer.onwrite = function() { + resolve(filePath) + } + writer.onerror = reject + writer.seek(0) + writer.writeAsBinary(dataUrlToBase64(base64)) + }, reject) + }, reject) + }, reject) + }, reject) + return + } + var bitmap = new plus.nativeObj.Bitmap(fileName) + bitmap.loadBase64Data(base64, function() { + bitmap.save(filePath, {}, function() { + bitmap.clear() + resolve(filePath) + }, function(error) { + bitmap.clear() + reject(error) + }) + }, function(error) { + bitmap.clear() + reject(error) + }) + return + } + if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) { + var filePath = wx.env.USER_DATA_PATH + '/' + fileName + wx.getFileSystemManager().writeFile({ + filePath: filePath, + data: dataUrlToBase64(base64), + encoding: 'base64', + success: function() { + resolve(filePath) + }, + fail: function(error) { + reject(error) + } + }) + return + } + reject(new Error('not support')) + }) +} \ No newline at end of file diff --git a/static/js/mmmm-image-tools/package.json b/static/js/mmmm-image-tools/package.json new file mode 100644 index 0000000..e8b9c0a --- /dev/null +++ b/static/js/mmmm-image-tools/package.json @@ -0,0 +1,11 @@ +{ + "id": "mmmm-image-tools", + "name": "image-tools", + "version": "1.4.0", + "description": "图像转换工具,可用于图像和base64的转换", + "keywords": [ + "base64", + "保存", + "图像" + ] +} \ No newline at end of file diff --git a/subPackages/line/orders.vue b/subPackages/line/orders.vue index e26510f..feb5223 100644 --- a/subPackages/line/orders.vue +++ b/subPackages/line/orders.vue @@ -46,7 +46,7 @@ 优惠券 选择优惠券 - + -¥{{coupon.CouponActivity.discounts/100}} @@ -694,14 +694,14 @@ .order-all-text { flex: 1; font-size: 36rpx; - color: #C3282E; + color: #6A8A2D; font-weight: bold; } } .order-btn { width: 293rpx; - background: #C3282E; + background: #6A8A2D; border-radius: 43rpx; text-align: center; line-height: 87rpx; @@ -779,7 +779,7 @@ .add-btn { width: 153rpx; line-height: 40rpx; - background: #C3282E; + background: #6A8A2D; border-radius: 9rpx; text-align: center; font-weight: 500; diff --git a/subPackages/order/orderCoupon.vue b/subPackages/order/orderCoupon.vue new file mode 100644 index 0000000..60e2a95 --- /dev/null +++ b/subPackages/order/orderCoupon.vue @@ -0,0 +1,424 @@ + + + + + diff --git a/subPackages/order/trades.vue b/subPackages/order/trades.vue new file mode 100644 index 0000000..df00b45 --- /dev/null +++ b/subPackages/order/trades.vue @@ -0,0 +1,678 @@ + + + + + \ No newline at end of file diff --git a/subPackages/ticket/order.vue b/subPackages/ticket/order.vue index 4901c40..9dd0a5e 100644 --- a/subPackages/ticket/order.vue +++ b/subPackages/ticket/order.vue @@ -969,17 +969,17 @@ margin-left: 15rpx; font-size: 48rpx; font-weight: bold; - color: #C3282E; + color: #6A8A2D; &:before { content: '¥'; display: inline-block; - color: #C3282E; + color: #6A8A2D; font-size: 24rpx; } } .post-text { margin-left: 15rpx; - color: #C3282E; + color: #6A8A2D; font-size: 24rpx; } } diff --git a/subPackages/user/changeNickname.vue b/subPackages/user/changeNickname.vue new file mode 100644 index 0000000..4af7165 --- /dev/null +++ b/subPackages/user/changeNickname.vue @@ -0,0 +1,89 @@ + + + + + \ No newline at end of file diff --git a/subPackages/user/coupon.vue b/subPackages/user/coupon.vue new file mode 100644 index 0000000..b2f34e8 --- /dev/null +++ b/subPackages/user/coupon.vue @@ -0,0 +1,494 @@ + + + + + diff --git a/subPackages/user/logout.vue b/subPackages/user/logout.vue new file mode 100644 index 0000000..13b324b --- /dev/null +++ b/subPackages/user/logout.vue @@ -0,0 +1,168 @@ + + + + + \ No newline at end of file diff --git a/subPackages/user/myAddressAdd.vue b/subPackages/user/myAddressAdd.vue new file mode 100644 index 0000000..ce569a7 --- /dev/null +++ b/subPackages/user/myAddressAdd.vue @@ -0,0 +1,417 @@ + + + + + diff --git a/subPackages/user/myContactsAdd.vue b/subPackages/user/myContactsAdd.vue new file mode 100644 index 0000000..a74c869 --- /dev/null +++ b/subPackages/user/myContactsAdd.vue @@ -0,0 +1,272 @@ + + + + + diff --git a/subPackages/user/privacyInfo.vue b/subPackages/user/privacyInfo.vue new file mode 100644 index 0000000..bcfd98e --- /dev/null +++ b/subPackages/user/privacyInfo.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/subPackages/user/profile.vue b/subPackages/user/profile.vue new file mode 100644 index 0000000..5bf32c8 --- /dev/null +++ b/subPackages/user/profile.vue @@ -0,0 +1,408 @@ + + + + + diff --git a/subPackages/user/travelerList.vue b/subPackages/user/travelerList.vue new file mode 100644 index 0000000..f22e066 --- /dev/null +++ b/subPackages/user/travelerList.vue @@ -0,0 +1,357 @@ + + + + + diff --git a/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue b/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue index ce7c534..cf52ff3 100644 --- a/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue +++ b/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue @@ -152,7 +152,7 @@ .uni-calendar-item--isDay-text { // color: $uni-primary; - color: #C3282E; + color: #6A8A2D; } .uni-calendar-item--isDay {