Browse Source

合并冲突

master
Gao xiaosong 3 years ago
parent
commit
09e7d5e461
  1. 2
      .hbuilderx/launch.json
  2. 64
      api/aftersales.js
  3. 10
      api/user.js
  4. 44
      components/CountDown.vue
  5. 1
      components/ProductWindow.vue
  6. 3
      config/index.js
  7. 141
      manifest.json
  8. 17
      pages.json
  9. 8
      pages/activity/DargainDetails/index.vue
  10. 7
      pages/activity/GoodsGroup/index.vue
  11. 10
      pages/activity/GoodsSeckill/index.vue
  12. 36
      pages/activity/GroupDetails/index.vue
  13. 15
      pages/activity/GroupRule/index.vue
  14. 45
      pages/activity/Poster/index.vue
  15. 91
      pages/authorization/index.vue
  16. 86
      pages/home/index.vue
  17. 307
      pages/order/GoodsReturn/index.vue
  18. 39
      pages/order/GoodsReturn/productlist.vue
  19. 87
      pages/order/OrderDetails/index.vue
  20. 334
      pages/order/OrderReturnDetail/index.vue
  21. 37
      pages/order/OrderSubmission/index.vue
  22. 128
      pages/order/ReturnList/index.vue
  23. 184
      pages/order/ReturnList/listItem.vue
  24. 174
      pages/order/submitExpress/index.vue
  25. 6
      pages/orderAdmin/AdminOrderList/index.vue
  26. 49
      pages/shop/EvaluateList/index.vue
  27. 53
      pages/shop/GoodsList/index.vue
  28. 4
      pages/shop/ShoppingCart/index.vue
  29. 53
      pages/user/ChangePassword/index.vue
  30. 191
      pages/user/Login/index.vue
  31. 340
      pages/user/Login/login.vue
  32. 6
      pages/user/PersonalData/index.vue
  33. 127
      pages/user/User/index.vue
  34. 19
      pages/user/coupon/GetCoupon/index.vue
  35. 4
      pages/user/signIn/Sign/index.vue
  36. 1
      store/index.js
  37. 17
      utils/index.js
  38. 17
      utils/request.js

2
.hbuilderx/launch.json

@ -6,7 +6,7 @@
{ {
"launchtype" : "remote" "launchtype" : "remote"
}, },
"h5" : "mp-weixin" :
{ {
"launchtype" : "remote" "launchtype" : "remote"
}, },

64
api/aftersales.js

@ -0,0 +1,64 @@
import request from '@/utils/request'
// 提交售后
/**
*
订单号 orderCode;
服务类型 0仅退款1退货退款 serviceType;
申请原因 reasonForApplication;
申请说明 applicationInstructions;
申请说明图片 applicationDescriptionPicture;
商品数据 productParamList;
*/
export function submitAfterSealsOrder(data) {
return request.post(`/applyForAfterSales`, data, {
login: true
});
}
// 售后订单列表
export function getAfterSealsList (params) {
return request.get('/storeAfterSales/list', params, {
login: true,
});
}
// 售后详情
export function getAfterSalesDeatail(key) {
return request.get(`/applyForAfterSales/${key}`);
}
// 查询订单
export function getAfterSealsDetail (key, id) {
return request.get(`/store/detail/${key}/${id}`)
}
// 搜索
export function searchAfterSealsDetail (key) {
return request.get(`/store/detail/${key}`)
}
// 撤销售后订单
export function rebackAfterSeals (key, id) {
return request.get(`/revoke/${key}/${id}`)
}
// 获取物流信息
export function getExpressData () {
return request.get('/yxExpress')
}
// 添加快递单号
export function addExpressData (params) {
return request.post('/addLogisticsInformation?' + `code=${params.code}&name=${params.name}&postalCode=${params.postalCode}&orderCode=${params.orderCode}&`, '', {
login: true
})
}
// 删除售后订单
export function deleteAfterSeals (params) {
return request.delete('/deleteAfterSalesOrder', params, {
login: true
})
}

10
api/user.js

@ -63,7 +63,7 @@ export function register(data) {
*/ */
export function registerReset(data) { export function registerReset(data) {
return request.post('/register/reset', data, { return request.post('/register/reset', data, {
login: false, login: true,
}) })
} }
@ -403,6 +403,14 @@ export function wxappBindingPhone(data) {
return request.post('wxapp/binding', data) return request.post('wxapp/binding', data)
} }
/**
* 小程序授权
*/
export function wxappGetUserInfo (data) {
return request.post('/wxapp/loginAuth', data)
//return request.get('/wechat/auth', data)
}
/* /*
* h5切换公众号登陆 * h5切换公众号登陆
* */ * */

44
components/CountDown.vue

@ -42,8 +42,9 @@ export default {
default: true, default: true,
}, },
}, },
data: function() { data() {
return { return {
timeInterval: null,
time: this.datatime, time: this.datatime,
day: '00', day: '00',
hour: '00', hour: '00',
@ -51,7 +52,7 @@ export default {
second: '00', second: '00',
} }
}, },
created: function() { created() {
this.show_time() this.show_time()
}, },
watch: { watch: {
@ -61,10 +62,11 @@ export default {
this.show_time() this.show_time()
}, },
}, },
mounted: function() {}, mounted() {
},
methods: { methods: {
show_time: function() { show_time() {
let that = this console.log(this.datatime)
if (this.time.toString().length == 13) { if (this.time.toString().length == 13) {
// //
console.log('毫秒') console.log('毫秒')
@ -77,17 +79,19 @@ export default {
console.log('时间') console.log('时间')
this.time = Date.parse(this.time) / 1000 this.time = Date.parse(this.time) / 1000
} }
this.runTime()
function runTime() { this.timeInterval = setInterval(this.runTime, 1000)
},
runTime() {
// //
let intDiff = that.time - Date.parse(new Date()) / 1000 // let intDiff = this.time - Date.parse(new Date()) / 1000 //
let day = 0, let day = 0,
hour = 0, hour = 0,
minute = 0, minute = 0,
second = 0 second = 0
if (intDiff > 0) { if (intDiff > 0) {
// //
if (that.isDay === true) { if (this.isDay === true) {
day = Math.floor(intDiff / (60 * 60 * 24)) day = Math.floor(intDiff / (60 * 60 * 24))
} else { } else {
day = 0 day = 0
@ -98,20 +102,20 @@ export default {
if (hour <= 9) hour = '0' + hour if (hour <= 9) hour = '0' + hour
if (minute <= 9) minute = '0' + minute if (minute <= 9) minute = '0' + minute
if (second <= 9) second = '0' + second if (second <= 9) second = '0' + second
that.day = day this.day = day
that.hour = hour this.hour = hour
that.minute = minute this.minute = minute
that.second = second this.second = second
} else { } else {
that.day = '00' this.day = '00'
that.hour = '00' this.hour = '00'
that.minute = '00' this.minute = '00'
that.second = '00' this.second = '00'
} }
} }
runTime()
this.timeInterval = setInterval(runTime, 1000)
},
}, },
destroyed() {
clearTimeout(this.timeInterval)
}
} }
</script> </script>

1
components/ProductWindow.vue

@ -83,6 +83,7 @@ export default {
return {}; return {};
}, },
mounted: function () { mounted: function () {
console.log(this.attr)
console.log(this); console.log(this);
}, },
watch: { watch: {

3
config/index.js

@ -1,5 +1,6 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api' // export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
export const VUE_APP_API_URL = '/h5api'
// export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api' // export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api'
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api' // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';

141
manifest.json

@ -69,12 +69,116 @@
"UniversalLinks": "https://yixiang.co/app/" "UniversalLinks": "https://yixiang.co/app/"
} }
}, },
"share": { /* */
"weixin": { "distribute" : {
"appid": "wx7c84ede33062d1e4", /* android */
"UniversalLinks": "https://yixiang.co/app/" "android" : {
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>"
]
},
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {
"oauth" : {
"weixin" : {
"appid" : "wx7c84ede33062d1e4",
"appsecret" : "c47ef66d3311194da44e60387d5c1abd",
"UniversalLinks" : "https://yixiang.co/app/"
} }
}, },
"payment" : {
"weixin" : {
"appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : "https://yixiang.co/app/"
}
},
"share" : {
"weixin" : {
"appid" : "wx7c84ede33062d1e4",
"UniversalLinks" : "https://yixiang.co/app/"
}
},
"ad" : {},
"geolocation" : {}
},
"splashscreen" : {
"ios" : {
"iphone" : {
"portrait-896h@3x" : "splash/1242+2688.png",
"portrait-896h@2x" : "splash/828+1792.png",
"iphonex" : "splash/1125+2436.png",
"retina55" : "splash/1142+2208.png",
"retina47" : "splash/750+1334.png",
"retina40" : "splash/640+1136.png",
"retina35" : "splash/640+960.png"
}
},
"android" : {
"hdpi" : "splash/480+762.png",
"xhdpi" : "splash/720+1242.png",
"xxhdpi" : "splash/1080+1882.png"
},
"iosStyle" : "common"
},
"icons" : {
"android" : {
"hdpi" : "icons/72x72.png",
"xhdpi" : "icons/96x96.png",
"xxhdpi" : "icons/144x144.png",
"xxxhdpi" : "icons/192x192.png"
},
"ios" : {
"appstore" : "icons/1024x1024.png",
"ipad" : {
"app" : "icons/76x76.png",
"app@2x" : "icons/152x152.png",
"notification" : "icons/20x20.png",
"notification@2x" : "icons/40x40.png",
"proapp@2x" : "icons/167x167.png",
"settings" : "icons/29x29.png",
"settings@2x" : "icons/58x58.png",
"spotlight" : "icons/40x40.png",
"spotlight@2x" : "icons/80x80.png"
},
"iphone" : {
"app@2x" : "icons/120x120.png",
"app@3x" : "icons/180x180.png",
"notification@2x" : "icons/40x40.png",
"notification@3x" : "icons/60x60.png",
"settings@2x" : "icons/58x58.png",
"settings@3x" : "icons/87x87.png",
"spotlight@2x" : "icons/80x80.png",
"spotlight@3x" : "icons/120x120.png"
}
}
}
}
},
"quickapp" : {},
"mp-weixin" : {
"appid" : "wx604d2ea4702620d2",
"setting" : {
"urlCheck" : true,
"postcss" : true,
"minified" : true
},
"ad": {}, "ad": {},
"geolocation": {} "geolocation": {}
}, },
@ -179,13 +283,32 @@
"router": { "router": {
"mode": "history" "mode": "history"
}, },
"sdkConfigs": { "h5" : {
"maps": { "title" : "yshop",
"qqmap": { "devServer" : {
"key": "" "disableHostCheck" : true,
"proxy" : {
"/h5api" : {
//
"target" : "http://itxzz.51vip.biz/",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
"^/h5api" : "/api"
}
}
}
},
"router" : {
"mode" : "history"
},
"sdkConfigs" : {
"maps" : {
"qqmap" : {
"key" : ""
} }
} }
}, },
"domain": "h5.yixiang.co" "domain" : "h5.yixiang.co"
} }
} }

17
pages.json

