作者 王旭宇

201908011801

正在显示 43 个修改的文件 包含 1193 行增加131 行删除
... ... @@ -67,7 +67,8 @@
"pages/my/invoiceList/invoiceList",
"pages/vip/detail_vip/detail_vip",
"pages/index/goodsDetials/goodsDetials",
"pages/navigate/navigate"
"pages/navigate/navigate",
"pages/index/user_comment_detail/user_comment_detail"
],
"window": {
"backgroundTextStyle": "dark",
... ...
... ... @@ -12,9 +12,9 @@
<view class='right' catchtap='get_return'>再逛逛
<icon class='iconfont icon-icondayu'></icon>
</view>
</view>
</view>
<!-- 商品列表 -->
<view>
<view class='da'>
<view class='product_list' wx:if='{{goodsList.length>0||promotion.length>0}}'>
<view class='singlepart' wx:for='{{goodsList}}' wx:for-item='cell' wx:for-index='cellindex' wx:key='{{cellindex}}'>
<view class='single_part_top'>
... ... @@ -85,7 +85,10 @@
</view>
</view>
</view>
<view wx:else class='gogogo'>请先去选择商品</view>
<view wx:if='{{goodsList.length==0&&promotion.length==0}}' class='gogogo'>
<image src='../imgs/noCart.png'></image>
<view>您暂时没有消息哦~</view>
</view>
</view>
... ...
... ... @@ -3,20 +3,49 @@ page{
background: #FFF;
display: flex;
flex-flow: column;
width: 100%;
height: 100%;
}
.page{
width: 100%;
height: 100%;
overflow-x: hidden;
min-height: 100%;
}
.da{
width: 100%;
height: calc(100% - 135rpx);
}
.gogogo{
width: 100%;
height: 100%;
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin:auto;
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-10%);
top: 50%
}
.cart_box{
height: calc(100% - 100rpx);
flex: 1;
display: flex;
flex-flow: column;
... ...
... ... @@ -355,7 +355,6 @@ Page({
gPrice: zuihoujiage,
collocation: r.data.collocation,
comment: r.data.comment,
// star_arr: star_arr,
skuid: skuid,
is_group: r.data.info.group_min_number,
id_arr: arr,
... ... @@ -370,7 +369,6 @@ Page({
gPrice: zuihoujiage,
collocation: r.data.collocation,
comment: r.data.comment,
// star_arr: star_arr,
favorite: r.data.is_favorite,
skuid_price: skuid_price,
old_skuid_price: old_skuid_price,
... ...
... ... @@ -165,10 +165,10 @@
</view>
</view>
</view>
<!-- <view class='comments_btn'>
<view class='comments_btn'>
<view class='iconfont icon-message'></view>
<view class='comments'>评论</view>
</view> -->
</view>
</view>
</view>
<view id='NAV{{two}}'></view>
... ...
... ... @@ -230,20 +230,6 @@ Page({
show_cart_mask: false
});
},
//渲染消息
fetchNotice() {
var that = this;
var url = '/portal/index/getUserMessage'
app.post(url).then(r => {
var count = r.data.activeList.length + r.data.noticeList.length;
if (r.data.activeList != [] || r.data.noticeList != []) {
that.setData({
showNotice: true,
noticeCount: count
});
}
});
},
//渲染商品列表
fetchGoodsData() {
let id = this.data.goods_id;
... ... @@ -582,11 +568,13 @@ Page({
let sku_values=''
app.post(url).then(r => {
for (let i = 0; i < r.data.screen.length; i++) {
for (let x = 0; x < r.data.screen[i].item.length; x++) {
r.data.screen[i].item[x].t = false;
}
// r.data.screen[i].item[0].t = true
sku_values += r.data.screen[i].item[0].attribute_value
if (r.data.screen[i].item.length>0){
for (let x = 0; x < r.data.screen[i].item.length; x++) {
r.data.screen[i].item[x].t = false;
}
// r.data.screen[i].item[0].t = true
sku_values += r.data.screen[i].item[0].attribute_value
}
}
var percent = 0
... ... @@ -909,7 +897,6 @@ Page({
this.getaddress();
// this.category();
this.fetchGoodsData();
this.fetchNotice();
var sysInfo = wx.getSystemInfoSync();
var winHeight = sysInfo.windowHeight;
var winWidth = sysInfo.windowWidth;
... ... @@ -928,6 +915,7 @@ Page({
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
success: function(res) {
console.log(res)
var latitude = res.latitude
var longitude = res.longitude
qqmapsdk.reverseGeocoder({
... ... @@ -936,6 +924,7 @@ Page({
longitude: longitude
},
success: function(res) {
console.log(res)
var ctiy = res.result.address_component.district
that.setData({
city: ctiy
... ...
... ... @@ -38,15 +38,10 @@
<image src='{{item.image}}' class="slide-image {{currentIndex == 0 ? 'active': ''}} uiuiui"></image>
</swiper-item>
</block>
<block wx:for='{{special}}' wx:key='{{item.id}}'>
<swiper-item bindtap='jump_special_list' data-specialid='{{item.id}}' >
<image src='{{item.image}}' class="slide-image {{currentIndex == 0 ? 'active': ''}} uiuiui"></image>
</swiper-item>
</block>
</swiper>
<view class='safe_box'>
<view bindtap='go_mind_detect'>
<text class='iconfont icon-jiance'></text>
<image src='../imgs/anxin.png' class='anxin'></image>
<text>安心检测</text>
</view>
<view bindtap='go_selectSource'>
... ... @@ -174,7 +169,7 @@
<view wx:else>
<text wx:if='{{item.group_status==1}}'>开始\t\t\t</text>
<text wx:elif='{{item.group_status==2}}' style='margin-left:-4rpx;'>结束</text> {{item.days}}:{{item.hours}}:{{item.minutes}}:{{item.seconds}}
<text wx:elif='{{item.group_status==2}}' style='margin-left:-4rpx;'>结束</text> {{item.days}}天{{item.hours}}时{{item.minutes}}分
</view>
</view>
</view>
... ... @@ -269,10 +264,10 @@
<view>
<progress show-info border-radius='4' activeColor='#ffda44' stroke-width='8' percent='{{item.percent}}' font-size='12'></progress>
<progress show-info border-radius='4' activeColor='#ffda44' stroke-width='8' percent='{{item.group_number * 100/item.group_min_number}}' font-size='12'></progress>
<text class='group_font'>已拼{{item.group_number}}份\t\t\t\t目标{{item.group_min_number}}份</text>
<view class='good_vipbox good_vipboxs'>
<view class='good_vipbox_left'>
<view class='good_vipbox_left'>
<view class='price_big_boxa'>
<text class='money_icon2b'>¥</text>
... ...
... ... @@ -8,7 +8,6 @@ page {
background-color: #fafafa;
width: 100%;
height: 100%;
overflow-x: hidden;
}
.big_page{
min-height: 100%
... ... @@ -17,6 +16,7 @@ page {
width: 100%;
height: 100%;
position: relative;
overflow-x: hidden;
}
.top_fixed {
... ... @@ -197,7 +197,7 @@ page {
height: 54rpx;
background: rgba(247, 247, 247, 1);
border-radius: 10rpx;
color: #888;
color: #222;
line-height: 54rpx;
text-align: center;
}
... ... @@ -554,14 +554,18 @@ page {
color: #888;
text-decoration: line-through;
}
.anxin{
width: 20rpx;
height: 31rpx;
margin-right: 10rpx
}
.ad_box {
height: 100%;
position: fixed;
width: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.6);
background-color: rgba(51,51,51,0.6);
z-index: 9999;
display: flex;
align-items: center;
... ... @@ -1918,4 +1922,4 @@ color:rgba(18,25,27,1);
width: 20rpx;
height: 2rpx;
background: red
}
}
\ No newline at end of file
... ...
... ... @@ -13,12 +13,22 @@ Page({
get_my(){
wx.navigateBack({})
},
//进入评价详情
jump_comment_detail(e){
wx.navigateTo({
url: '../user_comment_detail/user_comment_detail?id='+e.currentTarget.dataset.id,
})
},
//获取评论列表
fetchCommentList(){
let url ='/wxapp/product/comment?id='+this.data.gid
app.post(url).then(r=>{
console.log(r)
r.data.forEach(function(ele,index){
ele.stars_arr = []
for (let i = 1; i < ele.goods_stars + 1; i++) {
ele.stars_arr.push(i);
}
ele.create_time = app.timeFormate(ele.create_time, 'YYMMDDHHMM');
})
this.setData({
... ...
... ... @@ -9,13 +9,21 @@
<view class='the_star'>
<view class='head_portrait'>
<image src='{{item.avatar}}'></image>
</view>
</view>
<view class='star_box'>
<view class='user_name'>{{item.full_name}}</view>
<view class='stars1'>
<view class='iconfont icon-pingfen' wx:for='{{star_arr}}' wx:key='{{item}}'></view>
</view>
<view class='oneoneonestar'>
<view class='stars1'>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
</view>
<view class='stars1s'>
<view class='iconfont icon-pingfen icon-pingfens' wx:for='{{item.stars_arr}}' wx:key='{{item}}'></view>
</view>
</view>
</view>
</view>
<view class='title'>{{item.create_time}}</view>
... ... @@ -28,9 +36,9 @@
</view>
</view>
</view>
<!-- <view class='comments_btn'>
<view class='comments_btn' bindtap='jump_comment_detail' data-id='{{item.id}}'>
<view class='iconfont icon-message'></view>
<view class='comments'>评论</view>
</view> -->
</view>
</view>
</view>
... ...
... ... @@ -33,12 +33,33 @@
font-size: 26rpx;
color: #222;
}
.oneoneonestar{
position: relative
}
.stars1 {
display: flex;
}
.stars1s {
width: 100%;
height: 100%;
display: flex;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.icon-pingfen {
font-size: 26rpx;
color: #222;
color: #eee;
width: 26rpx;
height: 26rpx;
}
.icon-pingfens{
font-size: 26rpx;
color:#ffda44;
width: 26rpx;
height: 26rpx;
}
.title {
font-size: 24rpx;
... ... @@ -72,7 +93,7 @@
align-items: center;
font-size: 23rpx;
color: #949a9a;
margin-top: 24rpx;
margin-top: 34rpx;
}
.icon-message {
font-size: 22rpx;
... ...
// pages/index/user_comment_detail/user_comment_detail.js
const app=getApp()
Page({
/**
* 页面的初始数据
*/
data: {
id:-1,
commentList:null,
info:{},
value:''
},
//返回
get_my(){
wx.navigateBack({})
},
//渲染评论数据
fetchDetail(){
let url ='/wxapp/product/commentDetail'
let id=this.data.id
let params={
id
}
app.post(url,params).then(r=>{
if(r.code==1){
r.data.info.stars_arr = []
for (let i = 1; i < r.data.info.goods_stars + 1; i++) {
r.data.info.stars_arr.push(i);
}
r.data.info.create_time = app.timeFormate(r.data.info.create_time, 'YYMMDDHHMM');
r.data.list.forEach(function(ele,index){
ele.create_time = app.timeFormate(ele.create_time, 'YYMMDDHHMM');
})
this.setData({
commentList:r.data.list,
info:r.data.info
})
console.log(r)
}
})
},
//获取内容
fromInput(e){
console.log(e)
this.setData({
value:e.detail.value
})
},
//提交
submit(){
let value=this.data.value
if(value==''){
wx.showToast({
title: '请输入评价内容',
icon:'none'
})
return
}
let url ='/wxapp/order/replayComment'
let params={
object_id:this.data.id,
content:this.data.value
}
app.post(url,params).then(r=>{
if(r.code==1){
console.log(r)
this.fetchDetail();
this.setData({
value:''
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
id:options.id
})
this.fetchDetail();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/index/user_comment/user_comment.wxml-->
<view class='page'>
<view class='banner'>
<view class='iconfont icon-fanhui' catchtap='get_my'></view>
<view class='coupons'>用户评价</view>
</view>
<view class='user_information_box'>
<view class='user_information'>
<view class='the_star'>
<view class='head_portrait'>
<image src='{{info.avatar}}'></image>
</view>
<view class='star_box'>
<view class='user_name'>{{info.full_name}}</view>
<view class='oneoneonestar'>
<view class='stars1'>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
<view class='iconfont icon-pingfen'></view>
</view>
<view class='stars1s'>
<view class='iconfont icon-pingfen icon-pingfens' wx:for='{{info.stars_arr}}' wx:key='{{item}}'></view>
</view>
</view>
</view>
</view>
<view class='title'>{{info.create_time}}</view>
</view>
<view class='evaluation'>{{info.content}}</view>
<view class='comments_btn' bindtap='jump_comment_detail' data-id='{{child.id}}'>
<view class='iconfont icon-message'></view>
<view class='comments'>{{commentList.length}}</view>
</view>
</view>
<view class='user_information_box' wx:for='{{commentList}}' wx:for-index='index' wx:key='{{index}}'>
<view class='user_information'>
<view class='the_star'>
<view class='head_portrait'>
<image src='{{item.avatar}}'></image>
</view>
<view class='star_box'>
<view class='user_name'>{{item.full_name}}</view>
</view>
</view>
<view class='title'>{{item.create_time}}</view>
</view>
<view class='evaluation'>{{item.content}}</view>
<view class='comments_btn'>
<!-- <view class='iconfont icon-message'></view> -->
<text class='comments'>{{index}}\t#</text>
</view>
</view>
<view class='input_box'>
<input placeholder='Hi,快来说点什么吧~' placeholder-class='placeholder' bindchange='fromInput' class='input' value='{{value}}'/>
<view class='input_btn' bindtap='submit'>发送</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/index/user_comment/user_comment.wxss */
page{
width: 100%;
height: 100%;
background: #f4f4f4
}
.page{
width: 100%;
min-height: 100%;
position: relative;
padding-bottom:70rpx;
box-sizing: border-box
}
.oneoneonestar{
position: relative
}
.stars1 {
display: flex;
}
.stars1s {
width: 100%;
height: 100%;
display: flex;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
.icon-pingfen {
font-size: 26rpx;
color: #eee;
width: 26rpx;
height: 26rpx;
}
.icon-pingfens{
font-size: 26rpx;
color:#ffda44;
width: 26rpx;
height: 26rpx;
}
.user_information_box {
padding: 31rpx 25rpx 25rpx 25rpx;
box-sizing: border-box;
background: #fff;
margin-bottom:20rpx;
}
.user_information {
display: flex;
justify-content: space-between;
align-items: center;
}
.the_star {
display: flex;
align-items: center;
}
.head_portrait {
width: 62rpx;
height: 62rpx;
border-radius: 50%;
overflow: hidden
}
.head_portrait image {
width: 100%;
height: 100%;
}
.star_box {
margin-left: 25rpx;
}
.user_name {
font-size: 26rpx;
color: #222;
}
.title {
font-size: 24rpx;
color: #888;
}
.evaluation {
font-size: 24rpx;
color: #222;
margin-top: 25rpx;
}
.evaluation_img {
margin-top: 21rpx;
}
.upload_img_box {
display: flex;
}
.upload_img {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.upload_img image {
width: 100%;
height: 100%;
}
.comments_btn {
height: 20rpx;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 23rpx;
color: #949a9a;
margin-top: 34rpx;
line-height: 20rpx
}
.icon-message {
font-size: 22rpx;
color: #949a9a;
margin-right: 10rpx;
}
.input_box{
width: 100%;
height: 70rpx;
background: #fff;
position: absolute;
bottom: 0;
left: 0;
}
.placeholder{
font-size: 26rpx;
color: #888;
line-height: 70rpx;
}
.input{
width: 80%;
padding:0 16rpx;
box-sizing: border-box;
float: left;
margin-right: 2%;
font-size: 26rpx;
color: #888;
line-height: 70rpx;
}
.input_btn{
width: 16%;
height: 50rpx;
margin-top: 10rpx;
border-radius: 18rpx;
text-align: center;
line-height: 50rpx;
color: #fff;
font-size: 26rpx;
background: #ffda44;
float: left
}
\ No newline at end of file
... ...
... ... @@ -9,13 +9,14 @@ Page({
data: {
imgUrl: app.globalData.imgUrl,
msgType: 0,
activeList: [],
noticeList: [],
activeList: null,
noticeList: null,
url: '',
id: '',
long: false,
startTime:0,
endTime:0
endTime:0,
status:0
},
//点击清空消息
clearNotice() {
... ... @@ -48,18 +49,18 @@ Page({
},
//跳转至活动详情页
jump_active_detail(e) {
if(this.endTime=this.startTime<350){
if(this.data.endTime-this.data.startTime<300){
let that = this
let activeList = that.data.activeList
let id = e.currentTarget.dataset.id
activeList.forEach(function (ele, index) {
if (ele.id == id) {
ele.flag = !ele.flag
}
})
that.setData({
activeList: activeList
})
// activeList.forEach(function (ele, index) {
// if (ele.id == id) {
// ele.flag = !ele.flag
// }
// })
// that.setData({
// activeList: activeList
// })
wx.navigateTo({
url: '../notice_detail/notice_detail?id=' + e.currentTarget.dataset.id,
})
... ... @@ -93,6 +94,57 @@ Page({
noticeList: noticeList
})
},
//点击通知详情
dianji(e){
let id=e.currentTarget.dataset.objid
let that=this
let status=0
if (that.data.endTime - that.data.startTime < 300){
let url ='/wxapp/order/index'
let params={
status:0
}
app.post(url,params).then(r=>{
if(r.code==1){
console.log(r)
r.data.forEach(function(ele,index){
if(id==ele.id){
status = ele.status
if (status == 1) {
wx.navigateTo({
url: '../unpayOrderDetail/unpayOrderDetail?id=' + id,
})
} else if (status == 2) {
wx.navigateTo({
url: '../unship/unship?id=' + id,
})
} else if (status == 3) {
wx.navigateTo({
url: '../wait_receite/wait_receite?id=' + id
})
} else if (status == 4 || status == 5) {
console.log(1212)
wx.navigateTo({
url: '../uncomment/uncomment?id=' + id,
})
} else if (status == 8) {
wx.showToast({
title: '订单已取消',
icon: 'none'
})
} else if (status == 9) {
wx.navigateTo({
url: '../aftermarketDetail/aftermarketDetail?id=' + id,
})
}
}
})
}
})
}else{
return
}
},
//点击删除
deleteconfirm(e) {
let that = this
... ... @@ -124,13 +176,14 @@ Page({
//按压开始
touchstart(e){
this.setData({
startTime : e.timeStamp
startTime: e.timeStamp
})
},
//按压结束
touchend(e){
console.log(e)
this.setData({
endTime : e.timeStamp
endTime: e.timeStamp
})
},
/**
... ...
... ... @@ -17,6 +17,7 @@
</view>
<view class='content_item' hidden='{{msgType==1}}'>
<view class='da'>
<view wx:if='{{activeList.length>0}}'>
<view class='item_list' wx:for='{{activeList}}' wx:key='{{item.id}}' data-id='{{item.id}}' bindtouchstart='touchstart' bindtouchend='touchend' bindtap='jump_active_detail' bindlongtap='longtap'>
<image src='../../imgs/deleteicon.png' class='deleteicon' wx:if='{{item.flag}}' data-id='{{item.id}}' catchtap='deleteconfirm'></image>
... ... @@ -45,12 +46,16 @@
</view>
</view>
</view>
<view class='gogogo' wx:else>暂无活动消息</view>
<view class='gogogo' wx:if='{{activeList.length==0}}'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有消息哦</view>
</view>
</view>
</view>
<view class='content_item' hidden='{{msgType==0}}'>
<view>
<view class='da'>
<view wx:if='{{noticeList.length>0}}'>
<view class='item_list1' wx:for='{{noticeList}}' wx:key='{{item.id}}' data-id='{{item.id}}' catchlongtap='longtap'>
<view class='item_list1' wx:for='{{noticeList}}' wx:key='{{item.id}}' data-id='{{item.id}}' catchlongtap='longtap' bindtouchstart='touchstart' bindtouchend='touchend' data-objid='{{item.object_id}}' bindtap='dianji' >
<image src='../../imgs/deleteicon.png' class='deleteicon' data-id='{{item.id}}' catchtap='deleteconfirm' wx:if='{{item.flag}}'></image>
<view class='item_top'>
<view class='list_left'>
... ... @@ -59,7 +64,7 @@
</view>
<view>
<view class='head_portrait'>
<image src='{{item.more.thumbnail}}'></image>
<image src='{{item.thumbnail}}' wx:if='{{item.thumbnail!=""}}'></image>
</view>
</view>
</view>
... ... @@ -69,6 +74,9 @@
</view>
</view>
</view>
<view wx:else class='gogogo'>暂无通知消息</view>
<view wx:if='{{noticeList.length==0}}' class='gogogo'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有消息哦</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -4,11 +4,36 @@ page {
flex-flow: column;
height: 100%;
}
.da{
width: 100%;
height: 100%;
}
.gogogo{
width: 100%;
height: 100%;
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.banner {
height: 86rpx;
... ... @@ -52,6 +77,8 @@ page {
}
.content_item {
width: 100%;
height: calc(100% - 160rpx);
padding: 0 25rpx;
flex: 1;
overflow-y:scroll;
... ...
... ... @@ -40,6 +40,9 @@
</view>
</view>
</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>暂无消息</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有消息哦</view>
</view>
</view>
</view>
\ No newline at end of file
... ...
/* pages/my/afterMarketList/afterMarketList.wxss */
page{
background: #fafafa
background: #fafafa;
width: 100%;
height: 100%
}
.page{
width: 100%;
height: 100%
}
.item_list {
background-color: #fff;
padding: 24rpx 27rpx;
margin-top: 20rpx;
}
.content_item{
height: calc(100% - 100rpx)
}
.gogogo{
width: 100%;
height: 100%;
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.list_title {
font-size: 26rpx;
... ...
... ... @@ -37,6 +37,12 @@ Page({
name: '其他原因'
}],
},
//查看评价
goComments(e){
wx.navigateTo({
url: '../showComment/showComment?id='+e.currentTarget.dataset.id,
})
},
//jump_user跳转用户指南
jump_user() {
wx.navigateTo({
... ... @@ -131,6 +137,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
order_sn: options.id
})
... ...
... ... @@ -10,6 +10,7 @@
<view class='state'>
<view class='wait_pay'>售后服务</view>
<view class='state_btn'>
<view class='cancel_order' bindtap='goComments' data-id='{{orderInfo.id}}'>查看评价</view>
<view class='pay' bindtap='after_order' data-orderid='{{orderInfo.id}}'>申请售后</view>
</view>
</view>
... ...
... ... @@ -56,15 +56,15 @@ height:50rpx;
}
.cancel_order {
width: 140rpx;
height: 50rpx;
font-size: 24rpx;
color: #333333;
border-radius: 25rpx;
text-align: center;
line-height: 50rpx;
border: 1rpx solid #949a9a;
margin-left: 24rpx;
width: 140rpx;
height: 50rpx;
font-size: 24rpx;
color: #333;
border-radius: 25rpx;
text-align: center;
line-height: 50rpx;
background: #fff;
margin-right: 24rpx;
}
.content_item {
... ...
... ... @@ -15,9 +15,9 @@ Page({
tag: "知名情感博主",
answer: 134,
listen: 2234,
over:[],
unuse:[],
uses:[]
over:null,
unuse:null,
uses:null
}],
use:1,
open:false,
... ...
<!--pages/my/coupons/coupons.wxml-->
<view>
<view class='page'>
<view class='banner'>
<view class='iconfont icon-fanhui' bindtap='get_back'></view>
<view class='coupons'>优惠券</view>
... ... @@ -9,8 +9,9 @@
<view class='{{use===2?"use":""}}' bindtap='changeUse2'>已使用</view>
<view class='{{use===3?"use":""}}' bindtap='changeUse3'>已过期</view>
</view>
<block wx:if='{{use===1}}'>
<view class='item_list_boxs' wx:for='{{unuse}}' wx:key='{{item.id}}'>
<block wx:if='{{use===1}}'>
<view wx:if='{{unuse.length!=0}}'>
<view class='item_list_boxs' wx:for='{{unuse}}' wx:key='{{item.id}}'>
<view class='item_list'>
<view class='right_top_circle'>{{item.title}}</view>
<view class='list_character'>
... ... @@ -33,24 +34,36 @@
<view class='limit_values'>可使用商品,仅限{{item.limit_values}}</view>
</view>
</view>
</view>
<view class='gogogo' wx:if='{{unuse.length==0}}'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有没使用的优惠券哦</view>
</view>
</block>
<block wx:if='{{use===2}}'>
<view class='item_list item_list_list' wx:for='{{used}}' wx:key='{{item.id}}'>
<view wx:if='{{used.length!=0}}'>
<view class='item_list item_list_list' wx:for='{{used}}' wx:key='{{item.id}}'>
<view class='list_character'>
<view class='money'>
<text>¥</text>{{item.price}}
</view>
<view class='sale'>{{item.title}}</view>
<!--满200元可用(仅限蔬菜类目) -->
<!-- 满200元可用(仅限蔬菜类目) -->
<view>
<view class='data' wx:if='{{item.end_time!=0}}'>有效期至:{{item.end_time}}</view>
<view class='data' wx:else></view>
</view>
</view>
</view>
</view>
<view class='gogogo' wx:if='{{used.length==0}}'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有已使用的优惠券哦</view>
</view>
</block>
<block wx:if='{{use===3}}'>
<view class='item_list item_list_list' wx:for='{{over}}' wx:key='{{item.id}}'>
<view wx:if='{{over.length!=0}}'>
<view class='item_list item_list_list' wx:for='{{over}}' wx:key='{{item.id}}'>
<view class='list_character'>
<view class='money'>
<text>¥</text>{{item.price}}
... ... @@ -62,5 +75,10 @@
</view>
</view>
</view>
</view>
<view class='{{over.length==0}}' class='gogogo'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有已过期的优惠券哦</view>
</view>
</block>
</view>
\ No newline at end of file
... ...
page {
background-color: #fafafa;
width: 100%;
height: 100%;
background-color: #fafafa;
}
.page{
width: 100%;
height: 100%
}
.gogogo{
width: 100%;
height: calc(100% - 170rpx);
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.banner {
height: 86rpx;
width: 100%;
... ... @@ -29,7 +61,6 @@ page {
font-size: 28rpx;
color: #222;
border-bottom: 1rpx solid #ededed;
margin-bottom:46rpx;
}
.use{
... ... @@ -47,7 +78,7 @@ page {
}
.item_list_boxs{
/* height: 360rpx */
margin-top:46rpx;
}
.item_list,.item_list_list {
... ...
... ... @@ -2,8 +2,8 @@
<view class='page {{is_mobile||popup_state?"active":""}}'>
<view class='biggest_box'>
<view class='banner_box'>
<view class='hint_box' bindtap='signIn'>
<view class='sign_in_box1'>
<view class='hint_box'>
<view class='sign_in_box1' bindtap='signIn'>
<view class='iconfont icon-qiandao'></view>
<view>签到</view>
</view>
... ... @@ -74,28 +74,28 @@
<view class='order_item' bindtap='get_obligation2'>
<view class='small_red_dot_order' wx:if='{{orderState2}}'>{{order2}}</view>
<view class='content_img'>
<image src='{{imgUrl}}aicon44__2.png' class='iconfont0'></image>
<image src='{{imgUrl}}aicon44__2.png' class='iconfont1'></image>
</view>
<view>待发货</view>
</view>
<view class='order_item' bindtap='get_obligation3'>
<view class='small_red_dot_order' wx:if='{{orderState3}}'>{{order3}}</view>
<view class='content_img'>
<image src='{{imgUrl}}aicon44__3.png' class='iconfont0'></image>
<image src='{{imgUrl}}aicon44__3.png' class='iconfont2'></image>
</view>
<view>待收货</view>
</view>
<view class='order_item' bindtap='get_obligation4'>
<view class='small_red_dot_order' wx:if='{{orderState4}}'>{{order4}}</view>
<view class='content_img'>
<image src='{{imgUrl}}aicon44__4.png' class='iconfont0'></image>
<image src='{{imgUrl}}aicon44__4.png' class='iconfont4'></image>
</view>
<view>待评价</view>
</view>
<view class='order_item' bindtap='jump_afterMarket'>
<view class='small_red_dot_order' wx:if='{{orderState9}}'>{{order9}}</view>
<view class='content_img'>
<image src='{{imgUrl}}aicon44__5.png' class='iconfont0'></image>
<image src='{{imgUrl}}aicon44__5.png' class='iconfont5'></image>
</view>
<view>售后</view>
</view>
... ...
... ... @@ -3,11 +3,12 @@
page {
width: 100%;
height: 100%;
background-color: #f7f7f7;
background-color: #f7f7f7;
}
.page{
width: 100%;
height: 100%
height: 100%;
overflow-x: hidden
}
.page.active{
overflow: hidden
... ... @@ -219,7 +220,7 @@ page {
}
.iconfont0 {
width: 50rpx;
width: 49rpx;
height: 36rpx;
}
.iconfont1 {
... ... @@ -235,8 +236,12 @@ page {
height: 36rpx;
}
.iconfont4 {
width: 55rpx;
height: 36rpx;
}
.iconfont5 {
width: 54rpx;
height: 44rpx;
height: 43rpx;
}
.my_order {
... ... @@ -538,9 +543,11 @@ background:rgba(239,241,246,1);
.popup_btn {
width: 500rpx;
height: 70rpx;
font-size: 30rpx;
color: #f44;
border: 1rpx solid #f44;
font-size:30rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(255,68,68,1);
border: 2rpx solid #f44;
border-radius: 35rpx;
display: flex;
align-items: center;
... ...
... ... @@ -8,13 +8,13 @@ Page({
data: {
choose: false,
navId:-1,
collectionList:[],
collectionList:null,
parentId:0,
manage:false,
chooseAll:false,
cid:0,
id:0,
arr:[]
arr:null
},
//点击管理
manage_relative(){
... ... @@ -47,6 +47,7 @@ fetchCollection(){
that.setData({
collectionList: r.data,
navId: r.data[0].id,
parentId:r.data[0].id,
arr: r.data[0].childList
})
}else{
... ... @@ -69,7 +70,7 @@ fetch(){
}
})
that.setData({
arr:arr
arr:arr,
})
},
//选择删除
... ... @@ -194,6 +195,7 @@ deleteGoods(){
changeId(e){
this.setData({
navId:e.currentTarget.dataset.id,
parentId: e.currentTarget.dataset.id
});
this.fetch()
},
... ...
<!--pages/my/myCollection/myCollection.wxml-->
<view>
<view class='page'>
<view class='banner'>
<view class='iconfont icon-fanhui' catchtap='get_my'></view>
<view class='coupons'>我的收藏</view>
<view class='complete' bindtap='manage_relative'>管理</view>
</view>
<view class='select_list'>
<view wx:if='{{collectionList!=0}}'>
<view class='select_list'>
<view bindtap='changeId' data-id='{{cell.id}}' class='select_list_item {{navId==cell.id?"active":""}}' wx:for='{{collectionList}}' wx:for-index='cellindex' wx:key='{{cellindex}}' wx:for-item='cell'>{{cell.name}}</view>
</view>
<!-- <block wx:if='{{navId==parentId}}'> -->
<view class='content_item'>
<block wx:if='{{navId==parentId}}'>
<view class='content_item' wx:if='{{arr.length!=0}}'>
<view class='item_list' wx:for='{{arr}}' wx:for-item='item' wx:for-index='index' wx:key='{{index}}' bindtap="get_goodsDetail"data-index='{{index}}' data-id='{{item.id}}'>
<view class='iconfont icon-xuanzhong {{item.t?"active":""}}' wx:if='{{manage}}' catchtap='choose_del' data-fid='{{item.favorite_id}}' data-id='{{item.id}}' data-flag='{{item.t}}' data-index='{{index}}'></view>
<view class='content_img' >
... ... @@ -30,10 +31,19 @@
<text class='special_offer'>{{item.vip_price}}</text>
<view class='members_only'>会员专享</view>
</view>
</view>
</view>
</view>
<!-- </block> -->
</view>
</view>
<view wx:if='{{arr.length==0}}' class='da'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有消息哦</view>
</view>
</block>
</view>
<view wx:if='{{collectionList.length==0}}' class='gogogo'>
<image src='../../imgs/noMessage.png'></image>
<view>您暂时没有消息哦</view>
</view>
<view class='bottom_btn' wx:if='{{manage}}'>
<view class='all_btn' bindtap='chooseAllDel'>
<view class='iconfont icon-xuanzhong {{chooseAll?"active":""}}' ></view>
... ...
/* pages/my/myCollection/myCollection.wxss */
page {
background-color: #fafafa;
width: 100%;
height: 100%;
background-color: #fafafa;
}
.page{
width: 100%;
height: 100%
}
.gogogo{
width: 100%;
height: calc(100% - 86rpx);
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.da{
width: 100%;
height: calc(100% - 160rpx);
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.da image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.da view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.select_list {
height: 75rpx;
/* display: flex;
... ...
... ... @@ -62,7 +62,10 @@
</view>
</view>
</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>暂无订单</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有订单哦</view>
</view>
</view>
</block>
<block wx:if='{{navId==2}}'>
... ... @@ -98,7 +101,10 @@
</view>
</view>
</view>
<view class='gogogo' wx:else>暂无订单</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有待付款的订单哦</view>
</view>
</view>
</block>
<block wx:if='{{navId==3}}'>
... ... @@ -129,7 +135,10 @@
</view>
</view>
</view>
<view wx:else class='gogogo'>暂无订单</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有待发货的订单哦</view>
</view>
</view>
</block>
<block wx:if='{{navId==4}}'>
... ... @@ -160,7 +169,10 @@
</view>
</view>
</view>
<view class='gogogo' wx:else>暂无订单</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有待收货的订单哦</view>
</view>
</view>
</block>
<block wx:if='{{navId==5}}'>
... ... @@ -191,7 +203,10 @@
</view>
</view>
</view>
<view wx:else class='gogogo'>暂无消息</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有待评价的订单哦</view>
</view>
</view>
</block>
<block wx:if='{{navId==6}}'>
... ... @@ -224,7 +239,10 @@
</view>
</view>
<view class='gogogo' wx:else>暂无信息</view>
<view class='gogogo' wx:if='{{orderList.length==0}}'>
<image src='../../imgs/no.png'></image>
<view>您暂时没有完成的订单哦</view>
</view>
</view>
</block>
</view>
... ...
... ... @@ -5,11 +5,39 @@ page {
width: 100%;
height: 100%
}
.page{
width: 100%;
height: 100%
}
.content_item{
height: calc(100% - 160rpx)
}
.gogogo{
width: 100%;
height: 100%;
text-align: center;
line-height: 500rpx;
color: #888;
font-size: 32rpx;
position: relative;
}
.gogogo image{
height: 247rpx;
width: 340rpx;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-70%)
}
.gogogo view{
font-size:26rpx;
font-family:PingFang-SC-Medium;
font-weight:500;
color:rgba(136,136,136,1);
position: absolute;
left: 50%;
transform: translate(-50%,-20%);
top: 50%
}
.page{
width: 100%;
... ...
... ... @@ -15,6 +15,12 @@ Page({
value:'',
searchList:[]
},
//返回
getget(){
wx.navigateBack({
})
},
//获取关键字
get_keyWords(e){
let value=e.detail.value
... ...
<!--pages/my/edit_address/edit_address.wxml-->
<view class='page'>
<view class='banner'>
<!-- <view class='iconfont icon-fanhui'></view> -->
<view class='iconfont icon-fanhui' bindtap='getget'></view>
<view class='input_box'>
<view>
<input type="text" placeholder='{{hothothot}}' placeholder-class='banner_input' value='{{value}}' bindinput='get_keyWords' class='input_placeholder'></input>
... ...
... ... @@ -455,7 +455,7 @@ margin-bottom:2rpx;
height: 900rpx;
margin-top: 74rpx;
position: relative;
}
}
.dots{
position: absolute;
... ...
var _createClass=function(){function a(e,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||false;d.configurable=true;if("value" in d){d.writable=true}Object.defineProperty(e,d.key,d)}}return function(d,b,c){if(b){a(d.prototype,b)}if(c){a(d,c)}return d}}();function _classCallCheck(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}var ERROR_CONF={KEY_ERR:311,KEY_ERR_MSG:"key格式错误",PARAM_ERR:310,PARAM_ERR_MSG:"请求参数信息有误",SYSTEM_ERR:600,SYSTEM_ERR_MSG:"系统错误",WX_ERR_CODE:1000,WX_OK_CODE:200};var BASE_URL="https://apis.map.qq.com/ws/";var URL_SEARCH=BASE_URL+"place/v1/search";var URL_SUGGESTION=BASE_URL+"place/v1/suggestion";var URL_GET_GEOCODER=BASE_URL+"geocoder/v1/";var URL_CITY_LIST=BASE_URL+"district/v1/list";var URL_AREA_LIST=BASE_URL+"district/v1/getchildren";var URL_DISTANCE=BASE_URL+"distance/v1/";var Utils={location2query:function location2query(c){if(typeof c=="string"){return c}var b="";for(var a=0;a<c.length;a++){var e=c[a];if(!!b){b+=";"}if(e.location){b=b+e.location.lat+","+e.location.lng}if(e.latitude&&e.longitude){b=b+e.latitude+","+e.longitude}}return b},getWXLocation:function getWXLocation(c,b,a){wx.getLocation({type:"gcj02",success:c,fail:b,complete:a})},getLocationParam:function getLocationParam(b){if(typeof b=="string"){var a=b.split(",");if(a.length===2){b={latitude:b.split(",")[0],longitude:b.split(",")[1]}}else{b={}}}return b},polyfillParam:function polyfillParam(a){a.success=a.success||function(){};a.fail=a.fail||function(){};a.complete=a.complete||function(){}},checkParamKeyEmpty:function checkParamKeyEmpty(c,b){if(!c[b]){var a=this.buildErrorConfig(ERROR_CONF.PARAM_ERR,ERROR_CONF.PARAM_ERR_MSG+b+"参数格式有误");c.fail(a);c.complete(a);return true}return false},checkKeyword:function checkKeyword(a){return !this.checkParamKeyEmpty(a,"keyword")},checkLocation:function checkLocation(c){var a=this.getLocationParam(c.location);if(!a||!a.latitude||!a.longitude){var b=this.buildErrorConfig(ERROR_CONF.PARAM_ERR,ERROR_CONF.PARAM_ERR_MSG+" location参数格式有误");c.fail(b);c.complete(b);return false}return true},buildErrorConfig:function buildErrorConfig(a,b){return{status:a,message:b}},buildWxRequestConfig:function buildWxRequestConfig(c,a){var b=this;a.header={"content-type":"application/json"};a.method="GET";a.success=function(d){var e=d.data;if(e.status===0){c.success(e)}else{c.fail(e)}};a.fail=function(d){d.statusCode=ERROR_CONF.WX_ERR_CODE;c.fail(b.buildErrorConfig(ERROR_CONF.WX_ERR_CODE,result.errMsg))};a.complete=function(d){var e=+d.statusCode;switch(e){case ERROR_CONF.WX_ERR_CODE:c.complete(b.buildErrorConfig(ERROR_CONF.WX_ERR_CODE,d.errMsg));break;case ERROR_CONF.WX_OK_CODE:var f=d.data;if(f.status===0){c.complete(f)}else{c.complete(b.buildErrorConfig(f.status,f.message))}break;default:c.complete(b.buildErrorConfig(ERROR_CONF.SYSTEM_ERR,ERROR_CONF.SYSTEM_ERR_MSG))}};return a},locationProcess:function locationProcess(f,e,c,a){var d=this;c=c||function(g){g.statusCode=ERROR_CONF.WX_ERR_CODE;f.fail(d.buildErrorConfig(ERROR_CONF.WX_ERR_CODE,g.errMsg))};a=a||function(g){if(g.statusCode==ERROR_CONF.WX_ERR_CODE){f.complete(d.buildErrorConfig(ERROR_CONF.WX_ERR_CODE,g.errMsg))}};if(!f.location){d.getWXLocation(e,c,a)}else{if(d.checkLocation(f)){var b=Utils.getLocationParam(f.location);e(b)}}}};var QQMapWX=function(){function b(i){_classCallCheck(this,b);if(!i.key){throw Error("key值不能为空")}this.key=i.key}_createClass(b,[{key:"search",value:function f(i){var l=this;i=i||{};Utils.polyfillParam(i);if(!Utils.checkKeyword(i)){return}var k={keyword:i.keyword,orderby:i.orderby||"_distance",page_size:i.page_size||10,page_index:i.page_index||1,output:"json",key:l.key};if(i.address_format){k.address_format=i.address_format}if(i.filter){k.filter=i.filter}var n=i.distance||"1000";var j=i.auto_extend||1;var m=function m(o){k.boundary="nearby("+o.latitude+","+o.longitude+","+n+","+j+")";wx.request(Utils.buildWxRequestConfig(i,{url:URL_SEARCH,data:k}))};Utils.locationProcess(i,m)}},{key:"getSuggestion",value:function h(i){var k=this;i=i||{};Utils.polyfillParam(i);if(!Utils.checkKeyword(i)){return}var j={keyword:i.keyword,region:i.region||"全国",region_fix:i.region_fix||0,policy:i.policy||0,output:"json",key:k.key};wx.request(Utils.buildWxRequestConfig(i,{url:URL_SUGGESTION,data:j}))}},{key:"reverseGeocoder",value:function a(i){var k=this;i=i||{};Utils.polyfillParam(i);var j={coord_type:i.coord_type||5,get_poi:i.get_poi||0,output:"json",key:k.key};if(i.poi_options){j.poi_options=i.poi_options}var l=function l(m){j.location=m.latitude+","+m.longitude;wx.request(Utils.buildWxRequestConfig(i,{url:URL_GET_GEOCODER,data:j}))};Utils.locationProcess(i,l)}},{key:"geocoder",value:function g(i){var k=this;i=i||{};Utils.polyfillParam(i);if(Utils.checkParamKeyEmpty(i,"address")){return}var j={address:i.address,output:"json",key:k.key};wx.request(Utils.buildWxRequestConfig(i,{url:URL_GET_GEOCODER,data:j}))}},{key:"getCityList",value:function c(i){var k=this;i=i||{};Utils.polyfillParam(i);var j={output:"json",key:k.key};
wx.request(Utils.buildWxRequestConfig(i,{url:URL_CITY_LIST,data:j}))}},{key:"getDistrictByCityId",value:function d(i){var k=this;i=i||{};Utils.polyfillParam(i);if(Utils.checkParamKeyEmpty(i,"id")){return}var j={id:i.id||"",output:"json",key:k.key};wx.request(Utils.buildWxRequestConfig(i,{url:URL_AREA_LIST,data:j}))}},{key:"calculateDistance",value:function e(i){var k=this;i=i||{};Utils.polyfillParam(i);if(Utils.checkParamKeyEmpty(i,"to")){return}var j={mode:i.mode||"walking",to:Utils.location2query(i.to),output:"json",key:k.key};var l=function l(m){j.from=m.latitude+","+m.longitude;wx.request(Utils.buildWxRequestConfig(i,{url:URL_DISTANCE,data:j}))};if(i.from){i.location=i.from}Utils.locationProcess(i,l)}}]);return b}();module.exports=QQMapWX;
\ No newline at end of file
var _createClass = function() {
function a(e, c) {
for (var b = 0; b < c.length; b++) {
var d = c[b];
d.enumerable = d.enumerable || false;
d.configurable = true;
if ("value" in d) {
d.writable = true
}
Object.defineProperty(e, d.key, d)
}
}
return function(d, b, c) {
if (b) {
a(d.prototype, b)
}
if (c) {
a(d, c)
}
return d
}
}();
function _classCallCheck(a, b) {
if (!(a instanceof b)) {
throw new TypeError("Cannot call a class as a function")
}
}
var ERROR_CONF = {
KEY_ERR: 311,
KEY_ERR_MSG: "key格式错误",
PARAM_ERR: 310,
PARAM_ERR_MSG: "请求参数信息有误",
SYSTEM_ERR: 600,
SYSTEM_ERR_MSG: "系统错误",
WX_ERR_CODE: 1000,
WX_OK_CODE: 200
};
var BASE_URL = "https://apis.map.qq.com/ws/";
var URL_SEARCH = BASE_URL + "place/v1/search";
var URL_SUGGESTION = BASE_URL + "place/v1/suggestion";
var URL_GET_GEOCODER = BASE_URL + "geocoder/v1/";
var URL_CITY_LIST = BASE_URL + "district/v1/list";
var URL_AREA_LIST = BASE_URL + "district/v1/getchildren";
var URL_DISTANCE = BASE_URL + "distance/v1/";
var Utils = {
location2query: function location2query(c) {
if (typeof c == "string") {
return c
}
var b = "";
for (var a = 0; a < c.length; a++) {
var e = c[a];
if (!!b) {
b += ";"
}
if (e.location) {
b = b + e.location.lat + "," + e.location.lng
}
if (e.latitude && e.longitude) {
b = b + e.latitude + "," + e.longitude
}
}
return b
},
getWXLocation: function getWXLocation(c, b, a) {
wx.getLocation({
type: "gcj02",
success: c,
fail: b,
complete: a
})
},
getLocationParam: function getLocationParam(b) {
if (typeof b == "string") {
var a = b.split(",");
if (a.length === 2) {
b = {
latitude: b.split(",")[0],
longitude: b.split(",")[1]
}
} else {
b = {}
}
}
return b
},
polyfillParam: function polyfillParam(a) {
a.success = a.success || function() {};
a.fail = a.fail || function() {};
a.complete = a.complete || function() {}
},
checkParamKeyEmpty: function checkParamKeyEmpty(c, b) {
if (!c[b]) {
var a = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + b + "参数格式有误");
c.fail(a);
c.complete(a);
return true
}
return false
},
checkKeyword: function checkKeyword(a) {
return !this.checkParamKeyEmpty(a, "keyword")
},
checkLocation: function checkLocation(c) {
var a = this.getLocationParam(c.location);
if (!a || !a.latitude || !a.longitude) {
var b = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + " location参数格式有误");
c.fail(b);
c.complete(b);
return false
}
return true
},
buildErrorConfig: function buildErrorConfig(a, b) {
return {
status: a,
message: b
}
},
buildWxRequestConfig: function buildWxRequestConfig(c, a) {
var b = this;
a.header = {
"content-type": "application/json"
};
a.method = "GET";
a.success = function(d) {
var e = d.data;
if (e.status === 0) {
c.success(e)
} else {
c.fail(e)
}
};
a.fail = function(d) {
d.statusCode = ERROR_CONF.WX_ERR_CODE;
c.fail(b.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, result.errMsg))
};
a.complete = function(d) {
var e = +d.statusCode;
switch (e) {
case ERROR_CONF.WX_ERR_CODE:
c.complete(b.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, d.errMsg));
break;
case ERROR_CONF.WX_OK_CODE:
var f = d.data;
if (f.status === 0) {
c.complete(f)
} else {
c.complete(b.buildErrorConfig(f.status, f.message))
}
break;
default:
c.complete(b.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG))
}
};
return a
},
locationProcess: function locationProcess(f, e, c, a) {
var d = this;
c = c || function(g) {
g.statusCode = ERROR_CONF.WX_ERR_CODE;
f.fail(d.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, g.errMsg))
};
a = a || function(g) {
if (g.statusCode == ERROR_CONF.WX_ERR_CODE) {
f.complete(d.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, g.errMsg))
}
};
if (!f.location) {
d.getWXLocation(e, c, a)
} else {
if (d.checkLocation(f)) {
var b = Utils.getLocationParam(f.location);
e(b)
}
}
}
};
var QQMapWX = function() {
function b(i) {
_classCallCheck(this, b);
if (!i.key) {
throw Error("key值不能为空")
}
this.key = i.key
}
_createClass(b, [{
key: "search",
value: function f(i) {
var l = this;
i = i || {};
Utils.polyfillParam(i);
if (!Utils.checkKeyword(i)) {
return
}
var k = {
keyword: i.keyword,
orderby: i.orderby || "_distance",
page_size: i.page_size || 10,
page_index: i.page_index || 1,
output: "json",
key: l.key
};
if (i.address_format) {
k.address_format = i.address_format
}
if (i.filter) {
k.filter = i.filter
}
var n = i.distance || "1000";
var j = i.auto_extend || 1;
var m = function m(o) {
k.boundary = "nearby(" + o.latitude + "," + o.longitude + "," + n + "," + j + ")";
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_SEARCH,
data: k
}))
};
Utils.locationProcess(i, m)
}
}, {
key: "getSuggestion",
value: function h(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
if (!Utils.checkKeyword(i)) {
return
}
var j = {
keyword: i.keyword,
region: i.region || "全国",
region_fix: i.region_fix || 0,
policy: i.policy || 0,
output: "json",
key: k.key
};
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_SUGGESTION,
data: j
}))
}
}, {
key: "reverseGeocoder",
value: function a(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
var j = {
coord_type: i.coord_type || 5,
get_poi: i.get_poi || 0,
output: "json",
key: k.key
};
if (i.poi_options) {
j.poi_options = i.poi_options
}
var l = function l(m) {
j.location = m.latitude + "," + m.longitude;
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_GET_GEOCODER,
data: j
}))
};
Utils.locationProcess(i, l)
}
}, {
key: "geocoder",
value: function g(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
if (Utils.checkParamKeyEmpty(i, "address")) {
return
}
var j = {
address: i.address,
output: "json",
key: k.key
};
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_GET_GEOCODER,
data: j
}))
}
}, {
key: "getCityList",
value: function c(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
var j = {
output: "json",
key: k.key
};
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_CITY_LIST,
data: j
}))
}
}, {
key: "getDistrictByCityId",
value: function d(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
if (Utils.checkParamKeyEmpty(i, "id")) {
return
}
var j = {
id: i.id || "",
output: "json",
key: k.key
};
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_AREA_LIST,
data: j
}))
}
}, {
key: "calculateDistance",
value: function e(i) {
var k = this;
i = i || {};
Utils.polyfillParam(i);
if (Utils.checkParamKeyEmpty(i, "to")) {
return
}
var j = {
mode: i.mode || "walking",
to: Utils.location2query(i.to),
output: "json",
key: k.key
};
var l = function l(m) {
j.from = m.latitude + "," + m.longitude;
wx.request(Utils.buildWxRequestConfig(i, {
url: URL_DISTANCE,
data: j
}))
};
if (i.from) {
i.location = i.from
}
Utils.locationProcess(i, l)
}
}]);
return b
}();
module.exports = QQMapWX;
\ No newline at end of file
... ...