@ -25,7 +25,8 @@
} }
}, },
{ {
"path": "pages/user/RetrievePassword/index", // "path": "pages/user/RetrievePassword/index",
"path": "pages/user/ChangePassword/index",
"style": { "style": {
"navigationBarTitleText": "重置密码" "navigationBarTitleText": "重置密码"
} }
@ -296,6 +297,12 @@
"navigationBarTitleText": "订单详情" "navigationBarTitleText": "订单详情"
} }
}, },
{
"path" : "pages/order/OrderReturnDetail/index",
"style": {
"navigationBarTitleText": "售后详情"
}
},
{ {
"path": "pages/order/OrderSubmission/index", "path": "pages/order/OrderSubmission/index",
"style": { "style": {
@ -317,7 +324,13 @@
{ {
"path": "pages/order/ReturnList/index", "path": "pages/order/ReturnList/index",
"style": { "style": {
"navigationBarTitleText": "退货列表" "navigationBarTitleText": "我的售后"
}
},
{
"path": "pages/order/submitExpress/index",
"style": {
"navigationBarTitleText": "售后物流填写"
} }
}, },
{ {

8
pages/activity/DargainDetails/index.vue

@ -38,8 +38,8 @@
<text class="num" v-text="bargainHelpCount.remainingPrice"></text> <text class="num" v-text="bargainHelpCount.remainingPrice"></text>
</view> </view>
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<view class="successNum" v-text="'原价' + goodsDetail.price"></view> <view class="successNum" v-text="`原价:${goodsDetail.price || 0}`"></view>
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view> <view class="successNum" v-text="`已有${bargainSumCount || 0}人砍价成功`"></view>
</view> </view>
</view> </view>
</view> </view>
@ -51,9 +51,9 @@
<!-- 砍价进度条下的金额 --> <!-- 砍价进度条下的金额 -->
<view class="balance acea-row row-between-wrapper"> <view class="balance acea-row row-between-wrapper">
<view v-text="'已砍' + bargainHelpCount.alreadyPrice + '元'"></view> <view v-text="`已砍${bargainHelpCount.alreadyPrice || 0}元`"></view>
<view v-if="bargainHelpCount.price === 0">砍价成功</view> <view v-if="bargainHelpCount.price === 0">砍价成功</view>
<view v-else v-text="'还剩' + bargainHelpCount.price + '元'"></view> <view v-else v-text="`还剩${bargainHelpCount.price || 0}元`"></view>
</view> </view>
<!-- 砍价成功--> <!-- 砍价成功-->

7
pages/activity/GoodsGroup/index.vue

@ -9,7 +9,8 @@
</view> </view>
<view class="group-box"> <view class="group-box">
<view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id"> <view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id">
<activity-card :cid="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image" :price="groupon.price" :productPrice="groupon.productPrice"> <activity-card
:cid="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image" :price="groupon.price" :productPrice="groupon.productPrice">
<block slot="tag"> <block slot="tag">
<view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view> <view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
</block> </block>
@ -22,7 +23,9 @@
<text class="group-num">{{ groupon.people || 0 }}人团</text> <text class="group-num">{{ groupon.people || 0 }}人团</text>
</view> </view>
</block> </block>
<block slot="btn"><button class="cu-btn buy-btn" @tap.stop="jump('/pages/activity/GroupDetails/index', { id: groupon.id })">马上拼</button></block> <block slot="btn">
<button class="cu-btn buy-btn"
@tap.stop="jump('/pages/activity/GroupDetails/index', { id: groupon.id })">马上拼</button></block>
</activity-card> </activity-card>
</view> </view>
</view> </view>

10
pages/activity/GoodsSeckill/index.vue

@ -3,6 +3,7 @@
<view class="tui-bg__box"> <view class="tui-bg__box">
<image :src="`${$VUE_APP_RESOURCES_URL}/images/bg_seckill.png`" class="tui-bg__img" mode="widthFix" :style="{ opacity: opacity }"></image> <image :src="`${$VUE_APP_RESOURCES_URL}/images/bg_seckill.png`" class="tui-bg__img" mode="widthFix" :style="{ opacity: opacity }"></image>
</view> </view>
<view class="tui-header__bg"> <view class="tui-header__bg">
<image :src="`${$VUE_APP_RESOURCES_URL}/images/bg_seckill.png`" class="tui-bg__img" mode="widthFix"></image> <image :src="`${$VUE_APP_RESOURCES_URL}/images/bg_seckill.png`" class="tui-bg__img" mode="widthFix"></image>
<scroll-view class="tui-time-slot" scroll-x> <scroll-view class="tui-time-slot" scroll-x>
@ -37,7 +38,7 @@
</view> </view>
<view class="tui-countdown__box" v-if="item.status == 1 || item.status == 2"> <view class="tui-countdown__box" v-if="item.status == 1 || item.status == 2">
<text>距离{{ item.status == 1 ? '结束还剩' : '开始还有' }}</text> <text>距离{{ item.status == 1 ? '结束还剩' : '开始还有' }}</text>
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="item.stop"></count-down> <CountDown :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="item.stop"></CountDown>
</view> </view>
</view> </view>
</block> </block>
@ -163,6 +164,7 @@ export default {
that.status = false that.status = false
that.active = index that.active = index
that.datatime = that.timeList[that.active].stop that.datatime = that.timeList[that.active].stop
console.log(new Date(that.datatime))
this.seckillList = [] this.seckillList = []
that.getSeckillList() that.getSeckillList()
}, },
@ -212,6 +214,9 @@ export default {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
/* #ifdef H5 */
top: 80rpx;
/* #endif */
z-index: 1; z-index: 1;
} }
@ -221,6 +226,9 @@ export default {
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
/* #ifdef H5 */
top: 80rpx;
/* #endif */
z-index: 3; z-index: 3;
overflow: hidden; overflow: hidden;
} }

36
pages/activity/GroupDetails/index.vue

@ -260,7 +260,7 @@ export default {
}, },
methods: { methods: {
formatPrice(price, index) { formatPrice(price, index) {
console.log(price) // console.log(price)
if (price) { if (price) {
return price.split('.')[index] return price.split('.')[index]
} }
@ -284,15 +284,6 @@ export default {
}, },
} }
}, },
openAlone: function() {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: this.storeInfo.productId,
},
})
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
// //
setCollect: function() { setCollect: function() {
let that = this, let that = this,
@ -452,24 +443,41 @@ export default {
this.$set(this, 'attrTxt', '请选择') this.$set(this, 'attrTxt', '请选择')
} }
}, },
//
openAlone: function() {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: this.storeInfo.productId,
},
})
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
//
openTeam: function() { openTeam: function() {
var that = this var that = this
if (that.attr.cartAttr == false) { console.log(this.attr)
if (that.attr.cartAttr == false) { //
console.log(this.attr.cartAttr)
that.attr.cartAttr = !this.attr.cartAttr that.attr.cartAttr = !this.attr.cartAttr
} else { //
that.attr.productSelect.price = this.storeInfo.price
} else { //
var data = {} var data = {}
data.productId = that.storeInfo.productId data.productId = that.storeInfo.productId
data.price = that.storeInfo.price
data.cartNum = that.attr.productSelect.cart_num data.cartNum = that.attr.productSelect.cart_num
data.uniqueId = that.attr.productSelect.unique data.uniqueId = that.attr.productSelect.unique
data.combinationId = that.storeInfo.id data.combinationId = that.storeInfo.id
data.new = 1 data.new = 1
console.log(data)
postCartAdd(data) postCartAdd(data)
.then(res => { .then(res => {
that.$yrouter.push({ that.$yrouter.push({
path: '/pages/order/OrderSubmission/index', path: '/pages/order/OrderSubmission/index',
query: { query: {
id: res.data.cartId, // id: res.data.cartId,
pinkId: res.data.cartId,
}, },
}) })
}) })

15
pages/activity/GroupRule/index.vue

@ -7,11 +7,11 @@
<view class="tui-price__box"> <view class="tui-price__box">
<view class="tui-goods-price"> <view class="tui-goods-price">
<view class="tui-size-24"></view> <view class="tui-size-24"></view>
<view class="tui-price-large">{{ storeCombination.price.split('.')[0] }}</view> <view class="tui-price-large">{{ storeCombination.price.split('.')[0] || 0 }}</view>
<view class="tui-size-24">.{{ storeCombination.price.split('.')[1] }}</view> <view class="tui-size-24">.{{ storeCombination.price.split('.')[1] || 0 }}</view>
<!-- <text>已拼2020件</text> --> <!-- <text>已拼2020件</text> -->
</view> </view>
<view class="tui-price-tag">{{ storeCombination.people }}人团</view> <view class="tui-price-tag">{{ storeCombination.people || 0 }}人团</view>
</view> </view>
</view> </view>
</view> </view>
@ -96,15 +96,14 @@ export default {
} }
}, },
}, },
mounted: function() { mounted() {
var that = this
let url = handleQrCode() let url = handleQrCode()
if (url) { if (url) {
that.pinkId = url.pinkId this.pinkId = url.pinkId
} else { } else {
that.pinkId = that.$yroute.query.id this.pinkId = this.$yroute.query.id
} }
that.getCombinationPink() this.getCombinationPink()
}, },
methods: { methods: {
pay: function() { pay: function() {

45
pages/activity/Poster/index.vue

@ -1,10 +1,17 @@
<template> <template>
<view class="poster-poster" v-if="status === false"> <view class="poster-poster" v-if="status === false">
<view class="tip"> <view class="tip">
<!-- #ifndef H5 -->
<text class="iconfont icon-shuoming"></text>提示长按图片保存至手机相册 <text class="iconfont icon-shuoming"></text>提示长按图片保存至手机相册
<!-- #endif -->
</view> </view>
<view class="poster"> <view class="poster">
<!-- #ifndef APP-PLUS -->
<image :src="image" mode="widthFix" show-menu-by-longpress /> <image :src="image" mode="widthFix" show-menu-by-longpress />
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<image :src="image" mode="widthFix" @longtap="longtap"/>
<!-- #endif -->
</view> </view>
</view> </view>
</template> </template>
@ -18,22 +25,21 @@
name: "Poster", name: "Poster",
components: {}, components: {},
props: {}, props: {},
data: function () { data () {
return { return {
status: true, status: true,
id: 0, id: 0,
image: "" image: ""
}; };
}, },
mounted: function () { mounted () {
var that = this; var id = this.$yroute.query.id;
var id = that.$yroute.query.id; var type = this.$yroute.query.type;
var type = that.$yroute.query.type; this.id = id;
that.id = id;
if (type == 2) { if (type == 2) {
that.getBargainPoster(); this.getBargainPoster();
} else { } else {
that.getCombinationPoster(); this.getCombinationPoster();
} }
}, },
methods: { methods: {
@ -84,6 +90,29 @@
duration: 2000 duration: 2000
}); });
}); });
},
// app
longtap () {
//
uni.downloadFile({
url: this.img,
success: (res) => {
//
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
uni.showToast({
title: "保存成功!",
});
},
fail: () => {
uni.showToast({
title: "保存失败",
});
},
});
},
});
} }
} }
}; };

91
pages/authorization/index.vue

@ -6,10 +6,14 @@
<view class="force-login__content y-f"> <view class="force-login__content y-f">
<open-data class="user-avatar" type="userAvatarUrl"></open-data> <open-data class="user-avatar" type="userAvatarUrl"></open-data>
<open-data class="user-name" type="userNickName"></open-data> <open-data class="user-name" type="userNickName"></open-data>
<view class="login-notice">为了提供更优质的服务需要获取您的头像昵称</view> <view class="login-notice">为了提供更优质的服务请先登录</view>
<button class="cu-btn author-btn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看</button> <button
<button class="cu-btn author-btn" v-else @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看</button> class="cu-btn author-btn"
<button class="cu-btn close-btn" @tap="back">暂不授权</button> open-type="getPhoneNumber"
@getphonenumber="phoneLogin">微信手机号一键登录</button>
<!-- <button class="cu-btn author-btn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看</button>
<button class="cu-btn author-btn" v-else @getuserinfo="getUserInfoBtn" open-type="getUserInfo">授权并查看</button> -->
<button class="cu-btn close-btn" @tap="back">暂不登录</button>
</view> </view>
</view> </view>
<!-- #endif --> <!-- #endif -->
@ -27,27 +31,28 @@
<script> <script>
import { mapState, mapMutations, mapActions } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
import { wxappAuth, getUser } from '@/api/user' import { wxappAuth, getUser, getUserInfo } from '@/api/user'
import { login, authorize, getProvider } from '@/utils'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import cookie from '@/utils/store/cookie' import cookie from '@/utils/store/cookie'
import { login, authorize } from '@/utils' import store from '@/store'
//
import { auth } from '@/libs/wechat.js'
export default { export default {
data() { data() {
return { return {
authorize: false, authorize: false,
canIUseGetUserProfile: false, canIUseGetUserProfile: false
} }
}, },
computed: { computed: {
...mapState(['isAuthorization', '$deviceType', 'token']), ...mapState(['isAuthorization', '$deviceType', 'token']),
}, },
onLoad() { onLoad() {
console.log(wx.getUserProfile)
if (wx.getUserProfile) { if (wx.getUserProfile) {
console.log(this)
this.canIUseGetUserProfile = true this.canIUseGetUserProfile = true
console.log(this.canIUseGetUserProfile)
} }
// // // //
}, },
@ -74,9 +79,9 @@ export default {
query: {}, query: {},
}) })
}, },
getUserInfo(data) { getUserInfoBtn(data) {
console.log(data) console.log(data)
console.log('getUserInfo') console.log('getUserInfoBtn')
if (data.detail.errMsg == 'getUserInfo:fail auth deny') { if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
uni.showToast({ uni.showToast({
title: '取消授权', title: '取消授权',
@ -106,13 +111,14 @@ export default {
}) })
}) })
}, },
//
getUserInfoProfile(data) { getUserInfoProfile(data) {
console.log('getUserInfoProfile') console.log('getUserInfoProfile')
wx.getUserProfile({ wx.getUserProfile({
lang: 'zh_CN', lang: 'zh_CN',
desc: '需要获取您的信息用来展示', desc: '需要获取您的信息用来展示',
success: res => { success: res => {
console.log(res) console.log('用户信息',res)
uni.showLoading({ uni.showLoading({
title: '登录中', title: '登录中',
}) })
@ -134,10 +140,67 @@ export default {
}, },
}) })
}, },
//
phoneLogin(e) {
console.log('用户微信手机号登录')
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
console.log(e.mp.detail)
getProvider()
.then(provider => {
console.log('当前的环境商',provider)
if (!provider) {
reject()
}
// uni
uni.login({
provider: provider,
success: async loginRes => {
console.log(loginRes)
let code = loginRes.code // code
cookie.set('wxLoginCode', loginRes.code)
wxappAuth({
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv,
code: code,
spread: cookie.get('spread'),
})
.then( res => {
console.log('登录成功,开始处理登录信息保存,并获取用户详情')
uni.hideLoading()
store.commit('login', res.data.token, dayjs(res.data.expires_time))
store.dispatch('userInfo', true)
getUserInfo()
.then(user => {
console.log('获取用户信息成功')
uni.setStorageSync('uid', user.data.uid)
store.dispatch('setUserInfo', user.data)
this.$yrouter.reLaunch({
path: cookie.get('redirect').replace(/\ /g, ''),
})
})
.catch(error => {
console.log('获取用户信息失败')
})
})
.catch(error => {
console.log(error)
console.log('登录接口调用失败')
})
}
})
})
.catch(err => {})
} else {
uni.showToast({
title: '已拒绝授权',
icon: 'none',
duration: 2000,
})
}
},
}, },
mounted() { mounted() {
if (wx.getUserProfile) { if (wx.getUserProfile) {
console.log(this)
this.canIUseGetUserProfile = true this.canIUseGetUserProfile = true
console.log(this.canIUseGetUserProfile) console.log(this.canIUseGetUserProfile)
} }

86
pages/home/index.vue

@ -19,33 +19,53 @@
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner> <Banner v-if="item.type == 'banner'"
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar> :detail="item.componentContent.bannerData"
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus"> @getbgcolor="getbgcolor"></Banner>
<uni-notice-bar
v-if="item.type == 'noticeBar'"
scrollable="true"
@click="goRoll(item.componentContent.roll[0])"
single="true" :speed="10"
showIcon="true"
:text="item.componentContent.roll[0].info"></uni-notice-bar>
<view class="content_box home_content_box"
v-if="item.type == 'menu' && item.componentContent.menus">
<!-- 菜单 --> <!-- 菜单 -->
<Menu :list="item.componentContent.menus"></Menu> <Menu :list="item.componentContent.menus"></Menu>
</view> </view>
<!-- 滚动新闻 --> <!-- 滚动新闻 -->
<!-- 广告 --> <!-- 广告 -->
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" /> <Adv v-if="item.type == 'adv' && item.componentContent.detail"
:detail="item.componentContent.detail" />
<!-- 热门榜单 --> <!-- 热门榜单 -->
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity> <HotCommodity v-if="item.type == 'hotCommodity'"
:detail="likeInfo" />
<!-- 超值拼团 --> <!-- 超值拼团 -->
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" /> <Groupon v-if="item.type == 'groupon'" :detail="combinationList" />
<!-- 首发新品->秒杀 --> <!-- 首发新品->秒杀 -->
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct> <FirstNewProduct v-if="item.type == 'firstNewProduct'"
:detail="firstList" />
<!-- 精品推荐 --> <!-- 精品推荐 -->
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended> <ProductsRecommended v-if="item.type == 'productsRecommended'"
:detail="bastList" />
<!-- 促销单品 --> <!-- 促销单品 -->
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct> <PromoteProduct v-if="item.type == 'promoteProduct'"
:detail="benefit" />
<!-- 直播 --> <!-- 直播 -->
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<Live v-if="item.type == 'live'" :detail="live"></Live> <Live v-if="item.type == 'live'" :detail="live" />
<!-- #endif --> <!-- #endif -->
<!-- 为您推荐 --> <!-- 为您推荐 -->
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> <PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit" />
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window> <Coupon-window
:coupon-list="couponList"
v-if="showCoupon"
@checked="couponClose" @close="couponClose" />
</view> </view>
<!-- #ifdef H5 -->
<view class="bottomSpace" style='line-height:100rpx'>正在使用H5方式浏览</view>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
@ -178,6 +198,7 @@ export default {
observeParents: true, observeParents: true,
}, },
bgImage: '', bgImage: '',
// indexTitle: false,
} }
}, },
computed: { computed: {
@ -194,34 +215,40 @@ export default {
return style return style
}, },
}, },
onLoad: function() { onLoad() {
this.getLocation() this.getLocation()
let that = this
// uni.showLoading({ // uni.showLoading({
// title: "", // title: "",
// }); // });
getCanvas() getCanvas()
.then(res => {}) .then(res => {
console.log('223',res)
})
.catch(error => { .catch(error => {
if (!error) {
return
}
this.homeData = JSON.parse(error.data.json) this.homeData = JSON.parse(error.data.json)
console.log(this.homeData) console.log('225',this.homeData)
console.log(222)
}) })
getHomeData().then(res => { getHomeData().then(res => {
that.logoUrl = res.data.logoUrl this.logoUrl = res.data.logoUrl
res.data.banner.map(item => (item.bgcolor = item.color || '')) res.data.banner.forEach(item => (item.bgcolor = item.color || ''))
that.$set(that, 'info', res.data.info) this.info = res.data.info
that.$set(that, 'firstList', res.data.firstList) console.log('239', res.data.info)
that.$set(that, 'bastList', res.data.bastList) console.log('239',this.info)
that.$set(that, 'likeInfo', res.data.likeInfo) this.$set(this, 'info', res.data.info)
that.$set(that, 'live', res.data.liveList) this.$set(this, 'firstList', res.data.firstList)
that.$set(that, 'lovely', res.data.lovely) this.$set(this, 'bastList', res.data.bastList)
that.$set(that, 'benefit', res.data.benefit) this.$set(this, 'likeInfo', res.data.likeInfo)
that.$set(that, 'couponList', res.data.couponList) this.$set(this, 'live', res.data.liveList)
that.$set(that, 'combinationList', res.data.combinationList) this.$set(this, 'lovely', res.data.lovely)
this.$set(this, 'benefit', res.data.benefit)
this.$set(this, 'couponList', res.data.couponList)
this.$set(this, 'combinationList', res.data.combinationList)
uni.hideLoading() uni.hideLoading()
that.setOpenShare() this.setOpenShare()
// that.doColorThief() // this.doColorThief()
}) })
}, },
methods: { methods: {
@ -289,6 +316,7 @@ export default {
uni.scanCode({ uni.scanCode({
success: res => { success: res => {
let option = handleUrlParam(res.result) let option = handleUrlParam(res.result)
console.log(option)
switch (option.pageType) { switch (option.pageType) {
case 'good': case 'good':
// //

307
pages/order/GoodsReturn/index.vue

@ -1,6 +1,12 @@
<!-- 售后提交 -->
<template> <template>
<view class="apply-return"> <view class="apply-return">
<view class="goodsStyle acea-row row-between" v-for="cart in orderInfo.cartInfo" :key="cart.id"> <!-- 申请售后 -->
<view class="container" v-if="selected">
<view class="goodsStyle acea-row row-between"
v-for="cart in selectProduct"
:key="cart.id"
>
<view class="pictrue"> <view class="pictrue">
<image :src="cart.productInfo.image" class="image" /> <image :src="cart.productInfo.image" class="image" />
</view> </view>
@ -19,13 +25,13 @@
</view> </view>
</view> </view>
<view class="list"> <view class="list">
<view class="item acea-row row-between-wrapper"> <view v-if="serviceType === 1" class="item acea-row row-between-wrapper">
<view>退货件数</view> <view>退货件数</view>
<view class="num">{{ orderInfo.totalNum }}</view> <view class="num">{{ totalNum || 0 }}</view>
</view> </view>
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>退款金额</view> <view>退款金额</view>
<view class="num">{{ orderInfo.payPrice }}</view> <view class="num">{{ totalMoney || 0 }}</view>
</view> </view>
<picker :value="reason" :range="reasonList" @change="changeReason"> <picker :value="reason" :range="reasonList" @change="changeReason">
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
@ -36,27 +42,103 @@
</picker> </picker>
<view class="item textarea acea-row row-between"> <view class="item textarea acea-row row-between">
<view>备注说明</view> <view>备注说明</view>
<textarea placeholder="填写备注信息,100字以内" class="num" v-model="refund_reason_wap_explain"></textarea> <textarea class="num"
placeholder="填写备注信息,100字以内"
v-model="refund_reason_wap_explain"
></textarea>
</view>
</view>
<view v-if="serviceType === 0"
class="returnBnt bg-color-red"
@click="submit"
>申请退款</view>
<view v-if="serviceType === 1"
class="returnBnt bg-color-red"
@click="submit"
>申请退货</view>
</view>
<!-- 选择商品 -->
<view class="selectProduct" v-else>
<view class="selectContainer"
v-for="(cart, index) in selectProduct"
:key="cart.id"
>
<view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(index)">
<label class="well-check">
<checkbox color="#eb3729" value :checked="cart.checked"></checkbox>
</label>
</checkbox-group>
</view>
<view class="pictrue">
<image :src="cart.productInfo.image" class="image" />
</view>
<view class="content">
<view class="title">{{ cart.productInfo.storeName || '' }}</view>
<view class="skus">
<view class="sku">
{{ cart.productInfo.attrInfo.sku || '' }}
</view>
<view class="num">x{{ cart.cartNum || 0 }}</view>
</view>
<view class="money">
<view>
{{
cart.productInfo.attrInfo
? cart.productInfo.attrInfo.price
: cart.productInfo.price
}}
</view>
</view>
</view>
</view>
<view class="choose">
<view class="checkTotal">
<checkbox-group @change="allChecked">
<label class="well-check">
<checkbox
color="#eb3729"
value="allSelect"
:checked="isAllSelect"
></checkbox>
<text class="checkAll">全选 ({{ cartCount || 0 }})</text>
</label>
</checkbox-group>
<view class="total">
<view class="proTotal">
{{ orderInfo.totalNum || 0 }}件商品
</view>
<view class="moneyTotal">
合计 {{ orderInfo.totalPrice || 0 }}
</view>
</view>
</view>
<view class="typeBtn">
<view class="button def" @click="chooseType(0)">仅退款</view>
<view class="button redBtn" @click="chooseType(1)">退货退款</view>
</view>
</view> </view>
</view> </view>
<view class="returnBnt bg-color-red" @click="submit">申请退款</view>
</view> </view>
</template> </template>
<script> <script>
import { import {
orderDetail, orderDetail,
getRefundReason, getRefundReason,
postOrderRefund postOrderRefund
} from "@/api/order"; } from "@/api/order";
import { import {
submitAfterSealsOrder
} from '@/api/aftersales.js';
import {
trim trim
} from "@/utils"; } from "@/utils";
import { import {
VUE_APP_API_URL VUE_APP_API_URL
} from "@/config"; } from "@/config";
export default { export default {
name: "goodsReturn", name: "goodsReturn",
components: { components: {
// VueCoreImageUpload // VueCoreImageUpload
@ -68,13 +150,27 @@
Authorization: "Bearer " + this.$store.state.token Authorization: "Bearer " + this.$store.state.token
}, },
id: 0, id: 0,
selected: false,
orderInfo: {}, orderInfo: {},
rebackList: [],
reasonList: [], reasonList: [],
reason: "", reason: "",
refund_reason_wap_explain: "", refund_reason_wap_explain: '',
refund_reason_wap_img: [] refund_reason_wap_img: [],
serviceType: null,
//
selectProduct: [],
productParamList: [],
totalNum: 0,
totalMoney: 0,
isAllSelect: false
}; };
}, },
mounted() {
this.id = this.$yroute.query.id || 0;
this.getOrderDetail();
this.getRefundReason();
},
methods: { methods: {
changeReason(e) { changeReason(e) {
this.reason = this.reasonList[e.mp.detail.value]; this.reason = this.reasonList[e.mp.detail.value];
@ -91,11 +187,29 @@
this.refund_reason_wap_img.push(res.data.url); this.refund_reason_wap_img.push(res.data.url);
}, },
getOrderDetail() { getOrderDetail() {
uni.showLoading({
title: '正在查询商品',
duration: 2000,
})
orderDetail(this.id) orderDetail(this.id)
.then(res => { .then(res => {
this.orderInfo = res.data; this.orderInfo = res.data;
this.selectProduct = res.data.cartInfo.map(item => {
item.checked = false
return item
})
if (res.data.cartInfo.length === 0) {
uni.showToast({
title: "订单无可售后商品",
icon: 'none',
duration: 2000
});
return
}
uni.hideLoading()
}) })
.catch(err => { .catch(err => {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message, title: err.msg || err.response.data.msg|| err.response.data.message,
icon: 'none', icon: 'none',
@ -108,10 +222,43 @@
this.reasonList = res.data; this.reasonList = res.data;
}); });
}, },
// 退
switchSelect (index) {
let isAll = true
this.selectProduct[index].checked = !this.selectProduct[index].checked
this.selectProduct.forEach(item => {
if (!item.checked) {
isAll = false
}
})
this.isAllSelect = isAll
},
//
allChecked () {
this.isAllSelect = !this.isAllSelect
this.selectProduct.forEach(item => {
item.checked = this.isAllSelect
})
},
// 退
chooseType (val) {
this.selectProduct = this.selectProduct.map(item => {
if (item.checked) {
this.productParamList.push({
productId: item.productId
})
console.log(item.costPrice)
this.totalMoney += parseFloat(item.truePrice)
this.totalNum += 1
return item
}
}).filter(r => r)
this.selected = true;
this.serviceType = val;
},
submit() { submit() {
const refund_reason_wap_explain = trim(this.refund_reason_wap_explain), const refund_reason_wap_explain = trim(this.refund_reason_wap_explain);
text = this.reason; if (!this.reason) {
if (!text) {
uni.showToast({ uni.showToast({
title: "请选择退款原因", title: "请选择退款原因",
icon: 'none', icon: 'none',
@ -119,21 +266,24 @@
}); });
return return
} }
postOrderRefund({ submitAfterSealsOrder({
text, orderCode: this.orderInfo.orderId,
uni: this.orderInfo.orderId, serviceType: this.serviceType,
refund_reason_wap_img: this.refund_reason_wap_img.join(","), reasonForApplication: this.reason,
refund_reason_wap_explain applicationInstructions: refund_reason_wap_explain,
}) applicationDescriptionPicture: this.refund_reason_wap_img.join(","),
.then(res => { productParamList: this.productParamList
}).then(res => {
if (res.status === 200) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "success", icon: "success",
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
this.$yrouter.back(); this.$yrouter.push({ path: '/pages/order/ReturnList/index' });
}, 1500); }, 1500)
}
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
@ -143,11 +293,102 @@
}); });
}); });
} }
},
mounted() {
this.id = this.$yroute.query.id || 0;
this.getOrderDetail();
this.getRefundReason();
} }
}; };
</script> </script>
<style lang="scss" scoped>
.apply-return{
.selectProduct{
margin-bottom: 180rpx;
.selectContainer{
padding: 20rpx 32rpx;
background-color: #FFF;
display: flex;
align-items: center;
.pictrue{
.image{
width: 180rpx;
height: 180rpx;
}
}
.content{
width: 100%;
height: 100%;
margin-left: 16rpx;
font-size: 24rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title{
width: 100%;
height: 80rpx;
text-overflow: ellipsis;
font-size: 28rpx;
}
.skus{
display: flex;
justify-content: space-between;
color: #999999;
}
.money{
margin-top: 10rpx;
display: flex;
view{
color: #EB3729;
}
}
}
}
.choose{
width: 100%;
padding: 20rpx 30rpx;
background-color: #FFF;
position: fixed;
bottom: 0;
height: 180rpx;
.checkTotal{
height: 80rpx;
font-size: 28rpx;
border-bottom: 2rpx solid #F3F4F5;
display: flex;
justify-content: space-between;
align-items: center;
.total{
display: flex;
.proTotal{
color: #666;
}
.moneyTotal{
color: #333;
margin-left: 30rpx;
}
}
}
.typeBtn{
margin-top: 10rpx;
display: flex;
justify-content: flex-end;
align-items: center;
.button{
width: 160rpx;
height: 60rpx;
margin: 0 10rpx;
line-height: 60rpx;
text-align: center;
font-size: 24rpx;
border-radius: 180rpx;
}
.def{
color: #AAAAAA;
border: 2rpx solid #DDDDDD;
}
.redBtn{
color: #FFF;
background-color: #EB3729;
}
}
}
}
}
</style>

39
pages/order/GoodsReturn/productlist.vue

@ -0,0 +1,39 @@
<template>
<view class="productList">
<view class="goodsStyle acea-row row-between"
v-for="cart in list"
:key="cart.id"
>
<view class="pictrue">
<image :src="cart.productInfo.image" class="image" />
</view>
<view class="text acea-row row-between">
<view class="name line2">{{ cart.productInfo.storeName }}</view>
<view class="money">
<view>
{{
cart.productInfo.attrInfo
? cart.productInfo.attrInfo.price
: cart.productInfo.price
}}
</view>
<view class="num">x{{ cart.cartNum }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
list: {
type: Array,
default: () => []
}
}
}
</script>
<style scoped lang="less">
</style>

87
pages/order/OrderDetails/index.vue

@ -4,7 +4,7 @@
<view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''"> <view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''">
<view class="data" :class="refundOrder ? 'on' : ''"> <view class="data" :class="refundOrder ? 'on' : ''">
<view class="state">{{ orderInfo._status._msg }}</view> <view class="state">{{ orderInfo._status._msg }}</view>
<view>{{ orderInfo.createTime }}</view> <view>{{ orderInfo.createTime || '' }}</view>
</view> </view>
</view> </view>
<template v-if="!refundOrder"> <template v-if="!refundOrder">
@ -24,14 +24,18 @@
: 'icon-yuandianxiao', : 'icon-yuandianxiao',
status.type >= 0 ? 'font-color-red' : '' status.type >= 0 ? 'font-color-red' : ''
]"></view> ]"></view>
<view class="line" :class="{ 'bg-color-red': status.type > 0 && status.type != 9 }"></view> <view class="line" :class="{
'bg-color-red': status.type > 0 && status.type != 9
}"></view>
<view class="iconfont" :class="[ <view class="iconfont" :class="[
status.type === 1 ? 'icon-webicon318' : 'icon-yuandianxiao', status.type === 1 ? 'icon-webicon318' : 'icon-yuandianxiao',
status.type >= 1 && status.type != 6 && status.type != 9 status.type >= 1 && status.type != 6 && status.type != 9
? 'font-color-red' ? 'font-color-red'
: '' : ''
]"></view> ]"></view>
<view class="line" :class="{'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9}" <view class="line" :class="{
'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9
}"
v-if="orderInfo.shippingType === 1"></view> v-if="orderInfo.shippingType === 1"></view>
<view class="iconfont" <view class="iconfont"
:class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']" :class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']"
@ -47,8 +51,7 @@
: '' : ''
]"></view> ]"></view>
<view class="line" :class="{ <view class="line" :class="{
'bg-color-red': 'bg-color-red': status.type > 3 && status.type != 6 && status.type != 9
status.type > 3 && status.type != 6 && status.type != 9
}"></view> }"></view>
<view class="iconfont" :class="[ <view class="iconfont" :class="[
status.type == 4 ? 'icon-webicon318' : 'icon-yuandianxiao', status.type == 4 ? 'icon-webicon318' : 'icon-yuandianxiao',
@ -97,7 +100,10 @@
<view class="name"> <view class="name">
{{ orderInfo.realName }} {{ orderInfo.realName }}
<text class="phone">{{ orderInfo.userPhone }}</text> <text class="phone">{{ orderInfo.userPhone }}</text>
<text @click="telPhone(orderInfo.userPhone)" class="iconfont icon-tonghua font-color-red"></text> <text
@click="telPhone(orderInfo.userPhone)"
class="iconfont icon-tonghua font-color-red"
></text>
</view> </view>
<view>{{ orderInfo.userAddress }}</view> <view>{{ orderInfo.userAddress }}</view>
</view> </view>
@ -105,7 +111,8 @@
<div class="name"> <div class="name">
{{ system_store.name}} {{ system_store.name}}
<span class="phone">{{ system_store.phone }}</span> <span class="phone">{{ system_store.phone }}</span>
<span @click="telPhone(system_store.phone)" class="iconfont icon-tonghua font-color-red" <span @click="telPhone(system_store.phone)"
class="iconfont icon-tonghua font-color-red"
:href="'tel:' + system_store.phone"></span> :href="'tel:' + system_store.phone"></span>
</div> </div>
<div>{{ system_store.address }}</div> <div>{{ system_store.address }}</div>
@ -114,12 +121,16 @@
<image :src="`${$VUE_APP_RESOURCES_URL}/images/line.jpg`" /> <image :src="`${$VUE_APP_RESOURCES_URL}/images/line.jpg`" />
</view> </view>
</template> </template>
<OrderGoods :evaluate="status.type || 0" :isIntegral="isIntegral" :cartInfo="orderInfo.cartInfo || []"></OrderGoods> <OrderGoods
:evaluate="status.type || 0"
:isIntegral="isIntegral"
:cartInfo="orderInfo.cartInfo || []"
></OrderGoods>
<view class="wrapper"> <view class="wrapper">
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>订单编号</view> <view>订单编号</view>
<view class="conter acea-row row-middle row-right"> <view class="conter acea-row row-middle row-right">
{{ orderInfo.orderId }} {{ orderInfo.orderId || '' }}
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<text class="copy copy-data" @click="copyClipboard(orderInfo.orderId)">复制</text> <text class="copy copy-data" @click="copyClipboard(orderInfo.orderId)">复制</text>
<!-- #endif --> <!-- #endif -->
@ -127,11 +138,11 @@
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>下单时间</view> <view>下单时间</view>
<view class="conter">{{ orderInfo.createTime }}</view> <view class="conter">{{ orderInfo.createTime || '' }}</view>
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>订单类型</view> <view>订单类型</view>
<view class="conter">{{ orderTypeName }}</view> <view class="conter">{{ orderTypeName || '' }}</view>
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>支付状态</view> <view>支付状态</view>
@ -139,11 +150,11 @@
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>支付方式</view> <view>支付方式</view>
<view class="conter">{{ orderInfo._status._payType }}</view> <view class="conter">{{ orderInfo._status._payType || '' }}</view>
</view> </view>
<view class="item acea-row row-between" v-if="orderInfo.mark"> <view class="item acea-row row-between" v-if="orderInfo.mark">
<view>买家留言</view> <view>买家留言</view>
<view class="conter">{{ orderInfo.mark }}</view> <view class="conter">{{ orderInfo.mark || '' }}</view>
</view> </view>
</view> </view>
@ -185,42 +196,42 @@
<view class="wrapper" v-if="refundOrder"> <view class="wrapper" v-if="refundOrder">
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>收货人</view> <view>收货人</view>
<view class="conter">{{ orderInfo.realName }}</view> <view class="conter">{{ orderInfo.realName || '' }}</view>
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>联系电话</view> <view>联系电话</view>
<view class="conter">{{ orderInfo.userPhone }}</view> <view class="conter">{{ orderInfo.userPhone || '' }}</view>
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>收货地址</view> <view>收货地址</view>
<view class="conter">{{ orderInfo.userAddress }}</view> <view class="conter">{{ orderInfo.userAddress || '' }}</view>
</view> </view>
</view> </view>
<view class="wrapper"> <view class="wrapper">
<view class="item acea-row row-between" v-if="!isIntegral"> <view class="item acea-row row-between" v-if="!isIntegral">
<view>支付金额</view> <view>支付金额</view>
<view class="conter">{{ orderInfo.totalPrice }}</view> <view class="conter">{{ orderInfo.totalPrice || 0 }}</view>
</view> </view>
<view class="item acea-row row-between" v-if="isIntegral"> <view class="item acea-row row-between" v-if="isIntegral">
<view>支付积分</view> <view>支付积分</view>
<view class="conter">{{ orderInfo.payIntegral }}积分</view> <view class="conter">{{ orderInfo.payIntegral || 0 }}积分</view>
</view> </view>
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0"> <view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
<view>优惠券抵扣</view> <view>优惠券抵扣</view>
<view class="conter">-{{ orderInfo.couponPrice }}</view> <view class="conter">-{{ orderInfo.couponPrice ||0 }}</view>
</view> </view>
<view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0"> <view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0">
<view>积分抵扣</view> <view>积分抵扣</view>
<view class="conter">-{{ orderInfo.deductionPrice }}</view> <view class="conter">-{{ orderInfo.deductionPrice || 0 }}</view>
</view> </view>
<view class="item acea-row row-between" v-if="orderInfo.payPostage > 0"> <view class="item acea-row row-between" v-if="orderInfo.payPostage > 0">
<view>运费</view> <view>运费</view>
<view class="conter">{{ orderInfo.payPostage }}</view> <view class="conter">{{ orderInfo.payPostage || 0 }}</view>
</view> </view>
<view class="actualPay acea-row row-right"> <view class="actualPay acea-row row-right">
实付款 实付款
<text class="money font-color-red" v-if="!isIntegral">{{ orderInfo.payPrice }}</text> <text class="money font-color-red" v-if="!isIntegral">{{ orderInfo.payPrice || 0 }}</text>
<text class="money font-color-red" v-if="isIntegral">{{ orderInfo.payIntegral }}积分</text> <text class="money font-color-red" v-if="isIntegral">{{ orderInfo.payIntegral || 0 }}积分</text>
</view> </view>
</view> </view>
<view style="height:100rpx;" v-if="!refundOrder && offlineStatus"></view> <view style="height:100rpx;" v-if="!refundOrder && offlineStatus"></view>
@ -229,13 +240,19 @@
<view class="bnt cancel" @click="cancelOrder">取消订单</view> <view class="bnt cancel" @click="cancelOrder">取消订单</view>
<view class="bnt bg-color-red" @click="pay = true">立即付款</view> <view class="bnt bg-color-red" @click="pay = true">立即付款</view>
</template> </template>
<template v-if="status.type == 1"> <template v-if="orderInfo.refundStatus === 0 && orderInfo.paid === 1">
<view class="bnt cancel" @click="goGoodsReturn(orderInfo)">申请退款</view> <view class="bnt cancel" @click="goGoodsReturn(orderInfo)">申请售后</view>
</template> </template>
<!-- --> <!-- -->
<template v-if="orderInfo.shippingType == 1 && status.type == 2"> <template v-if="orderInfo.shippingType == 1 && status.type == 2">
<view class="bnt default" <view class="bnt default"
@click="$yrouter.push({ path: '/pages/order/Logistics/index' ,query:{id:orderInfo.orderId }})">查看物流</view> @click="$yrouter.push({
path: '/pages/order/Logistics/index',
query:{
id:orderInfo.orderId
}
})"
>查看物流</view>
<view class="bnt bg-color-red" @click="takeOrder">确认收货</view> <view class="bnt bg-color-red" @click="takeOrder">确认收货</view>
</template> </template>
<template v-if="orderInfo.shippingType == 1 && status.type == 3 && orderInfo.deliveryType == 'express'"> <template v-if="orderInfo.shippingType == 1 && status.type == 3 && orderInfo.deliveryType == 'express'">
@ -252,10 +269,20 @@
<view class="bnt bg-color-red" @click="goGroupRule(orderInfo)">查看拼团</view> <view class="bnt bg-color-red" @click="goGroupRule(orderInfo)">查看拼团</view>
</template> </template>
</view> </view>
<Payment v-model="pay" :types="payType" @checked="toPay" :balance="userInfo.nowMoney"></Payment> <Payment
v-model="pay"
:types="payType"
@checked="toPay"
:balance="userInfo.nowMoney"
></Payment>
<view class="geoPage" v-if="mapShow"> <view class="geoPage" v-if="mapShow">
<iframe width="100%" height="100%" frameborder="0" scrolling="no" <iframe
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' + system_store.latitude + ',' +system_store.longitude +'&referer=' +mapKey"></iframe> width="100%"
height="100%"
frameborder="0"
scrolling="no"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' + system_store.latitude + ',' +system_store.longitude +'&referer=' +mapKey"
></iframe>
</view> </view>
</view> </view>
</template> </template>
@ -325,6 +352,7 @@
}, },
methods: { methods: {
copyClipboard, copyClipboard,
// 退
goGoodsReturn(orderInfo) { goGoodsReturn(orderInfo) {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/order/GoodsReturn/index", path: "/pages/order/GoodsReturn/index",
@ -494,7 +522,6 @@
}, },
async toPay(type) { async toPay(type) {
var that = this; var that = this;
console.log(type, "支付方式");
await payOrderHandle(this.orderInfo.orderId, type, that.from); await payOrderHandle(this.orderInfo.orderId, type, that.from);
that.getDetail(); that.getDetail();
}, },

334
pages/order/OrderReturnDetail/index.vue

@ -0,0 +1,334 @@
<template>
<view class="returnList">
<view class="data bgRed">
<view v-if="orderDetail.salesState === 0">
<view class="state" v-if="orderDetail.state === 0">
已提交申请请耐心等待卖家处理
</view>
<view class="state" v-if="orderDetail.state === 1">
<view class="state" v-if="orderDetail.serviceType === 0">
已通过平台审核,正在退款
</view>
<view class="state" v-if="orderDetail.serviceType === 1">
已通过平台审核 ,请填写退货物流
</view>
</view>
<view class="state" v-if="orderDetail.state === 2">
已发货等待商家审核
</view>
<view class="state" v-if="orderDetail.state === 3">
售后订单已完成
</view>
</view>
<view v-if="orderDetail.salesState === 1">
已撤销售后订单
</view>
<view v-if="orderDetail.salesState === 2">
商家已拒绝售后申请
</view>
</view>
<!-- 退款总金额 -->
<view class="money">
<view class="top">
<text>退款总金额</text>
<text class="colorRed">{{ orderDetail.refundAmount || 0}}</text>
</view>
<view class="express" v-if="orderDetail.serviceType === 1">
<view class="title">商家已同意退货申请请尽快发货</view>
<view class="info people">
收货人 {{ orderDetail.consignee || '' }}
</view>
<view class="info address">
收货地址 {{ orderDetail.address || '' }}
</view>
<view class="info phone">
收货电话 {{ orderDetail.phoneNumber || '' }}
</view>
</view>
<!-- 退款信息 -->
<view class="tips" v-if="orderDetail.state === 0">
<text class="title">您已成功发起退款申请请耐心等待商家处理</text>
<view class="content">
<view>· 卖家同意或超时未处理系统将退款给您</view>
<view>· 如果卖家拒绝您可以修改退款申请后再次发起卖家会重新处理</view>
</view>
</view>
<!-- 撤销 -->
<!-- <view class="tips" v-if="orderDetail.serviceType === 1 && orderDetail.state >= 2">
<text class="title">您已撤销售后申请</text>
<view class="content">
<view>· </view>
<view>· </view>
</view>
</view> -->
<!-- 商家拒接 -->
<!-- <view class="tips" v-if="orderDetail.serviceType === 2 && orderDetail.state >= 2">
<text class="title">卖家已拒绝</text>
<view class="content">
<view>· </view>
<view>· </view>
</view>
</view> -->
<view class="bottom">
<view class="btns redBtn"
v-if="orderDetail.salesState === 0
&& orderDetail.serviceType === 1
&& orderDetail.state === 1"
@click="toExpress"
>填写物流</view>
<view class="btns def"
v-if="orderDetail.salesState === 0"
@click="cancelReq"
>撤销申请</view>
<!-- <view class="btns redBtn" @click="editReq">修改申请</view>-->
</view>
</view>
<!-- 退款信息 -->
<view class="rebackInfo">
<view class="top">
退款信息
</view>
<view class="rebackItem"
v-for="item in orderDetail.cartInfo"
:key="item.id"
>
<image class="img" :src="item.productInfo.image" mode=""></image>
<view class="info">
<view class="productName">
{{ item.productInfo.storeName }}
</view>
<view class="sku">
{{ item.productInfo.attrInfo.sku }}
</view>
</view>
</view>
<view class="bottom">
<view class="reason">
<view class="left">
退款原因:
</view>
<view class="right">
{{ orderDetail.reasons || '' }}
</view>
</view>
<view class="reason">
<view class="left">
退款金额:
</view>
<view class="right">
{{ orderDetail.refundAmount || 0 }}
</view>
</view>
<view class="reason">
<view class="left">
退款编号:
</view>
<view class="right">
{{ orderDetail.id || '' }}
</view>
</view>
<view class="reason">
<view class="left">
申请时间:
</view>
<view class="right">
{{ orderDetail.createTime || '' }}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import{
getAfterSealsDetail,
rebackAfterSeals
} from '@/api/aftersales.js';
export default {
data() {
return {
orderId: '',
id: '',
orderInfo: {},
orderDetail: {}
}
},
mounted() {
this.orderId = this.$yroute.query.key
this.id = this.$yroute.query.id
this.getReturnDetail()
},
methods: {
/** state售后状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */
async getReturnDetail() {
const res = await getAfterSealsDetail(this.orderId, this.id)
if (res.status === 200) {
this.orderDetail = res.data
} else {
uni.showToast({
title: "订单异常",
icon: "none",
duration: 2000,
});
}
},
toExpress () {
this.$yrouter.push({
path: '/pages/order/submitExpress/index',
query: {
orderCode: this.orderId
}
})
},
//
async cancelReq() {
const res = await rebackAfterSeals(this.orderId, this.id)
if (res.status === 200) {
uni.showToast({
title: "已撤销",
icon: "none",
duration: 2000,
});
setTimeout(() => {
this.$yrouter.back();
}, 1500)
} else {
uni.showToast({
title: "撤销失败",
icon: "none",
duration: 2000,
});
}
},
//
editReq() {}
}
}
</script>
<style scoped lang='scss'>
$red: #EB3729;
.returnList{
.colorRed{
color: $red;
}
.bgRed{
background-color: $red;
}
.data{
width: 100%;
height: 150rpx;
line-height: 150rpx;
padding-left: 30rpx;
color: #FFF;
}
.money{
background-color: #FFF;
.top{
padding: 20rpx 30rpx;
font-size: 30rpx;
display: flex;
justify-content: space-between;
border-bottom: 2rpx solid #F3F4F5;
}
.express{
padding: 20rpx 30rpx;
font-size: 26rpx;
.title{
color: #333333;
}
.info{
color: #999999;
}
}
.tips{
height: 160rpx;
padding: 20rpx 30rpx;
color: #999999;
border-bottom: 2rpx solid #F3F4F5;
font-size: 26rpx;
.title{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.content{
font-size: 20rpx;
}
}
.bottom{
padding: 20rpx 30rpx;
display: flex;
justify-content: flex-end;
.btns{
width: 160rpx;
height: 58rpx;
margin: 0 10rpx;
font-size: 24rpx;
text-align: center;
line-height: 58rpx;
border-radius: 180rpx;
}
.def{
color: #DDDDDD;
border: 2rpx solid #DDDDDD;
}
.redBtn{
color: #FFF;
background-color: $red;
}
}
}
.rebackInfo{
padding: 0 30rpx;
background-color: #FFF;
.top{
height: 80rpx;
margin: 20rpx 0;
line-height: 80rpx;
font-size: 30rpx;
font-weight: bold;
color: #333333;
border-bottom: 2rpx solid #F3F4F5;
}
.rebackItem{
padding: 20rpx 0;
font-size: 28rpx;
display: flex;
border-bottom: 2rpx solid #F3F4F5;
.img{
width: 120rpx;
height: 120rpx;
}
.info{
margin-left: 16rpx;
flex: 1;
.productName{
width: 100%;
height: 80rpx;
overflow: hidden;
text-overflow: ellipsis;
color: #333333;
}
.sku{
font-size: 24rpx;
color: #CCCCCC;
}
}
}
.bottom{
padding: 20rpx 0;
.reason{
font-size: 28rpx;
color: #333333;
display: flex;
justify-content: space-between;
.right{
color: #AAAAAA;
}
}
}
}
}
</style>

37
pages/order/OrderSubmission/index.vue

@ -21,23 +21,23 @@
</view> </view>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
<div class="address acea-row row-between-wrapper" v-if="shipping_type === 1" @click="showStoreList"> <view class="address acea-row row-between-wrapper" v-if="shipping_type === 1" @click="showStoreList">
<div class="addressCon" v-if="storeItems"> <view class="addressCon" v-if="storeItems">
<div class="name"> <view class="name">
{{ storeItems.name }} {{ storeItems.name }}
<span class="phone">{{ storeItems.phone }}</span> <span class="phone">{{ storeItems.phone }}</span>
</div> </view>
<div>{{ storeItems.address }}</div> <view>{{ storeItems.address }}</view>
</div> </view>
<div class="addressCon" v-else> <view class="addressCon" v-else>
<div class="name"> <view class="name">
{{ systemStore.name }} {{ systemStore.name }}
<span class="phone">{{ systemStore.phone }}</span> <span class="phone">{{ systemStore.phone }}</span>
</div> </view>
<div>{{ systemStore.address }}</div> <view>{{ systemStore.address }}</view>
</div> </view>
<div class="iconfont icon-jiantou"></div> <view class="iconfont icon-jiantou"></view>
</div> </view>
<view class="line"> <view class="line">
<image :src="`${$VUE_APP_RESOURCES_URL}/images/line.jpg`" /> <image :src="`${$VUE_APP_RESOURCES_URL}/images/line.jpg`" />
</view> </view>
@ -312,9 +312,9 @@ export default {
}, },
onLoad: function() { onLoad: function() {
let that = this let that = this
console.log('loadddddddd')
this.$store.dispatch('getUser', true) this.$store.dispatch('getUser', true)
that.getCartInfo() that.getCartInfo()
console.log(that.$yroute) console.log(that.$yroute)
if (that.$yroute.query.pinkid !== undefined) { if (that.$yroute.query.pinkid !== undefined) {
that.pinkId = that.$yroute.query.pinkid that.pinkId = that.$yroute.query.pinkid
@ -355,6 +355,7 @@ export default {
} }
this.useIntegral = e.mp.detail.value[0] this.useIntegral = e.mp.detail.value[0]
}, },
//
computedPrice() { computedPrice() {
let shipping_type = this.shipping_type let shipping_type = this.shipping_type
postOrderComputed(this.orderGroupInfo.orderKey, { postOrderComputed(this.orderGroupInfo.orderKey, {
@ -377,7 +378,11 @@ export default {
}) })
}, },
getCartInfo() { getCartInfo() {
const cartIds = this.$yroute.query.id let cartIds = this.$yroute.query.id
// id
if (this.$yroute.query.pinkId) {
cartIds = this.$yroute.query.pinkId
}
if (!cartIds) { if (!cartIds) {
uni.showToast({ uni.showToast({
title: '参数有误', title: '参数有误',
@ -388,8 +393,6 @@ export default {
} }
postOrderConfirm(cartIds) postOrderConfirm(cartIds)
.then(res => { .then(res => {
console.log(res, 999999)
console.log(res.data.systemStore || {}, 999999)
this.offlinePayStatus = res.data.offline_pay_status this.offlinePayStatus = res.data.offline_pay_status
this.orderGroupInfo = res.data this.orderGroupInfo = res.data
this.deduction = res.data.deduction this.deduction = res.data.deduction

128
pages/order/ReturnList/index.vue

@ -1,37 +1,24 @@
<template> <template>
<view class="return-list" ref="container"> <view class="return-list" ref="container">
<view class="goodWrapper" v-for="(order,orderListIndex) in orderList" :key="orderListIndex"> <!-- 分类查询 -->
<view class="iconfont icon-tuikuanzhong powder" v-if="order._status._type === -1"></view> <view class="nav">
<view class="iconfont icon-yituikuan" v-if="order._status._type === -2"></view> <view class="item" :class="{ on: listQuery.type === 0 }" @click="changeType(0)">
<view class="orderNum">订单号{{ order.orderId }}</view> <view>全部</view>
<view
class="item acea-row row-between-wrapper"
v-for="(cart,cartInfoIndex) in order.cartInfo"
:key="cartInfoIndex"
@click="goOrderDetails(order)"
>
<view class="pictrue">
<image :src="cart.productInfo.image" class="image" @click.stop="goGoodsCon(cart)" />
</view>
<view class="text">
<view class="acea-row row-between-wrapper">
<view class="name line1">{{ cart.productInfo.storeName }}</view>
<view class="num">x {{ cart.cartNum }}</view>
</view> </view>
<view <view class="item" :class="{ on: listQuery.type === 1 }" @click="changeType(1)">
class="attr line1" <view>售后中</view>
v-if="cart.productInfo.attrInfo"
>{{ cart.productInfo.attrInfo.sku }}</view>
<view class="attr line1" v-else>{{ cart.productInfo.storeName }}</view>
<view class="money">{{ cart.productInfo.price }}</view>
</view> </view>
<view class="item" :class="{ on: listQuery.type === 2 }" @click="changeType(2)">
<view>已完成</view>
</view> </view>
<view class="totalSum">
{{ order.cartInfo.length || 0 }}件商品总金额
<text
class="font-color-red price"
>{{ order.payPrice }}</text>
</view> </view>
<!-- 商品列表 -->
<view class="list">
<ListItem
v-for="(item,index) in orderList"
:key="index"
:item="item"
/>
</view> </view>
<view class="noCart" v-if="orderList.length === 0 && page > 1"> <view class="noCart" v-if="orderList.length === 0 && page > 1">
<view class="pictrue"> <view class="pictrue">
@ -44,56 +31,81 @@
<script> <script>
import { getOrderList } from "@/api/order"; import { getOrderList } from "@/api/order";
import { getAfterSealsList } from "@/api/aftersales.js";
import Loading from "@/components/Loading"; import Loading from "@/components/Loading";
import ListItem from './listItem.vue'
export default { export default {
name: "ReturnList", name: "ReturnList",
components: { components: {
Loading Loading,
ListItem
}, },
data() { data() {
return { return {
orderList: [], orderList: [],
listQuery: {
page: 1, page: 1,
limit: 20, limit: 5,
type: 0
},
type: 0,
loading: false, loading: false,
loaded: false loaded: false
}; };
}, },
methods: { mounted() {
goGoodsCon(cart) { this.getOrderList();
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: { id: cart.productInfo.id }
});
}, },
goOrderDetails(order) { onReachBottom() {
this.$yrouter.push({ !this.loading && this.getOrderList();
path: "/pages/order/OrderDetails/index",
query: { id: order.orderId }
});
}, },
methods: {
//
getOrderList() { getOrderList() {
const { page, limit } = this; if ((this.loading || this.loaded) && (this.type === this.listQuery.type)) return;
if (this.loading || this.loaded) return;
this.loading = true; this.loading = true;
getOrderList({ //
page, getAfterSealsList(this.listQuery).then(res => {
limit, // console.log(res)
type: -3 if (this.type === this.listQuery.type) {
}).then(res => { this.orderList = [...this.orderList, ...res.data];
this.orderList = this.orderList.concat(res.data); } else {
this.loading = false; this.orderList = res.data;
this.loaded = res.data.length < limit; this.type = this.listQuery.type
this.page++;
});
} }
this.listQuery.page++;
//
this.loading = false;
this.loaded = res.data.length < this.listQuery.limit;//
})
}, },
mounted() { //
this.getOrderList(); changeType (type) {
}, this.listQuery.type = type
onReachBottom() { this.listQuery.page = 1;
!this.loading && this.getOrderList(); this.getOrderList()
}
} }
}; };
</script> </script>
<style scoped lang="scss">
.return-list{
.nav{
background-color: #FFF;
display: flex;
justify-content: space-around;
.item{
height: 80rpx;
line-height: 80rpx;
font-size: 14px;
font-family: PingFang SC;
color: #333333;
}
.on{
border-bottom: 6rpx solid #EB3729;
}
}
}
</style>

184
pages/order/ReturnList/listItem.vue

@ -0,0 +1,184 @@
<!-- 售后列表内容 -->
<template>
<view class="productItem">
<view class="title">
<view class="shopName">
订单号{{ item.orderCode }}
</view>
</view>
<view class="content" v-for="(i, index) in item.cartInfo">
<image class="img"
:src="i.productInfo.image"
mode=""
@click.stop="goGoodsCon(i)"
></image>
<view class="info">
<view class="infoTitle">
{{ i.productInfo.storeName }}
</view>
<view class="infoSku">
<view class="sku">
{{ i.productInfo.attrInfo.sku || '' }}
</view>
<view class="num">
x {{ 1 }}
</view>
</view>
<view class="infoMoney">
退款<view class="red">
{{ i.productInfo.price }}
</view>
</view>
</view>
</view>
<view class="money">
<view class="status">
<view v-if="item.salesState === 0">
<view v-if="item.state === 0">商家处理中</view>
<view v-if="item.state === 1">售后中</view>
<view v-if="item.state === 2">等待商家收货</view>
<view v-if="item.state === 3">已完成</view>
</view>
<view v-if="item.salesState === 1">
已撤销
</view>
<view v-if="item.salesState === 2">
商家拒绝
</view>
</view>
<view class="refundMoney">
退款<view class="red">
{{ item.refundAmount }}
</view>
</view>
</view>
<view class="btns">
<view class="button def"
@click="toDetail"
v-if="item.state === 2"
>删除记录</view>
<view class="button redBtn" @click="toDetail(item)">查看详情</view>
</view>
</view>
</template>
<script>
import {
deleteAfterSeals
} from '@/api/aftersales.js'
export default {
props: {
item: {
type: Object,
default: () => ({})
}
},
methods:{
//
goGoodsCon(item) {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: { id: item.productInfo.id }
});
},
//
toDetail (item) {
console.log(item)
this.$yrouter.push({
path: "/pages/order/OrderReturnDetail/index",
query: {
key: item.orderCode,
id: item.id
}
});
}
}
}
</script>
<style lang="scss" scoped>
.productItem{
margin: 10rpx 0;
background-color: #FFF;
.title{
height: 80rpx;
padding: 0 30rpx;
color: #333;
font-size: 28rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.content{
padding: 20rpx 30rpx;
border: 2rpx solid #F3F4F5;
display: flex;
.img{
width: 180rpx;
height: 180rpx;
}
.info{
flex: 1;
margin-left: 16rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
.infoTitle{
width: 100%;
height: 80rpx;
font-size: 28rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
}
.infoSku{
font-size: 24rpx;
color: #999999;
display: flex;
justify-content: space-between;
}
.infoMoney{
font-size: 24rpx;
}
}
}
.money{
height: 80rpx;
padding: 0 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
color: #333333;
border: 2rpx solid #F3F4F5;
display: flex;
justify-content: space-between;
align-items: center;
}
.btns{
padding: 20rpx 30rpx;
display: flex;
justify-content: flex-end;
.button{
width: 160rpx;
height: 58rpx;
margin: 0 10rpx;
border-radius: 180rpx;
font-size: 24rpx;
line-height: 54rpx;
text-align: center;
}
.def{
color: #DDD;
border: 2rpx solid #DDDDDD;
}
.redBtn{
color: #FFF;
background-color: #EB3729;
border: 2rpx solid #EB3729;
}
}
.red{
display: inline-block;
color: #EB3729;
}
}
</style>

174
pages/order/submitExpress/index.vue

@ -0,0 +1,174 @@
<!-- 提交物流 -->
<template>
<view class="submitExpress">
<!-- 填写物流 -->
<view class="form">
<picker class="picker"
:value="express"
:range="expressPicker"
@change="changeExpress"
>
<view class="item acea-row row-between-wrapper">
<view class="title">
<view class="point">
*
</view>
物流公司
</view>
<view class="num">{{ express }}</view>
<text class="iconfont icon-jiantou"></text>
</view>
</picker>
<view class="item">
<view class="title">
<view class="point">
*
</view>
物流单号:
</view>
<input class="input" v-model="expressQuery.postalCode" placeholder="请输入物流单号" />
</view>
</view>
<!-- 提交按钮 -->
<view class="btnContainer">
<view class="addBtn" @click="addExpress">
提交
</view>
</view>
</view>
</template>
<script>
import {
getExpressData,
addExpressData
} from '@/api/aftersales.js'
export default {
data () {
return {
expressQuery: {
code: '', //
name: '', //
postalCode: 'SF1213132132', //
orderCode: '' //
},
expressList: [],
expressPicker: [],
express: ''
}
},
mounted () {
this.expressQuery.orderCode = this.$yroute.query.orderCode
this.getExpress()
},
methods: {
async getExpress () {
const res = await getExpressData()
console.log(res)
this.expressList = res.data.map(item => {
return {
id: item.id,
name: item.name,
code: item.code
}
})
this.expressPicker = res.data.map(item => {
return item.name
})
},
changeExpress(e) {
this.express = this.expressPicker[e.mp.detail.value];
this.expressQuery.code = this.expressList[e.mp.detail.value].code
this.expressQuery.name = this.expressList[e.mp.detail.value].name
},
async addExpress () {
let errMsg = '请选择'
if (!this.expressQuery.code || !this.expressQuery.code) {
errMsg += ' 快递公司 '
}
if (!this.expressQuery.postalCode) {
errMsg += ' 快递单号 '
}
if (errMsg.length > 3) {
uni.showToast({
title: errMsg,
icon: 'none',
duration: 2000,
})
}
console.log(this.expressQuery)
const res = await addExpressData(this.expressQuery)
if (res.status === 200) {
uni.showToast({
title: '物流填写成功!',
icon: 'none',
duration: 2000,
})
this.$yrouter.push({
path: '/pages/order/ReturnList/index'
})
} else {
uni.showToast({
title: '提交物流信息失败!',
icon: 'none',
duration: 2000,
})
}
}
}
}
</script>
<style lang="scss" scoped>
.submitExpress{
.form{
margin-bottom: 170rpx;
.picker{
margin: 0;
padding: 0;
font-size: 28rpx;
color: #999999;
}
.item{
width: 100%;
height: 80rpx;
padding: 0 32rpx;
line-height: 80rpx;
background-color: #FFF;
display: flex;
.title{
font-size: 28rpx;
color: #333333;
display: flex;
.point{
color: #EA3729;
}
}
.input{
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
color: #999999;
}
}
}
.btnContainer{
width: 100%;
height: 170rpx;
background-color: #FFF;
box-shadow: 0px 0px 0px rgba(197, 202, 207, 0.5);
position: fixed;
bottom: 0;
.addBtn{
height: 90rpx;
margin: 40rpx 30rpx;
line-height: 90rpx;
text-align: center;
border-radius: 50rpx;
font-size: 28rpx;
color: #FFF;
background: linear-gradient(90deg, #E93526 0%, #FF8E3C 100%);
}
}
}
</style>

6
pages/orderAdmin/AdminOrderList/index.vue

@ -62,7 +62,11 @@
</view> </view>
</view> </view>
<Loading :loaded="loaded" :loading="loading"></Loading> <Loading :loaded="loaded" :loading="loading"></Loading>
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice" <PriceChange
:change="change"
:orderInfo="orderInfo"
v-on:closechange="changeclose($event)"
v-on:savePrice="savePrice"
:status="status"></PriceChange> :status="status"></PriceChange>
</view> </view>
</template> </template>

49
pages/shop/EvaluateList/index.vue

@ -72,37 +72,34 @@ export default {
!this.loading && this.getProductReplyList(); !this.loading && this.getProductReplyList();
}, },
methods: { methods: {
getProductReplyCount: function() { getProductReplyCount () {
let that = this; getReplyConfig(this.product_id).then(res => {
getReplyConfig(that.product_id).then(res => { this.$set(that, "replyData", res.data);
that.$set(that, "replyData", res.data); this.navList[0].num = res.data.sumCount;
that.navList[0].num = res.data.sumCount; this.navList[1].num = res.data.goodCount;
that.navList[1].num = res.data.goodCount; this.navList[2].num = res.data.inCount;
that.navList[2].num = res.data.inCount; this.navList[3].num = res.data.poorCount;
that.navList[3].num = res.data.poorCount;
}); });
}, },
getProductReplyList: function() { getProductReplyList () {
let that = this; if (this.loading) return; //false
if (that.loading) return; //false if (this.loadend) return; //false
if (that.loadend) return; //false this.loading = true;
that.loading = true; let q = { page: this.page, limit: this.limit, type: this.currentActive };
let q = { page: that.page, limit: that.limit, type: that.currentActive }; getReplyList(this.product_id, q).then(res => {
getReplyList(that.product_id, q).then(res => { this.loading = false;
that.loading = false;
//apply();js; //apply();js;
that.reply.push.apply(that.reply, res.data); this.reply.push.apply(this.reply, res.data);
that.loadend = res.data.length < that.limit; // this.loadend = res.data.length < this.limit; //
that.page = that.page + 1; this.page = this.page + 1;
}); });
}, },
changeType: function(index) { changeType (index) {
let that = this; this.currentActive = index;
that.currentActive = index; this.page = 1;
that.page = 1; this.loadend = false;
that.loadend = false; this.$set(this, "reply", []);
that.$set(that, "reply", []); this.getProductReplyList();
that.getProductReplyList();
} }
} }
}; };

53
pages/shop/GoodsList/index.vue

@ -108,7 +108,7 @@ export default {
nows: false, nows: false,
recommendLoading: false, recommendLoading: false,
target: false, target: false,
isIntegral: false, isIntegral: false
} }
}, },
watch: { watch: {
@ -189,18 +189,19 @@ export default {
this.stock = 0 this.stock = 0
// this.getProductList(); // this.getProductList();
} }
let q = that.where let q = this.where
let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral
getData(q).then(res => { getData(q).then(res => {
that.loading = false this.loading = false
if (that.target) { if (this.target) {
that.productList = res.data this.productList = res.data
this.target = false
} else { } else {
that.productList.push.apply(that.productList, res.data) this.productList.push.apply(this.productList, res.data)
} }
that.target = false console.log(this.target)
that.loadend = res.data.length < that.where.limit // this.loadend = res.data.length < this.where.limit //
that.where.page = that.where.page + 1 this.where.page = this.where.page + 1
}) })
}, },
submitForm: function() { submitForm: function() {
@ -248,27 +249,25 @@ export default {
that.getProductList() that.getProductList()
}, },
//where //where
setWhere: function() { setWhere() {
let that = this if (this.price === 0) {
if (that.price === 0) { this.where.priceOrder = ''
that.where.priceOrder = '' } else if (this.price === 1) {
} else if (that.price === 1) { this.where.priceOrder = 'asc'
that.where.priceOrder = 'asc' } else if (this.price === 2) {
} else if (that.price === 2) { this.where.priceOrder = 'desc'
that.where.priceOrder = 'desc'
} }
if (that.stock === 0) { if (this.stock === 0) {
that.where.salesOrder = '' this.where.salesOrder = ''
} else if (that.stock === 1) { } else if (this.stock === 1) {
that.where.salesOrder = 'asc' this.where.salesOrder = 'asc'
} else if (that.stock === 2) { } else if (this.stock === 2) {
that.where.salesOrder = 'desc' this.where.salesOrder = 'desc'
} }
that.where.news = that.nows ? '1' : '0' this.where.news = this.nows ? '1' : '0'
}, },
switchTap: function() { switchTap() {
let that = this this.Switch = !this.Switch
that.Switch = !that.Switch
}, },
}, },
} }

4
pages/shop/ShoppingCart/index.vue

@ -520,5 +520,9 @@
} }
.shoppingCart{ .shoppingCart{
position: relative; position: relative;
.list{
margin-top: 150rpx;
padding-top: 15rpx;
}
} }
</style> </style>

53
pages/user/ChangePassword/index.vue

@ -1,8 +1,11 @@
<template> <template>
<view class="ChangePassword"> <view class="ChangePassword">
<view class="phone"> <!-- <view class="phone">
当前手机号: 当前手机号:
<input type="text" v-model="phone" disabled /> <input type="text" v-model="phone" disabled />
</view> -->
<view class="title">
通过手机号来修改密码
</view> </view>
<view class="list"> <view class="list">
<view class="item"> <view class="item">
@ -13,18 +16,13 @@
</view> </view>
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code font-color-red" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button> <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
</view> </view>
</view> </view>
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view> <view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
</view> </view>
</template> </template>
<style scoped lang="less">
.ChangePassword .phone input {
width: 2 * 100rpx;
text-align: center;
}
</style>
<script> <script>
// import { mapGetters } from "vuex"; // import { mapGetters } from "vuex";
import sendVerifyCode from '@/mixins/SendVerifyCode' import sendVerifyCode from '@/mixins/SendVerifyCode'
@ -89,8 +87,19 @@ export default {
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}) })
this.$yrouter.replace({
// that.$yrouter.push({ path: "/pages/user/Login/index" }); path: "/pages/user/Login/index",
query: {},
});
// getLogout()
// .then((res) => {
// this.$store.commit("logout");
// this.$yrouter.replace({
// path: "/pages/user/Login/index",
// query: {},
// });
// })
// .catch((err) => {});
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
@ -133,3 +142,27 @@ export default {
}, },
} }
</script> </script>
<style scoped lang="less">
.ChangePassword {
.title{
margin: 10rpx;
line-height: 80rpx;
}
.list{
width: 100%;
margin: 0;
padding: 0 10%;
background-color: #FFFFFF;
.code{
width: 30%;
text-align: center;
color: #FFFFFF;
background-color: #f35749;
padding: 12rpx;
font-size: 28rpx;
border-radius: 30rpx;
}
}
}
</style>

191
pages/user/Login/index.vue

@ -1,57 +1,58 @@
<template> <template>
<view class="register absolute"> <view class="register absolute">
<view class="whiteBg" v-if="formItem === 1"> <view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row row-between-wrapper"> <view class="title acea-row">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" <view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
@click="navTap(index)" :key="index">{{ item }}</view> @click="navTap(index)" :key="index">{{ item }}</view>
</view> </view>
<!-- 手机号登录 -->
<view class="list" :hidden="current !== 0"> <view class="list" :hidden="current !== 0">
<form @submit.prevent="submit"> <form @submit.prevent="submit">
<view class="item"> <view class="item getPhoneCode">
<view class="acea-row row-between-wrapper"> <view class="phoneInput acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true"> <input type="text" placeholder="输入手机号码"
<use xlink:href="#icon-phone_" /> v-model="account" required/>
</svg>--> </view>
<input type="text" placeholder="输入手机号码" v-model="account" required /> <view class="phoneCode" @click="sendCode">
{{ clockText }}
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="acea-row row-between-wrapper"> <view class="acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true"> <input type="text" placeholder="请输入验证码" v-model="captcha" required />
<use xlink:href="#icon-code_" /> <!-- <input type="password" placeholder="填写登录密码" v-model="password" required /> -->
</svg>-->
<input type="password" placeholder="填写登录密码" v-model="password" required />
</view> </view>
</view> </view>
</form> </form>
</view> </view>
<!-- 账号密码登录 -->
<view class="list" :hidden="current !== 1"> <view class="list" :hidden="current !== 1">
<view class="item"> <view class="item">
<view class="acea-row row-between-wrapper"> <view class="acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input type="text" placeholder="输入手机号码" v-model="account" /> <input type="text" placeholder="输入手机号码" v-model="account" />
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="acea-row row-between-wrapper">
<input type="password" placeholder="输入密码" v-model="password" />
</view>
</view>
<!-- <view class="item">
<view class="align-left"> <view class="align-left">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button> @click="code">{{ text }}</button>
</view> </view>
</view> -->
</view> </view>
</view> <view class="logon" @click="loginMobile" :hidden="current === 1">手机号登录</view>
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view> <view class="logon" @click="submit" :hidden="current !== 1">登录</view>
<view class="logon" @click="submit" :hidden="current === 1">登录</view>
<view class="tip"> <view class="tip">
没有账号? 第一次使用?
<text @click="formItem = 2" class="font-color-red">立即注册</text> <text @click="formItem = 2" class="font-color-red">立即注册</text>
</view> </view>
</view> </view>
<!-- 注册 -->
<view class="whiteBg" v-else> <view class="whiteBg" v-else>
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view class="item on">注册账号</view> <view class="item on">注册账号</view>
@ -133,14 +134,18 @@
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
data: function () { data: function () {
return { return {
navList: ["账号登录"], navList: ["手机号登录", "密码登录"],
// navList: ["",],
current: 0, current: 0,
account: "", account: "",
password: "", password: "",
captcha: "", captcha: "",
inviteCode: "", inviteCode: "",
formItem: 1, formItem: 1,
type: "login" type: "login",
timer: null,
clock: 60,
clockText: '验证码'
}; };
}, },
methods: { methods: {
@ -169,23 +174,33 @@
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e);
} }
loginMobile({ const res = await loginMobile({
phone: that.account, account: that.account,
captcha: that.captcha, captcha: that.captcha,
spread: cookie.get("spread") spread: cookie.get("spread")
}) })
.then(res => { if (res.status === 200) {
var data = res.data; this.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
that.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo(); handleGetUserInfo();
}) } else {
.catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: res.msg || res.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
}); }
// .then(res => {
// that.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
// handleGetUserInfo();
// })
// .catch(err => {
// console.log(err)
// uni.showToast({
// title: err.msg || err.response.data.msg || err.response.data.message,
// icon: "none",
// duration: 2000
// });
// });
}, },
async register() { async register() {
var that = this; var that = this;
@ -242,13 +257,13 @@
}); });
}); });
}, },
//
async code() { async code() {
var that = this;
const { const {
account account
} = that; } = this;
try { try {
await that await this
.$validator({ .$validator({
account: [ account: [
required(required.message("手机号码")), required(required.message("手机号码")),
@ -261,10 +276,52 @@
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e);
} }
if (that.formItem == 2) that.type = "register"; if (this.formItem == 2) this.type = "register";
await registerVerify({ this.showCode()
phone: that.account, },
type: that.type //
async sendCode () {
const {
account
} = this;
try {
await this
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({
account
});
} catch (e) {
return validatorDefaultCatch(e);
}
//
if (this.clock !== 60) {
return
}
this.clock--
this.clockText = `${this.clock}`
this.timer = setInterval(() => {
if (parseInt(this.clock) === 1) {
clearTimeout(this.timer)
this.clock = 60
this.clockText = '获取验证码'
return
}
this.clock--
if (this.clock < 10) this.clock = `0${this.clock}`
this.clockText = `${this.clock}`
}, 1000)
this.showCode()
},
//
showCode() {
return registerVerify({
phone: this.account,
type: this.type
}) })
.then(res => { .then(res => {
uni.showToast({ uni.showToast({
@ -272,7 +329,7 @@
icon: "success", icon: "success",
duration: 2000 duration: 2000
}); });
that.sendCode(); this.sendCode();
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
@ -282,9 +339,7 @@
}); });
}); });
}, },
navTap: function (index) { navTap(index) { this.current = index; },
this.current = index;
},
async submit() { async submit() {
const { const {
account, account,
@ -309,34 +364,48 @@
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e);
} }
//
login({ const res = await login({
username: account, username: account,
password, password,
spread: cookie.get("spread") spread: cookie.get("spread")
}) })
.then(({ if (res.status === 200) {
data this.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
}) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo(); handleGetUserInfo();
// let replace=this.$yroute.query.replace } else {
// if(replace){
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: res.msg || res.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
}); }
} }
} }
}; };
</script> </script>
<style lang="scss">
.register .whiteBg .title .item{
border-bottom: 2px solid;
}
.register .whiteBg .title .item.on{
border-bottom-color: #f35749;
}
.getPhoneCode{
display: flex;
justify-content: space-between;
.phoneInput{
width: 70%;
}
.phoneCode{
width: 30%;
text-align: center;
color: #FFFFFF;
background-color: #f35749;
padding: 12rpx;
font-size: 28rpx;
border-radius: 30rpx;
}
}
</style>

340
pages/user/Login/login.vue

@ -0,0 +1,340 @@
<template>
<view class="register absolute">
<view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
@click="navTap(index)" :key="index">{{ item }}</view>
</view>
<view class="list" :hidden="current !== 0">
<form @submit.prevent="submit">
<view class="item">
<view class="acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input type="text" placeholder="输入手机号码" v-model="account" required />
</view>
</view>
<view class="item">
<view class="acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_" />
</svg>-->
<input type="password" placeholder="填写登录密码" v-model="password" required />
</view>
</view>
</form>
</view>
<view class="list" :hidden="current !== 1">
<view class="item">
<view class="acea-row row-between-wrapper">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input type="text" placeholder="输入手机号码" v-model="account" />
</view>
</view>
<view class="item">
<view class="align-left">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
</view>
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view>
<view class="logon" @click="submit" :hidden="current === 1">登录</view>
<view class="tip">
没有账号?
<text @click="formItem = 2" class="font-color-red">立即注册</text>
</view>
</view>
<!-- 注册 -->
<view class="whiteBg" v-else>
<view class="title acea-row row-between-wrapper">
<view class="item on">注册账号</view>
</view>
<view class="list">
<view class="item">
<view>
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input name="account" type="text" placeholder="输入手机号码" v-model="account" />
</view>
</view>
<view class="item">
<view class="align-left">
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_1" />
</svg>-->
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
<view class="item">
<view>
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-code_" />
</svg>-->
<input name="password" type="password" placeholder="填写您的登录密码" v-model="password" />
</view>
</view>
<!-- #ifndef H5 -->
<view class="item">
<view>
<!-- <svg class="icon" aria-hidden="true">
<use xlink:href="#icon-phone_" />
</svg>-->
<input name="inviteCode" type="text" placeholder="输入邀请码" v-model="inviteCode" />
</view>
</view>
<!-- #endif -->
</view>
<view class="logon" @click="register">注册</view>
<view class="tip">
已有账号?
<text @click="formItem = 1" class="font-color-red">立即登录</text>
</view>
</view>
</view>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import {
login,
loginMobile,
registerVerify,
register
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import {
handleGetUserInfo
} from "@/utils";
const BACK_URL = "login_back_url";
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function () {
return {
navList: ["账号登录", "修改密码"],
current: 0,
account: "",
password: "",
captcha: "",
inviteCode: "",
formItem: 1,
type: "login"
};
},
methods: {
async loginMobile() {
var that = this;
const {
account,
captcha
} = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
})
.validate({
account,
captcha
});
} catch (e) {
return validatorDefaultCatch(e);
}
loginMobile({
phone: that.account,
captcha: that.captcha,
spread: cookie.get("spread")
})
.then(res => {
var data = res.data;
that.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
async register() {
var that = this;
const {
account,
captcha,
password
} = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
})
.validate({
account,
captcha,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
register({
account: that.account,
captcha: that.captcha,
password: that.password,
inviteCode: that.inviteCode,
spread: cookie.get("spread")
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.formItem = 1;
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
async code() {
var that = this;
const {
account
} = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({
account
});
} catch (e) {
return validatorDefaultCatch(e);
}
if (that.formItem == 2) that.type = "register";
await registerVerify({
phone: that.account,
type: that.type
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.sendCode();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
},
navTap: function (index) {
this.current = index;
},
async submit() {
const {
account,
password
} = this;
try {
await this.$validator({
account: [
required(required.message("账号")),
attrs.range([5, 16], attrs.range.message("账号")),
alpha_num(alpha_num.message("账号"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
}).validate({
account,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
login({
username: account,
password,
spread: cookie.get("spread")
})
.then(({ data }) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
}
}
};
</script>

6
pages/user/PersonalData/index.vue

@ -39,11 +39,11 @@
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>手机号</view> <view>手机号</view>
<view class="input"> <view class="input">
<input type="text" v-if="userInfo.phone" v-model="userInfo.phone" /> <!-- <input type="text" v-model="userInfo.phone" placeholder="未绑定"/> -->
<input type="text" v-if="userInfo.phone" v-model="userInfo.phone" placeholder="未绑定"/>
<input type="text" v-else value="未绑定" disabled class="id" /> <input type="text" v-else value="未绑定" disabled class="id" />
</view> </view>
</view> </view>
<!--
<view class="item acea-row row-between-wrapper" @click="goChangePassword()"> <view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view>密码</view> <view>密码</view>
<view class="input acea-row row-between-wrapper"> <view class="input acea-row row-between-wrapper">
@ -51,7 +51,6 @@
<text class="iconfont icon-suozi"></text> <text class="iconfont icon-suozi"></text>
</view> </view>
</view> </view>
-->
</view> </view>
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view> <view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
@ -156,7 +155,6 @@ export default {
}, },
chooseImage() { chooseImage() {
chooseImage((img) => { chooseImage((img) => {
console.log(img);
this.avatar = img; this.avatar = img;
}); });
}, },

127
pages/user/User/index.vue

@ -1,7 +1,11 @@
<template> <template>
<view class="user"> <view class="user">
<view v-if="$store.getters.token || userInfo.uid"> <view v-if="$store.getters.token || userInfo.uid">
<view class="header bg-color-red acea-row row-between-wrapper"> <view class="getUserBaseData header bg-color-red acea-row row-between-wrapper" v-if="!userInfo.avatar && !userInfo.nickname">
<button class="userDataBtn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看用户信息</button>
<button class="userDataBtn" v-else @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看用户信息</button>
</view>
<view class="header bg-color-red acea-row row-between-wrapper" v-else>
<view class="picTxt acea-row row-between-wrapper"> <view class="picTxt acea-row row-between-wrapper">
<view class="pictrue"> <view class="pictrue">
<image :src="userInfo.avatar" /> <image :src="userInfo.avatar" />
@ -19,15 +23,15 @@
<text class="iconfont icon-bianji1"></text> <text class="iconfont icon-bianji1"></text>
</view> </view>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else> <!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
<text>绑定手机号</text> <text>绑定手机号</text>
</button> </button> -->
<!-- #endif --> <!-- #endif -->
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<button class="binding" @click="goBindPhone()" v-else> <!-- <button class="binding" @click="goBindPhone()" v-else>
<text>绑定手机号</text> <text>绑定手机号</text>
</button> </button> -->
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>
@ -60,7 +64,7 @@
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</text> </text>
</view> </view>
<view class="orderState acea-row row-middle"> <view class="orderState acea-row row-middle" v-if="userInfo.orderStatusNum !== undefined || userInfo.orderStatusNum !== null">
<view @click="goMyOrder(0)" class="item"> <view @click="goMyOrder(0)" class="item">
<view class="pictrue"> <view class="pictrue">
<image :src="`${$VUE_APP_RESOURCES_URL}/images/dfk.png`" /> <image :src="`${$VUE_APP_RESOURCES_URL}/images/dfk.png`" />
@ -128,11 +132,11 @@
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex' import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user' import { getUserInfo, getMenuUser, wxappAuth, bindingPhone, wxappBindingPhone, wxappGetUserInfo } from '@/api/user'
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils' import { isWeixin, VUE_APP_RESOURCES_URL, parseQuery, getProvider } from '@/utils'
import cookie from '@/utils/store/cookie'
import SwitchWindow from '@/components/SwitchWindow' import SwitchWindow from '@/components/SwitchWindow'
import Authorization from '@/pages/authorization/index' import Authorization from '@/pages/authorization/index'
import cookie from '@/utils/store/cookie'
const NAME = 'User' const NAME = 'User'
@ -145,14 +149,23 @@ export default {
props: {}, props: {},
data: function() { data: function() {
return { return {
canIUseGetUserProfile: false,
MyMenus: [], MyMenus: [],
switchActive: false, switchActive: false,
isWeixin: false, isWeixin: false,
} }
}, },
computed: mapGetters(['userInfo']), computed: mapGetters(['userInfo']),
onLoad() {
if (wx.getUserProfile) {
this.canIUseGetUserProfile = true
}
},
methods: { methods: {
...mapMutations(['updateAuthorizationPage']), ...mapMutations(['updateAuthorizationPage']),
toLogin() {
this.$yrouter.push('/pages/user/Login/index')
},
goReturnList() { goReturnList() {
this.$yrouter.push('/pages/order/ReturnList/index') this.$yrouter.push('/pages/order/ReturnList/index')
}, },
@ -165,9 +178,7 @@ export default {
}) })
}, },
goBindPhone() { goBindPhone() {
this.$yrouter.push({ this.$yrouter.push('/pages/user/BindingPhone/index')
path: '/pages/user/BindingPhone/index',
})
}, },
goUserCoupon() { goUserCoupon() {
this.$yrouter.push('/pages/user/coupon/UserCoupon/index') this.$yrouter.push('/pages/user/coupon/UserCoupon/index')
@ -179,16 +190,12 @@ export default {
this.$yrouter.push('/pages/user/promotion/UserPromotion/index') this.$yrouter.push('/pages/user/promotion/UserPromotion/index')
}, },
goUserAccount() { goUserAccount() {
this.$yrouter.push({ this.$yrouter.push('/pages/user/UserAccount/index')
path: '/pages/user/UserAccount/index',
})
}, },
goPersonalData() { goPersonalData() {
this.$yrouter.push('/pages/user/PersonalData/index') this.$yrouter.push('/pages/user/PersonalData/index')
}, },
getPhoneNumber: function(e) { getPhoneNumber (e) {
let thit = this
console.log(e)
// //
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') { if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
uni.showLoading({ uni.showLoading({
@ -200,7 +207,7 @@ export default {
}) })
.then(res => { .then(res => {
// this.User(); // this.User();
thit.$store.dispatch('userInfo', true) this.$store.dispatch('userInfo', true)
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
@ -210,7 +217,7 @@ export default {
}) })
.catch(error => { .catch(error => {
uni.hideLoading() uni.hideLoading()
thit.$store.dispatch('userInfo', true) this.$store.dispatch('userInfo', true)
console.log(error) console.log(error)
uni.showToast({ uni.showToast({
title: error.msg || error.response.data.msg || error.response.data.message, title: error.msg || error.response.data.msg || error.response.data.message,
@ -233,7 +240,7 @@ export default {
// }) // })
// .then(res => { // .then(res => {
// // this.User(); // // this.User();
// thit.$store.dispatch("userInfo", true); // this.$store.dispatch("userInfo", true);
// uni.hideLoading(); // uni.hideLoading();
// uni.showToast({ // uni.showToast({
// title: res.msg, // title: res.msg,
@ -243,7 +250,7 @@ export default {
// }) // })
// .catch(error => { // .catch(error => {
// uni.hideLoading(); // uni.hideLoading();
// thit.$store.dispatch("userInfo", true); // this.$store.dispatch("userInfo", true);
// console.log(error); // console.log(error);
// uni.showToast({ // uni.showToast({
// title: error.msg || // title: error.msg ||
@ -272,22 +279,73 @@ export default {
}) })
} }
}, },
changeswitch: function(data) { //
getUserInfo(data) {
if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
uni.showToast({
title: '取消授权',
icon: 'none',
duration: 2000,
})
return
}
},
//
getUserInfoProfile(data) {
wx.getUserProfile({
lang: 'zh_CN',
desc: '需要获取您的信息用来展示',
success: res => {
uni.showLoading({
title: '正在更新信息...',
duration: 2000,
})
getProvider()
.then(provider => { //
if (!provider) {
reject()
}
// code
uni.login({
provider: provider,
success: async loginRes => {
wxappGetUserInfo({
encryptedData: res.encryptedData,
iv: res.iv,
code: loginRes.code, // code
}).then(res => {
if (res.status === 200) {
this.userInfo.avatar = res.data.avatar
this.userInfo.nickname = res.data.nickname
} else {
uni.showLoading({
title: res.msg,
duration: 2000,
})
}
})
}
})
})
}
})
},
changeswitch(data) {
this.switchActive = data this.switchActive = data
}, },
MenuUser: function() { //
let that = this MenuUser() {
getMenuUser() getMenuUser()
.then(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
that.MyMenus = res.data.routine_my_menus this.MyMenus = res.data.routine_my_menus
}) })
.catch(error => { .catch(error => {
uni.hideLoading() uni.hideLoading()
console.log(error) console.log(error)
}) })
}, },
goPages: function(index) { goPages(index) {
let url = this.MyMenus[index].uniapp_url let url = this.MyMenus[index].uniapp_url
if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) { if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) {
if (!this.userInfo.isPromoter) { if (!this.userInfo.isPromoter) {
@ -322,7 +380,7 @@ export default {
path: this.MyMenus[index].uniapp_url, path: this.MyMenus[index].uniapp_url,
}) })
}, },
goPages2: function() { goPages2() {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/GoodsList/index', path: '/pages/shop/GoodsList/index',
query: { query: {
@ -357,6 +415,19 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.getUserBaseData{
.userDataBtn{
width: 80%;
height: 80rpx;
background: linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
background: -moz-linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
border-radius: 40rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
}
.footer-line-height { .footer-line-height {
height: 1 * 100rpx; height: 1 * 100rpx;
} }

19
pages/user/coupon/GetCoupon/index.vue

@ -97,18 +97,17 @@ export default {
}) })
}) })
}, },
getUseCoupons: function() { getUseCoupons() {
let that = this if (this.loading) return //false
if (that.loading) return //false if (this.loadend) return //false
if (that.loadend) return //false this.loading = true
that.loading = true let q = { page: this.page, limit: this.limit }
let q = { page: that.page, limit: that.limit }
getCoupon(q).then(res => { getCoupon(q).then(res => {
that.loading = false this.loading = false
//apply();js; //apply();js;
that.couponsList.push.apply(that.couponsList, res.data) this.couponsList.push.apply(this.couponsList, res.data)
that.loadend = res.data.length < that.limit // this.loadend = res.data.length < this.limit //
that.page = that.page + 1 this.page = this.page + 1
}) })
}, },
}, },

4
pages/user/signIn/Sign/index.vue

@ -7,9 +7,9 @@
<image :src="userInfo.avatar" /> <image :src="userInfo.avatar" />
</view> </view>
<view class="text"> <view class="text">
<view class="line1">{{ userInfo.nickname }}</view> <view class="line1">{{ userInfo.nickname || '' }}</view>
<view class="integral acea-row"> <view class="integral acea-row">
<text>积分: {{ userInfo.integral }}</text> <text>积分: {{ userInfo.integral || 0 }}</text>
</view> </view>
</view> </view>
</view> </view>

1
store/index.js

@ -29,6 +29,7 @@ const vuexStore = new Vuex.Store({
}, },
mutations: { mutations: {
login(state, token, expires_time) { login(state, token, expires_time) {
console.log('设置token')
state.token = token state.token = token
cookie.set(loginKey, token, expires_time) cookie.set(loginKey, token, expires_time)
}, },

17
utils/index.js

@ -2,7 +2,7 @@ import Vue from 'vue'
// import MpvueRouterPatch from 'mpvue-router-patch' // import MpvueRouterPatch from 'mpvue-router-patch'
// Vue.use(MpvueRouterPatch) // Vue.use(MpvueRouterPatch)
import { wxappAuth, getUserInfo } from '@/api/user' import { wxappAuth, getUserInfo, wxappBindingPhone } from '@/api/user'
import store from '@/store' import store from '@/store'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import cookie from '@/utils/store/cookie' import cookie from '@/utils/store/cookie'
@ -164,7 +164,7 @@ export const getProvider = service => {
}, },
}) })
}).catch(error => { }).catch(error => {
console.log(error) console.log('167',error)
}) })
} }
@ -196,7 +196,7 @@ export const login = loginInfo => {
auth(code) auth(code)
.then(() => { .then(() => {
let redirect = cookie.get('redirect').replace(/\ /g, '') let redirect = cookie.get('redirect').replace(/\ /g, '')
console.log(redirect) console.log('199',redirect)
if (redirect) { if (redirect) {
redirect = redirect.split('/pages')[1] redirect = redirect.split('/pages')[1]
if (!redirect) { if (!redirect) {
@ -286,9 +286,8 @@ export const login = loginInfo => {
reject('获取用户信息失败') reject('获取用户信息失败')
}) })
}) })
.catch(error => { .catch(error => { // 登录接口调用失败
console.log(error) console.log(error)
console.log('登录接口调用失败')
reject('登录接口调用失败') reject('登录接口调用失败')
}) })
} else { } else {
@ -299,18 +298,17 @@ export const login = loginInfo => {
uni.getUserInfo({ uni.getUserInfo({
provider: provider, provider: provider,
success: function(user) { success: function(user) {
console.log(user)
console.log('获取用户信息成功') console.log('获取用户信息成功')
console.log('开始调用登录接口') console.log('开始调用登录接口')
wxappAuth({ wxappAuth({
// phone: user.phone
encryptedData: user.encryptedData, encryptedData: user.encryptedData,
iv: user.iv, iv: user.iv,
code: code, code: code,
spread: cookie.get('spread'), spread: cookie.get('spread'),
}) })
.then(({ data }) => { .then(({ data }) => {
console.log('登录接口调用成功') console.log('登录成功,开始处理登录信息保存,并获取用户详情')
console.log('开始处理登录信息保存,并获取用户详情')
uni.hideLoading() uni.hideLoading()
store.commit('login', data.token, dayjs(data.expires_time)) store.commit('login', data.token, dayjs(data.expires_time))
store.dispatch('userInfo', true) store.dispatch('userInfo', true)
@ -356,7 +354,6 @@ export const handleGetUserInfo = () => {
console.log('获取用户信息') console.log('获取用户信息')
store.dispatch('setUserInfo', res.data) store.dispatch('setUserInfo', res.data)
console.log('获取用户信息后跳转回显的页面') console.log('获取用户信息后跳转回显的页面')
let redirect = cookie.get('redirect').replace(/\ /g, '') let redirect = cookie.get('redirect').replace(/\ /g, '')
if (redirect) { if (redirect) {
reLaunch({ reLaunch({
@ -527,7 +524,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
// 是否可以访问 // 是否可以访问
let isAuth = false let isAuth = false
console.log('即将跳转', location, parseUrl(location)) // console.log('即将跳转', location, parseUrl(location))
// 从 location 中获取当前url,location typeof string || object // 从 location 中获取当前url,location typeof string || object
let path = '' let path = ''

17
utils/request.js

@ -20,6 +20,16 @@ import cookie from '@/utils/store/cookie'
const fly = new Fly() const fly = new Fly()
fly.config.baseURL = VUE_APP_API_URL fly.config.baseURL = VUE_APP_API_URL
// 小程序测试请求域名
// #ifdef MP-WEIXIN
// fly.config.baseURL = 'http://29e25012l6.qicp.vip/api'
// #endif
// #ifdef APP-PLUS
// app端
// fly.config.baseURL = 'http://29e25012l6.qicp.vip/api'
// #endif
fly.interceptors.response.use( fly.interceptors.response.use(
response => { response => {
// console.log(response) // console.log(response)
@ -27,9 +37,10 @@ fly.interceptors.response.use(
return response return response
}, },
error => { error => {
console.log(error)
if (error.toString() == 'Error: Network Error') { if (error.toString() == 'Error: Network Error') {
console.log('————————') console.log('————————')
console.log('发送请求失败', error) console.log('请求失败', error)
console.log('————————') console.log('————————')
handleLoginFailure() handleLoginFailure()
return Promise.reject({ msg: '未登录', toLogin: true }) return Promise.reject({ msg: '未登录', toLogin: true })
@ -128,9 +139,9 @@ const request = ['post', 'put', 'patch'].reduce((request, method) => {
return baseRequest(Object.assign({ url, data, method }, defaultOpt, options)) return baseRequest(Object.assign({ url, data, method }, defaultOpt, options))
} }
return request return request
}, {}) }, {});
;['get', 'delete', 'head'].forEach(method => { ['get', 'delete', 'head'].forEach(method => {
/** /**
* *
* @param url string 接口地址 * @param url string 接口地址

Loading…
Cancel
Save