Browse Source

yshop3.1正式发布

master
xuwenbo 5 years ago
parent
commit
8a85f44ff6
  1. 109
      App.vue
  2. 17
      api/live.js
  3. 4
      api/store.js
  4. 5
      api/user.js
  5. 2
      assets/css/base.css
  6. 4
      assets/css/base.less
  7. 2
      assets/css/reset.css
  8. 2
      assets/css/reset.less
  9. 2
      assets/css/style.css
  10. 2
      assets/css/style.css.map
  11. 939
      assets/css/style.less
  12. 207
      components/Adv.vue
  13. 26
      components/Loading.vue
  14. 155
      components/Menu.vue
  15. 230
      components/PromotionGood.vue
  16. 327
      components/ShopLiveCard.vue
  17. 343
      components/StorePoster.vue
  18. 78
      components/UserEvaluation.vue
  19. 40
      components/sh-activity-goods.vue
  20. 256
      components/sh-adv.vue
  21. 197
      components/sh-groupon.vue
  22. 8
      config/index.js
  23. 164
      libs/order.js
  24. 25
      libs/wechat.js
  25. 2
      main.js
  26. 11
      manifest.json
  27. 34
      package-lock.json
  28. 5
      package.json
  29. 28
      pages.json
  30. 15
      pages/Loading/index.vue
  31. 928
      pages/activity/DargainDetails/index.vue
  32. 101
      pages/activity/GoodsGroup/children/activity-card.vue
  33. 298
      pages/activity/GoodsGroup/index.vue
  34. 384
      pages/activity/GoodsSeckill/index.vue
  35. 657
      pages/activity/GroupDetails/index.vue
  36. 4
      pages/activity/GroupRule/index.vue
  37. 128
      pages/activity/Poster/index.vue
  38. 536
      pages/activity/SeckillDetails/index.vue
  39. 339
      pages/authorization/index.vue
  40. 173
      pages/home/components/Banner.vue
  41. 216
      pages/home/components/FirstNewProduct.vue
  42. 219
      pages/home/components/HotCommodity.vue
  43. 249
      pages/home/components/Live.vue
  44. 215
      pages/home/components/ProductsRecommended.vue
  45. 216
      pages/home/components/PromoteProduct.vue
  46. 332
      pages/home/index.vue
  47. 13
      pages/order/OrderDetails/index.vue
  48. 735
      pages/order/OrderSubmission/index.vue
  49. 7
      pages/orderAdmin/AdminOrder/index.vue
  50. 9
      pages/orderAdmin/AdminOrderList/index.vue
  51. 3
      pages/shop/GoodsCollection/index.vue
  52. 1581
      pages/shop/GoodsCon/index.vue
  53. 102
      pages/shop/GoodsFoot/index.vue
  54. 182
      pages/shop/Live/LiveList/index.vue
  55. 735
      pages/shop/ShoppingCart/index.vue
  56. 19
      pages/shop/StoreList/index.vue
  57. 443
      pages/user/Login/index.vue
  58. 17
      pages/user/PersonalData/index.vue
  59. 609
      pages/user/Recharge/index.vue
  60. 520
      pages/user/User/index.vue
  61. 8
      pages/user/UserAccount/index.vue
  62. 25
      pages/user/address/AddAddress/index.vue
  63. 253
      pages/user/promotion/Poster/index.vue
  64. 339
      pages/user/promotion/UserCash/index.vue
  65. 1
      pages/user/promotion/UserPromotion/index.vue
  66. BIN
      static/images/logo_bg.png
  67. BIN
      static/images/title1.png
  68. 12
      store/index.js
  69. 510
      uni.css
  70. 9
      uni.css.map
  71. 1
      uni.min.css
  72. 56
      uni.scss
  73. 155
      utils/index.js
  74. 8
      utils/request.js

109
App.vue

@ -1,24 +1,91 @@
<script> <script>
export default { import Vue from 'vue'
onLaunch: function() { export default {
console.log('App Launch') onLaunch: function() {
}, // debugger
onShow: function() { const updateManager = uni.getUpdateManager()
console.log('App Show') updateManager.onCheckForUpdate(function (res) {
}, //
onHide: function() { console.log(res.hasUpdate)
})
console.log('App Hide') //
} updateManager.onUpdateReady(function () {
} uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
//
updateManager.applyUpdate()
}
}
})
})
//
updateManager.onUpdateFailed(function (res) {
//
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
})
})
},
onShow: function () {
console.log("App Show");
},
onHide: function () {
console.log("App Hide");
},
mounted() {
this.setAppInfo()
},
methods: {
//
async setAppInfo() {
let that = this;
return new Promise((resolve, reject) => {
uni.getSystemInfo({
success: function (e) {
Vue.prototype.StatusBar = e.statusBarHeight;
// #ifdef H5
Vue.prototype.CustomBar = e.statusBarHeight + 45;
// #endif
// #ifdef APP-PLUS
if (e.platform == "android") {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
}
// #endif
// #ifdef MP-WEIXIN
let custom = wx.getMenuButtonBoundingClientRect();
Vue.prototype.Custom = custom;
Vue.prototype.CustomBar =
custom.bottom + custom.top - e.statusBarHeight;
// #endif
},
});
});
},
//
async autoLogin(data) {
},
},
};
</script> </script>
<style lang="less"> <style lang="less">
/*每个页面公共css */ /*每个页面公共css */
@import "animate.css"; @import "animate.css";
@import "./assets/iconfont/iconfont.css"; @import "./assets/iconfont/iconfont.css";
@import "./assets/css/base.less"; @import "./assets/css/base.less";
@import "./assets/css/reset.less"; @import "./assets/css/reset.less";
@import "./assets/css/style.less"; @import "./assets/css/style.less";
</style> </style>

17
api/live.js

@ -0,0 +1,17 @@
import request from "@/utils/request";
/**
* 查询所有直播间
*/
export function yxWechatLive(data) {
return request.get("/yxWechatLive", data, { login: true });
}
/**
* 获取直播回放
*/
export function getLiveReplay(id, data) {
return request.get("/yxWechatLive/getLiveReplay/" + id, data, { login: false });
}

4
api/store.js

@ -75,8 +75,8 @@ export function getGroomList(type) {
/* /*
* 获取商品海报 * 获取商品海报
* */ * */
export function getProductPoster(id) { export function getProductPoster(id, data) {
return request.get("/product/poster/" + id, {}, { return request.get("/product/poster/" + id, data, {
login: true login: true
}); });
} }

5
api/user.js

@ -186,10 +186,11 @@ export function postAddress(data) {
/* /*
* 获取收藏产品 * 获取收藏产品
* */ * */
export function getCollectUser(page, limit) { export function getCollectUser(page, limit, type) {
return request.get("/collect/user", { return request.get("/collect/user", {
page: page, page: page,
limit: limit limit: limit,
type
}); });
} }

2
assets/css/base.css

@ -1,2 +1,2 @@
@charset "UTF-8";.font-color-red{color:#eb3729 !important}.bg-color-red{background-color:#eb3729 !important}.icon-color{color:#eb3729}.cart-color{color:#eb3729 !important;border:1px solid #eb3729 !important}.padding20{padding:20rpx}.pad20{padding:0 20rpx}.padding30{padding:30rpx}.pad30{padding:0 30rpx}.acea-row{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.acea-row.row-middle{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.acea-row.row-top{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.acea-row.row-bottom{-webkit-box-align:end;-webkit-align-items:flex-end;-ms-flex-align:end;align-items:flex-end}.acea-row.row-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.acea-row.row-right{-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end}.acea-row.row-left{-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start}.acea-row.row-between{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.acea-row.row-around{-webkit-justify-content:space-around;-ms-flex-pack:distribute;justify-content:space-around}.acea-row.row-column-around{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:space-around;-ms-flex-pack:distribute;justify-content:space-around}.acea-row.row-column{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.acea-row.row-column-between{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.acea-row.row-center-wrapper{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.acea-row.row-between-wrapper{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.slider-banner{position:relative;width:100%;overflow:hidden}.slider-banner .swiper-container{height:100%}.slider-banner image{display:block;width:100%;height:100%}.start{width:122rpx;height:30rpx;background-image:url("https://h5.yixiang.co/static/images/start.png");background-repeat:no-repeat;-webkit-background-size:122rpx auto;background-size:122rpx auto}.start.star5{background-position:0 3rpx}.start.star4{background-position:0 -30rpx}.start.star3{background-position:0 -70rpx}.start.star2{background-position:0 -105rpx}.start.star1{background-position:0 -140rpx}.start.star0{background-position:0 -175rpx}.checkbox-wrapper{position:relative}.checkbox-wrapper input{display:none}.checkbox-wrapper .icon{position:absolute;left:0;top:50%;display:inline-block;width:18px;height:18px;border:1px solid #cccccc;-webkit-border-radius:50%;border-radius:50%;-webkit-transform:translate(0, -50%);-ms-transform:translate(0, -50%);transform:translate(0, -50%)}.checkbox-wrapper input:checked+.icon{background-color:#e93323;border-color:#e93323;background-image:url("https://h5.yixiang.co/static/images/enter.png");-webkit-background-size:21rpx 15rpx;background-size:21rpx 15rpx;background-repeat:no-repeat;background-position:center center}.Loads{height:80rpx;font-size:25rpx;color:#000}.Loads .iconfont{font-size:30rpx;margin-right:10rpx;height:32rpx;line-height:32rpx}@-webkit-keyframes load{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.loadingpic{-webkit-animation:load 3s linear 1s infinite;animation:load 3s linear 1s infinite}.loading{-webkit-animation:load linear 1s infinite;animation:load linear 1s infinite} @charset "UTF-8";.font-color-red{color:#eb3729 !important}.bg-color-red{background-color:#eb3729 !important}.icon-color{color:#eb3729}.cart-color{color:#eb3729 !important;border:1px solid #eb3729 !important}.padding20{padding:20rpx}.pad20{padding:0 20rpx}.padding30{padding:30rpx}.pad30{padding:0 30rpx}.acea-row{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.acea-row.row-middle{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.acea-row.row-top{-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start}.acea-row.row-bottom{-webkit-box-align:end;-webkit-align-items:flex-end;-ms-flex-align:end;align-items:flex-end}.acea-row.row-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.acea-row.row-right{-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end}.acea-row.row-left{-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start}.acea-row.row-between{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.acea-row.row-around{-webkit-justify-content:space-around;-ms-flex-pack:distribute;justify-content:space-around}.acea-row.row-column-around{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-justify-content:space-around;-ms-flex-pack:distribute;justify-content:space-around}.acea-row.row-column{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column}.acea-row.row-column-between{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.acea-row.row-center-wrapper{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.acea-row.row-between-wrapper{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.slider-banner{position:relative;width:100%;overflow:hidden}.slider-banner .swiper-container{height:100%}.slider-banner image{display:block;width:100%;height:100%}.start{width:122rpx;height:30rpx;background-image:url("https://wx.yixiang.co/static/images/start.png");background-repeat:no-repeat;-webkit-background-size:122rpx auto;background-size:122rpx auto}.start.star5{background-position:0 3rpx}.start.star4{background-position:0 -30rpx}.start.star3{background-position:0 -70rpx}.start.star2{background-position:0 -105rpx}.start.star1{background-position:0 -140rpx}.start.star0{background-position:0 -175rpx}.checkbox-wrapper{position:relative}.checkbox-wrapper input{display:none}.checkbox-wrapper .icon{position:absolute;left:0;top:50%;display:inline-block;width:18px;height:18px;border:1px solid #cccccc;-webkit-border-radius:50%;border-radius:50%;-webkit-transform:translate(0, -50%);-ms-transform:translate(0, -50%);transform:translate(0, -50%)}.checkbox-wrapper input:checked+.icon{background-color:#e93323;border-color:#e93323;background-image:url("https://wx.yixiang.co/static/images/enter.png");-webkit-background-size:21rpx 15rpx;background-size:21rpx 15rpx;background-repeat:no-repeat;background-position:center center}.Loads{height:80rpx;font-size:25rpx;color:#000}.Loads .iconfont{font-size:30rpx;margin-right:10rpx;height:32rpx;line-height:32rpx}@-webkit-keyframes load{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.loadingpic{-webkit-animation:load 3s linear 1s infinite;animation:load 3s linear 1s infinite}.loading{-webkit-animation:load linear 1s infinite;animation:load linear 1s infinite}
/*# sourceMappingURL=./base.css.map */ /*# sourceMappingURL=./base.css.map */

4
assets/css/base.less

@ -104,7 +104,7 @@
.start { .start {
width: 1.22*100rpx; width: 1.22*100rpx;
height: 0.3*100rpx; height: 0.3*100rpx;
background-image: url("https://h5.yixiang.co/static/images/start.png"); background-image: url("https://wx.yixiang.co/static/images/start.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 1.22*100rpx auto; background-size: 1.22*100rpx auto;
} }
@ -147,7 +147,7 @@
.checkbox-wrapper input:checked + .icon { .checkbox-wrapper input:checked + .icon {
background-color: #e93323; background-color: #e93323;
border-color: #e93323; border-color: #e93323;
background-image: url("https://h5.yixiang.co/static/images/enter.png"); background-image: url("https://wx.yixiang.co/static/images/enter.png");
background-size: 0.21*100rpx 0.15*100rpx; background-size: 0.21*100rpx 0.15*100rpx;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;

2
assets/css/reset.css

@ -1,2 +1,2 @@
input{line-height:normal;-webkit-box-sizing:border-box;box-sizing:border-box}@font-face{font-family:'GuildfordProBook 5';src:url('https://h5.yixiang.co/static/iconfont/GuildfordProBook5.otf')}[v-cloak]{display:none}.iconfont{font-size:36rpx}@media (-webkit-min-device-pixel-ratio:1.5),(min-device-pixel-ratio:1.5){.border-1px::after{-webkit-transform:scaleY(.7);-ms-transform:scaleY(.7);transform:scaleY(.7)}.border-1px::before{-webkit-transform:scaleY(.7);-ms-transform:scaleY(.7);transform:scaleY(.7)}}@media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){.border-1px::after{-webkit-transform:scaleY(.5);-ms-transform:scaleY(.5);transform:scaleY(.5)}.border-1px::before{-webkit-transform:scaleY(.5);-ms-transform:scaleY(.5);transform:scaleY(.5)}}@media (-webkit-min-device-pixel-ratio:3),(min-device-pixel-ratio:3){.border-1px::after{-webkit-transform:scaleY(.33);-ms-transform:scaleY(.33);transform:scaleY(.33)}.border-1px::before{-webkit-transform:scaleY(.33);-ms-transform:scaleY(.33);transform:scaleY(.33)}}.line1{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;width:100%}.line2{word-break:break-all;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:55;background-color:rgba(0,0,0,0.5)} input{line-height:normal;-webkit-box-sizing:border-box;box-sizing:border-box}@font-face{font-family:'GuildfordProBook 5';src:url('https://wx.yixiang.co/static/iconfont/GuildfordProBook5.otf')}[v-cloak]{display:none}.iconfont{font-size:36rpx}@media (-webkit-min-device-pixel-ratio:1.5),(min-device-pixel-ratio:1.5){.border-1px::after{-webkit-transform:scaleY(.7);-ms-transform:scaleY(.7);transform:scaleY(.7)}.border-1px::before{-webkit-transform:scaleY(.7);-ms-transform:scaleY(.7);transform:scaleY(.7)}}@media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){.border-1px::after{-webkit-transform:scaleY(.5);-ms-transform:scaleY(.5);transform:scaleY(.5)}.border-1px::before{-webkit-transform:scaleY(.5);-ms-transform:scaleY(.5);transform:scaleY(.5)}}@media (-webkit-min-device-pixel-ratio:3),(min-device-pixel-ratio:3){.border-1px::after{-webkit-transform:scaleY(.33);-ms-transform:scaleY(.33);transform:scaleY(.33)}.border-1px::before{-webkit-transform:scaleY(.33);-ms-transform:scaleY(.33);transform:scaleY(.33)}}.line1{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;width:100%}.line2{word-break:break-all;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:55;background-color:rgba(0,0,0,0.5)}
/*# sourceMappingURL=./reset.css.map */ /*# sourceMappingURL=./reset.css.map */

2
assets/css/reset.less

@ -1,7 +1,7 @@
input{line-height: normal; box-sizing:border-box;} input{line-height: normal; box-sizing:border-box;}
@font-face { @font-face {
font-family: 'GuildfordProBook 5'; font-family: 'GuildfordProBook 5';
src: url('https://h5.yixiang.co/static/iconfont/GuildfordProBook5.otf'); src: url('https://wx.yixiang.co/static/iconfont/GuildfordProBook5.otf');
} }
[v-cloak] { [v-cloak] {
display: none; display: none;

2
assets/css/style.css

File diff suppressed because one or more lines are too long

2
assets/css/style.css.map

File diff suppressed because one or more lines are too long

939
assets/css/style.less

File diff suppressed because it is too large Load Diff

207
components/Adv.vue

@ -0,0 +1,207 @@
<template>
<view class="adv-box mx20 mb10">
<!-- 模板1-->
<view class="x-f" v-if="detail.style == 1">
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
</view>
<!-- 模板2-->
<view class="type1 x-f" v-if="detail.style == 2">
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image>
</view>
<!-- 模板3-->
<view class="type2 x-bc" v-if="detail.style == 3">
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<view class="y-f type2-box">
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image>
</view>
</view>
<!-- 模板4-->
<view class="type3 x-bc" v-if="detail.style == 4">
<view class="type3-box y-f">
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image>
</view>
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image>
</view>
<!-- 模板5-->
<view class="type4 y-f" v-if="detail.style == 5">
<view class="type4-box x-f">
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image>
</view>
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image>
</view>
<!-- 模板6-->
<view class="type5 y-f" v-if="detail.style == 6">
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<view class="type5-box x-bc">
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill" style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image>
</view>
</view>
<!-- 模板7-->
<view class="type6 y-f" v-if="detail.style == 7">
<view class="x-f type6-box1">
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill"></image>
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"></image>
</view>
<view class="x-f type6-box2">
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image" mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image" mode="aspectFill"></image>
</view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {};
},
props: {
detail: {}
},
computed: {},
created() {},
methods: {
//
jump(path) {
this.$tools.routerTo(path);
}
}
};
</script>
<style lang="scss">
.adv-box {
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
.type1 {
.type1-img {
flex: 1;
height: 220rpx;
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type2 {
.type2-img1 {
width: (710rpx/2);
height: 340rpx;
border-right: 1rpx solid #f6f6f6;
}
.type2-box {
flex: 1;
height: 340rpx;
width: (710rpx/2);
.type2-img2 {
height: (340rpx/2);
}
}
}
.type3 {
.type3-box {
width: (710rpx/2);
border-right: 1rpx solid #f6f6f6;
.type3-img1 {
flex: 1;
height: (340rpx/2);
&:first-child {
border-bottom: 1rpx solid #f6f6f6;
}
}
}
.type3-img2 {
flex: 1;
height: 340rpx;
width: (710rpx/2);
}
}
.type4 {
.type4-box {
border-bottom: 1rpx solid #f6f6f6;
.type4-img1 {
flex: 1;
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type4-img2 {
flex: 1;
height: (340rpx/2);
width: 710rpx;
}
}
.type5 {
.type5-img1 {
width: 710rpx;
height: (340rpx/2);
border-bottom: 1rpx solid #f6f6f6;
}
.type5-box {
flex: 1;
height: (340rpx/2);
width: 710rpx;
.type5-img2 {
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
}
.type6 {
.type6-box1 {
.type6-img1 {
width: (710rpx/2);
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type6-box2 {
border-top: 1rpx solid #f6f6f6;
.type6-img2 {
width: (710rpx/3);
height: (340rpx/2);
border-right: 1rpx solid #f6f6f6;
&:last-child {
border-right: 0;
}
}
}
}
image {
// background-color: #ccc;
}
}
</style>

26
components/Loading.vue

@ -1,27 +1,21 @@
<template> <template>
<view <view class="Loads acea-row row-center-wrapper" v-if="loading || !loaded" style="margin-top: 20rpx;">
class="Loads acea-row row-center-wrapper"
v-if="loading || !loaded"
style="margin-top: 20rpx;"
>
<template v-if="loading"> <template v-if="loading">
<view <view class="iconfont icon-jiazai loading acea-row row-center-wrapper"></view>
class="iconfont icon-jiazai loading acea-row row-center-wrapper"
></view>
正在加载中 正在加载中
</template> </template>
<template v-else> <template v-if="!loading">
上拉加载更多 上拉加载更多
</template> </template>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: "Loading", name: "Loading",
props: { props: {
loaded: Boolean, loaded: Boolean,
loading: Boolean loading: Boolean
} }
}; };
</script> </script>

155
components/Menu.vue

@ -0,0 +1,155 @@
<template>
<!-- 产品分类导航 -->
<view class="menu-category-box mb10" v-if="carousel" :style="list.length <= menu ? `height:200rpx` : `height:360rpx`">
<swiper
class="menu-swiper-box"
:style="list.length <= menu ? `height:160rpx` : `height:320rpx`"
@change="onSwiper"
circular
:autoplay="false"
:interval="3000"
:duration="1000"
>
<swiper-item class="menu-swiper-item" v-for="(itemList, index) in carousel" :key="index" :style="list.length <= menu ? `height:200rpx` : `height:340rpx`">
<view class="menu-tab-box">
<view class="tab-list y-f" :style="{ width: 690 / menu + 'rpx' }" v-for="item in itemList" :key="item.name" @tap="routerTo(item)">
<image class="tab-img Shop-selector-circular" :style="{ width: imgW + 'rpx', height: imgW + 'rpx' }" :src="item.pic"></image>
<text class="Shop-selector-rect">{{ item.name }}</text>
</view>
</view>
</swiper-item>
</swiper>
<view class="menu-category-dots" v-if="carousel.length > 1">
<text :class="categoryCurrent === index ? 'category-dot-active' : 'category-dot'" v-for="(dot, index) in carousel.length" :key="index"></text>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
categoryCurrent: 0 //
};
},
props: {
list: {
type: Array,
default: []
},
menu: {
default: 4
},
imgW: {
type: Number,
default: 88
}
},
computed: {
carousel() {
if (this.list) {
let list = this.sortData(this.list, this.menu * 2);
return list;
}
}
},
created() {},
methods: {
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
//
onSwiper(e) {
this.categoryCurrent = e.detail.current;
},
//
routerTo(item) {
this.$yrouter.push(item.uniapp_url);
}
}
};
</script>
<style lang="scss">
//
.y-f {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
}
.menu-category-box {
padding: 30rpx 30rpx 0 30rpx;
background: #fff;
box-sizing: border-box;
}
.menu-category-box,
.menu-swiper-box {
position: relative;
background: #fff;
.menu-swiper-item {
background: #fff;
height: 100%;
width: 100%;
}
.menu-tab-box {
display: flex;
flex-wrap: wrap;
.tab-list {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(51, 51, 51, 1);
padding-bottom: 30rpx;
.tab-img {
border-radius: 25rpx;
margin-bottom: 10rpx;
}
}
}
.menu-category-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 20rpx;
.category-dot {
width: 40rpx;
height: 3rpx;
background: #eeeeee;
margin-right: 10rpx;
}
.category-dot-active {
width: 40rpx;
height: 3rpx;
background: #a8700d;
margin-right: 10rpx;
}
}
}
</style>

230
components/PromotionGood.vue

@ -1,36 +1,214 @@
<template> <template>
<view class="promotionGood" v-if="benefit.length > 0"> <view>
<view class="item acea-row row-between-wrapper" v-for="(item, promotionGoodIndex) in benefit" :key="promotionGoodIndex" @click="routerGo(item)"> <view class="sh-title-card mb10">
<view class="pictrue"><image :src="item.image" class="image" /></view> <view class="title-box">
<view class="text"> <image class="title-bg" src="@/static/images/title1.png" mode="aspectFill"></image>
<view class="name line1">{{ item.storeName }}</view> <view class="title-text">为你推荐</view>
<view class="sp-money acea-row"> <!-- <view class="title-text" :style="{ color: detail.color }">为你推荐</view> -->
<view class="moneyCon"> </view>
促销价: </view>
<text class="num">{{ item.price }}</text> <view class="hot-goods mx20 mb10" v-if="benefit.length">
<view class="goods-list x-f">
<view class="goods-item" v-for="(item, promotionGoodIndex) in benefit" :key="promotionGoodIndex">
<view class="goods-box" @tap="routerGo(item)">
<view class="img-box">
<!-- <image class="tag-img" :src="item.image" mode=""></image> -->
<image class="img" :src="item.image" lazy-load mode="aspectFill"></image>
</view>
<view class="tip one-t">{{ item.storeName }}</view>
<view class="title more-t">{{ item.storeName }}</view>
<view class="price-box">
<view class="flex x-bc align-end">
<view class="current">{{ item.activity_type === 'groupon' ? item.price : item.otPrice }}
</view>
<view class="sales miso-font">仅剩{{ item.stock }}{{ item.unitName }}</view>
</view>
<view class="x-f tag-box">
<!-- <view class="discount">新人礼</view>
<view class="discount">满100减60</view> -->
</view>
</view>
</view> </view>
</view> </view>
<view class="acea-row row-between-wrapper">
<view class="money">日常价{{ item.otPrice }}</view>
<view>仅剩{{ item.stock }}{{ item.unitName }}</view>
</view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'PromotionGood', name: 'PromotionGood',
props: ['benefit'], props: ['benefit'],
data: function() { data: function () {
return {}; return {};
}, },
methods: { methods: {
routerGo(item) { routerGo(item) {
this.$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } }); this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.id
}
});
}
},
mounted() {}
};
</script>
<style lang="scss">
.sh-title-card {
width: 750rpx;
}
.title-box {
width: 710rpx;
height: 88rpx;
margin: 0 auto;
position: relative;
border-radius: 30rpx;
.title-bg {
width: 100%;
height: 100%;
}
.title-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: bold;
} }
},
mounted() {
} }
};
</script> .goods-box {
width: 345rpx;
background: #fff;
padding-bottom: 20rpx;
border-radius: 20rpx;
overflow: hidden;
.img-box {
width: 345rpx;
height: 345rpx;
overflow: hidden;
position: relative;
.tag-img {
position: absolute;
left: 0;
top: 0;
z-index: 2;
width: 80rpx;
height: 40rpx;
}
.img {
width: 345rpx;
height: 345rpx;
background-color: #ccc;
}
}
.tip {
width: 346rpx;
line-height: 56rpx;
background: rgba(246, 242, 234, 1);
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(168, 112, 13, 1);
padding: 0 20rpx;
}
.title {
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
line-height: 36rpx;
height: 72rpx;
margin: 20rpx 20rpx 10rpx;
}
.price-box {
padding: 10rpx 20rpx 0;
width: 344rpx;
box-sizing: border-box;
.sales {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
line-height: 20rpx;
margin-bottom: 20rpx;
}
.current {
font-size: 30rpx;
font-weight: 500;
color: rgba(225, 33, 43, 1);
line-height: 30rpx;
margin-bottom: 20rpx;
&:before {
content: '¥';
font-size: 26rpx;
}
}
.original {
font-size: 22rpx;
font-weight: 400;
text-decoration: line-through;
color: rgba(153, 153, 153, 1);
margin-left: 14rpx;
line-height: 22rpx;
margin-bottom: 10rpx;
&:before {
content: '¥';
font-size: 20rpx;
}
}
.tag-box {
.discount {
line-height: 28rpx;
border: 1rpx solid rgba(225, 33, 43, 1);
border-radius: 8rpx;
font-size: 18rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(225, 33, 43, 1);
padding: 0 8rpx;
margin-right: 10rpx;
}
}
}
}
//
.hot-goods {
// background: linear-gradient(#fff 200rpx, #f6f6f6 500rpx, #f6f6f6);
// border-radius: 20rpx;
.goods-list {
flex-wrap: wrap;
width: 710rpx;
.goods-item {
margin-right: 20rpx;
margin-bottom: 20rpx;
width: 345rpx;
box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22);
border-radius: 20rpx;
&:nth-child(2n) {
margin-right: 0;
}
}
}
}
</style>

327
components/ShopLiveCard.vue

@ -0,0 +1,327 @@
<template>
<view class="sp-live-card" :style="{ width: wh + 'rpx' }">
<view class="live-content" @tap="goRoom" :style="{ width: wh + 'rpx' }">
<image class="item-cover" :src="detail.shareImge" mode="aspectFill"></image>
<view class="item-status">
<image class="status-img" :src="liveStatus[detail.liveStatus].img" mode=""></image>
<text class="status-text">{{ liveStatus[detail.liveStatus].title }}</text>
</view>
<view class="item-title" :style="{ width: wh + 'rpx' }">{{ detail.name }}</view>
<!-- <image v-if="detail.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif" mode=""></image> -->
</view>
<view class="live-bottom" :style="{ width: wh + 'rpx' }">
<view class="live-info">
<view class="info-box">
<!-- <image class="info-avatar" :src="detail.anchor_img" mode=""></image> -->
<view class="info-name">{{ detail.anchorName }}</view>
</view>
<!-- <text class="views">15W观看</text> -->
</view>
<slot name="liveGoods">
<view class="live-goods" v-if="detail.product.length">
<view class="live-goods__item" v-for="(goods, index) in detail.product" :key="goods.goodsId"
v-if="index < 3">
<image class="live-goods__img" :src="goods.coverImgeUrl" mode=""></image>
<view class="live-goods__price" v-if="index < 2">{{ goods.price }}</view>
<view class="live-goods__mark" v-else>
<text>{{ detail.product.length }}+</text>
</view>
</view>
</view>
</slot>
</view>
</view>
</template>
<script>
import {
dataFormatL
} from "@/utils";
let HAS_LIVE = false
// #ifdef MP-WEIXIN
HAS_LIVE = true
let livePlayer = null;
if (HAS_LIVE) {
livePlayer = requirePlugin('live-player-plugin');
}
// #endif
let timer = null;
export default {
name: 'shopLiveCard',
components: {},
data() {
return {
liveStatus: {
'101': {
img: 'https://wx.yixiang.co/static/images/live.png',
title: '直播中'
},
'102': {
img: 'https://wx.yixiang.co/static/images/prevue.png',
title: '未开始'
},
'103': {
img: 'https://wx.yixiang.co/static/images/playback.png',
title: '已结束'
},
'104': {
img: 'https://wx.yixiang.co/static/images/104.png',
title: '禁播'
},
'105': {
img: 'https://wx.yixiang.co/static/images/105.png',
title: '暂停中'
},
'106': {
img: 'https://wx.yixiang.co/static/images/106.png',
title: '异常'
},
'107': {
img: 'https://wx.yixiang.co/static/images/past.png',
title: '已过期'
}
}
};
},
props: {
detail: {
type: Object,
default: null
},
wh: {
type: Number,
default: 345
}
},
computed: {},
created() {
this.getLiveStatus();
},
mounted() {
let that = this;
timer = setInterval(() => {
that.getLiveStatus();
}, 60000);
},
beforeDestroy() {
timer = null;
},
methods: {
goRoom() {
let that = this;
wx.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${that.detail.roomId}`
});
},
dateFormat(fmt, date) {
let ret;
const opt = {
"Y+": date.getFullYear().toString(), //
"m+": (date.getMonth() + 1).toString(), //
"d+": date.getDate().toString(), //
"H+": date.getHours().toString(), //
"M+": date.getMinutes().toString(), //
"S+": date.getSeconds().toString() //
//
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
},
// liveStatus
getLiveStatus() {
if (HAS_LIVE) {
let that = this;
let date = '';
if (that.detail.liveStatus == 102) {
date = this.dateFormat('mm-dd HH:MM', new Date(that.detail.startTime * 1000)).replace('-','/');
that.liveStatus['102'].title = '预告 ' + date;
}
// livePlayer
// .getLiveStatus({
// room_id: that.detail.roomId
// })
// .then(res => {
// // 101: , 102: , 103: , 104: , 105: , 106: 107
// that.detail.liveStatus = res.liveStatus;
// })
// .catch(err => {
// console.log('get live status', err);
// });
}
}
}
};
</script>
<style lang="scss">
.sp-live-card {
width: 344rpx;
box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22);
border-radius: 20rpx;
height: 100%;
overflow: auto;
margin-bottom: 20rpx;
}
.live-content {
position: relative;
width: 344rpx;
height: 344rpx;
overflow: hidden;
.item-cover {
background-color: #eee;
width: 100%;
height: 100%;
border-radius: 20rpx 20rpx 0 0;
}
.item-status {
position: absolute;
top: 20rpx;
left: 10rpx;
height: 40rpx;
background: rgba(0, 0, 0, 0.4);
border-radius: 20rpx;
display: flex;
justify-content: center;
align-items: center;
.status-img {
width: 40rpx;
height: 40rpx;
}
.status-text {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
padding: 0 10rpx;
}
}
.item-title {
width: 345rpx;
position: absolute;
bottom: 0;
line-height: 60rpx;
padding: 0 20rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
background: linear-gradient(transparent, rgba(#000, 0.5));
padding-right: 60rpx;
}
.like-img {
position: absolute;
bottom: 20rpx;
right: 10rpx;
width: 60rpx;
height: 130rpx;
}
}
.live-bottom {
background-color: #fff;
padding: 20rpx;
width: 345rpx;
.live-info {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.info-box {
display: flex;
align-items: center;
}
.info-avatar {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
margin-right: 10rpx;
background: #eee;
}
.info-name {
width: 150rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(51, 51, 51, 1);
}
.views {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
}
.live-goods {
display: flex;
align-items: center;
margin-top: 20rpx;
&__item {
position: relative;
width: 96rpx;
height: 96rpx;
border: 1rpx solid rgba(238, 238, 238, 1);
border-radius: 10rpx;
overflow: hidden;
margin-right: 8rpx;
&:nth-child(3n) {
margin-right: 0;
}
}
&__img {
background: #eee;
width: 100%;
height: 100%;
}
&__price {
position: absolute;
bottom: 0;
line-height: 40rpx;
width: 100%;
background: linear-gradient(transparent, rgba(#000, 0.5));
font-size: 20rpx;
color: #fff;
}
&__mark {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
margin: auto;
display: flex;
justify-content: center;
align-items: center;
background: rgba(#000, 0.3);
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
}
}
</style>

343
components/StorePoster.vue

@ -29,19 +29,8 @@
<view class="save-poster" @click="savePosterPath">生成图片</view> <view class="save-poster" @click="savePosterPath">生成图片</view>
</view>--> </view>-->
<view class="poster-pop" v-show="canvasStatus"> <view class="poster-pop" v-show="canvasStatus">
<img <img src="@/static/images/poster-close.png" class="close" @click="posterImageClose" mode="widthFix" />
src="@/static/images/poster-close.png" <image :src="posterImage" alt="tp" class="poster-image" show-menu-by-longpress mode="widthFix" />
class="close"
@click="posterImageClose"
mode="widthFix"
/>
<image
:src="posterImage"
alt="tp"
class="poster-image"
show-menu-by-longpress
mode="widthFix"
/>
<view class="keep">长按图片可以保存到手机</view> <view class="keep">长按图片可以保存到手机</view>
</view> </view>
<view class="mask"></view> <view class="mask"></view>
@ -49,163 +38,187 @@
</template> </template>
<script> <script>
// import html2canvas from "html2canvas"; // import html2canvas from "html2canvas";
import { PosterCanvas } from "@/utils"; import {
import { getProductPoster } from "@/api/store"; PosterCanvas
} from "@/utils";
export default { import {
name: "StorePoster", getProductPoster
props: { } from "@/api/store";
posterImageStatus: Boolean,
posterData: Object, export default {
goodId: String name: "StorePoster",
}, props: {
data: function() { posterImageStatus: Boolean,
return { posterData: Object,
canvasStatus: false, goodId: String
posterImage: "" },
}; data: function () {
}, return {
watch: { canvasStatus: false,
posterImageStatus: function() { posterImage: ""
var that = this; };
if (that.posterImageStatus === true) { },
that.$nextTick(function() { watch: {
that.savePosterPath(); posterImageStatus: function () {
}); var that = this;
if (that.posterImageStatus === true) {
that.$nextTick(function () {
that.savePosterPath();
});
}
} }
}
},
mounted: function() {},
methods: {
posterImageClose: function() {
this.posterImageStatus = false;
this.canvasStatus = false;
this.$emit("setPosterImageStatus");
}, },
savePosterPath: function() { mounted: function () {},
const that = this; methods: {
posterImageClose: function () {
uni.showLoading({ title: "海报生成中", mask: true }); this.posterImageStatus = false;
getProductPoster(this.goodId) this.canvasStatus = false;
.then(res => { this.$emit("setPosterImageStatus");
this.canvasStatus = true; },
this.posterImage = res.data; savePosterPath: function () {
}) const that = this;
.finally(() => {
uni.hideLoading(); uni.showLoading({
title: "海报生成中",
mask: true
}); });
// return; getProductPoster(this.goodId, {
// // from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
// that.posterImage = ""; })
// uni.showLoading({ title: "", mask: true }); .then(res => {
// console.log(this); this.canvasStatus = true;
// var prodId = that.$yrouter.currentRoute.query.id; this.posterImage = res.data;
// uni.downloadFile({ })
// url: .finally(() => {
// this.$VUE_APP_API_URL + uni.hideLoading();
// "/shareImg/" + });
// prodId + // return;
// "?shareImgName=" + // //
// this.posterData.code, // that.posterImage = "";
// fail: function(res) {}, // uni.showLoading({ title: "", mask: true });
// success: function(res) { // console.log(this);
// console.log(res); // var prodId = that.$yrouter.currentRoute.query.id;
// that.canvasStatus = true; // uni.downloadFile({
// that.posterImage = res.tempFilePath; // url:
// uni.hideLoading(); // this.$VUE_APP_API_URL +
// } // "/shareImg/" +
// }); // prodId +
// "?shareImgName=" +
// this.posterData.code,
// fail: function(res) {},
// success: function(res) {
// console.log(res);
// that.canvasStatus = true;
// that.posterImage = res.tempFilePath;
// uni.hideLoading();
// }
// });
}
} }
} };
};
</script> </script>
<style scoped lang="less" lang="less"> <style scoped lang="less" lang="less">
.poster-first { .poster-first {
overscroll-behavior: contain; overscroll-behavior: contain;
} }
.poster-pop {
width: 4.5 * 100rpx; .poster-pop {
height: 8 * 100rpx; width: 4.5 * 100rpx;
position: fixed; height: 8 * 100rpx;
left: 50%; position: fixed;
transform: translateX(-50%); left: 50%;
z-index: 99; transform: translateX(-50%);
top: 50%; z-index: 99;
margin-top: -4.6 * 100rpx; top: 50%;
} margin-top: -4.6 * 100rpx;
.poster-pop .canvas { }
background-color: #ffffff;
height: 8 * 100rpx; .poster-pop .canvas {
} background-color: #ffffff;
.poster-pop .poster-image { height: 8 * 100rpx;
width: 100%; }
height: auto;
} .poster-pop .poster-image {
.poster-pop .canvas .image { width: 100%;
width: 4.5 * 100rpx; height: auto;
height: 4.5 * 100rpx; }
display: block;
} .poster-pop .canvas .image {
.poster-pop .canvas .text { width: 4.5 * 100rpx;
text-align: center; height: 4.5 * 100rpx;
color: #000000; display: block;
margin-top: 0.32 * 100rpx; }
}
.poster-pop .canvas .text.black { .poster-pop .canvas .text {
height: 0.68 * 100rpx; text-align: center;
} color: #000000;
.poster-pop .canvas .text.rad { margin-top: 0.32 * 100rpx;
color: #ff0000; }
}
.poster-pop .canvas .code { .poster-pop .canvas .text.black {
height: 1.4 * 100rpx; height: 0.68 * 100rpx;
display: flex; }
}
.poster-pop .canvas .code .code-img { .poster-pop .canvas .text.rad {
width: 33%; color: #ff0000;
padding: 0.06 * 100rpx; }
}
.poster-pop .canvas .code .code-img image { .poster-pop .canvas .code {
width: 100%; height: 1.4 * 100rpx;
} display: flex;
.poster-pop .canvas .code .code-text { }
width: 60%;
font-size: 0.12 * 100rpx; .poster-pop .canvas .code .code-img {
line-height: 1.64 * 100rpx; width: 33%;
} padding: 0.06 * 100rpx;
.poster-pop .close { }
width: 0.46 * 100rpx;
height: 0.75 * 100rpx; .poster-pop .canvas .code .code-img image {
position: fixed; width: 100%;
right: 0; }
top: -0.73 * 100rpx;
display: block; .poster-pop .canvas .code .code-text {
} width: 60%;
.poster-pop .save-poster { font-size: 0.12 * 100rpx;
background-color: #df2d0a; line-height: 1.64 * 100rpx;
font-size: 0.22 * 100rpx; }
color: #fff;
text-align: center; .poster-pop .close {
height: 0.76 * 100rpx; width: 0.46 * 100rpx;
line-height: 0.76 * 100rpx; height: 0.75 * 100rpx;
width: 100%; position: fixed;
margin-top: -0.04 * 100rpx; right: 0;
} top: -0.73 * 100rpx;
.poster-pop .keep { display: block;
color: #fff; }
text-align: center;
font-size: 0.25 * 100rpx; .poster-pop .save-poster {
margin-top: 0.1 * 100rpx; background-color: #df2d0a;
} font-size: 0.22 * 100rpx;
.mask { color: #fff;
position: fixed; text-align: center;
top: 0; height: 0.76 * 100rpx;
left: 0; line-height: 0.76 * 100rpx;
right: 0; width: 100%;
bottom: 0; margin-top: -0.04 * 100rpx;
background-color: rgba(0, 0, 0, 0.6); }
z-index: 9;
} .poster-pop .keep {
color: #fff;
text-align: center;
font-size: 0.25 * 100rpx;
margin-top: 0.1 * 100rpx;
}
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
z-index: 9;
}
</style> </style>

78
components/UserEvaluation.vue

@ -1,50 +1,52 @@
<template> <template>
<view class="evaluateWtapper"> <view class="evaluateWtapper" v-if="reply&&reply.length>0">
<view <view v-for="(item, evaluateWtapperIndex) in reply" :key="evaluateWtapperIndex">
class="evaluateItem" <view class="evaluateItem" v-if="item">
v-for="(item, evaluateWtapperIndex) in reply" <view class="pic-text acea-row row-middle">
:key="evaluateWtapperIndex" <view class="pictrue">
> <image :src="item.avatar" class="image" />
<view class="pic-text acea-row row-middle"> </view>
<view class="pictrue"> <view class="acea-row row-middle">
<image :src="item.avatar" class="image" /> <view class="name line1">{{ item.nickname }}</view>
<view class="start" :class="'star' + item.star"></view>
</view>
</view> </view>
<view class="acea-row row-middle"> <view class="time">{{ item.createTime }} {{ item.sku||'' }}</view>
<view class="name line1">{{ item.nickname }}</view> <view class="evaluate-infor">{{ item.comment }}</view>
<view class="start" :class="'star' + item.star"></view> <view class="imgList acea-row">
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">
<image :src="itemn" class="image" />
</view>
</view> </view>
</view> <view class="reply" v-if="item.merchantReplyContent">
<view class="time">{{ item.createTime }} {{ item.sku||'' }}</view> <span class="font-color-red">yshop店员</span>
<view class="evaluate-infor">{{ item.comment }}</view> {{item.merchantReplyContent}}
<view class="imgList acea-row">
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">
<image :src="itemn" class="image" />
</view> </view>
</view> </view>
<view class="reply" v-if="item.merchantReplyContent">
<span class="font-color-red">yshop店员</span>
{{item.merchantReplyContent}}
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { dataFormat } from "@/utils"; import {
dataFormat
} from "@/utils";
export default { export default {
name: "UserEvaluation", name: "UserEvaluation",
props: { props: {
reply: { reply: {
type: Array, type: Array,
default: () => [] default: () => []
}
},
data: function () {
return {};
},
mounted: function () {
console.log(this)
},
methods: {
dataFormat
} }
}, };
data: function() {
return {};
},
mounted: function() {},
methods: {
dataFormat
}
};
</script> </script>

40
components/sh-activity-goods.vue

@ -0,0 +1,40 @@
<template>
<view class="min-goods" @tap="jump('/pages/activity/GroupDetails/index', { id: detail.id })">
<view class="img-box">
<view class="tag" >{{ detail.people}}人团</view>
<image class="img" :src="detail.image" mode="widthFix"></image>
</view>
<view class="price-box">
<view class="y-f">
<text class="seckill-current">{{ detail.price }}</text>
<text class="original">销量{{ detail.sales }}{{detail.unitName}}</text>
</view>
</view>
<view class="title"><slot name="titleText"></slot></view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {};
},
props: {
detail: Object
},
computed: {},
methods: {
//
jump(path, query) {
this.$yrouter.push({
path,
query
});
}
}
};
</script>
<style lang="scss">
</style>

256
components/sh-adv.vue

@ -0,0 +1,256 @@
<template>
<view class="adv-box mx20 mb10">
<!-- 模板1-->
<view class="x-f" v-if="detail.style == 1">
<image style="width:710rpx;height: 220rpx;" @tap="jump(detail.list[0].path)" :src="detail.list[0].image"
mode="aspectFill"></image>
</view>
<!-- 模板2-->
<view class="type1 x-f" v-if="detail.style == 2">
<image class="type1-img" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill">
</image>
<image class="type1-img" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill">
</image>
</view>
<!-- 模板3-->
<view class="type2 x-bc" v-if="detail.style == 3">
<image class="type2-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill">
</image>
<view class="y-f type2-box">
<image class="type2-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"
style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type2-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image"
mode="aspectFill"></image>
</view>
</view>
<!-- 模板4-->
<view class="type3 x-bc" v-if="detail.style == 4">
<view class="type3-box y-f">
<image class="type3-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image"
mode="aspectFill"></image>
<image class="type3-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image"
mode="aspectFill"></image>
</view>
<image class="type3-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill">
</image>
</view>
<!-- 模板5-->
<view class="type4 y-f" v-if="detail.style == 5">
<view class="type4-box x-f">
<image class="type4-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image"
mode="aspectFill"></image>
<image class="type4-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image"
mode="aspectFill"></image>
</view>
<image class="type4-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image" mode="aspectFill">
</image>
</view>
<!-- 模板6-->
<view class="type5 y-f" v-if="detail.style == 6">
<image class="type5-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image" mode="aspectFill">
</image>
<view class="type5-box x-bc">
<image class="type5-img2" @tap="jump(detail.list[1].path)" :src="detail.list[1].image" mode="aspectFill"
style="border-bottom:1rpx solid #f6f6f6"></image>
<image class="type5-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image"
mode="aspectFill"></image>
</view>
</view>
<!-- 模板7-->
<view class="type6 y-f" v-if="detail.style == 7">
<view class="x-f type6-box1">
<image class="type6-img1" @tap="jump(detail.list[0].path)" :src="detail.list[0].image"
mode="aspectFill"></image>
<image class="type6-img1" @tap="jump(detail.list[1].path)" :src="detail.list[1].image"
mode="aspectFill"></image>
</view>
<view class="x-f type6-box2">
<image class="type6-img2" @tap="jump(detail.list[2].path)" :src="detail.list[2].image"
mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[3].path)" :src="detail.list[3].image"
mode="aspectFill"></image>
<image class="type6-img2" @tap="jump(detail.list[4].path)" :src="detail.list[4].image"
mode="aspectFill"></image>
</view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
detail: {
"list": [{
"image": "https:\/\/wx.yixiang.co\/static\/images\/index001.png",
"name": "",
"path": "/pages/user/coupon/GetCoupon/index",
"path_name": "优惠券",
"path_type": 1
}, {
"image": "https:\/\/wx.yixiang.co\/static\/images\/index002.png",
"name": "",
"path": "/pages/shop/GoodsList/index",
"path_name": "商品",
"path_type": 1
}, {
"image": "https:\/\/wx.yixiang.co\/static\/images\/index003.png",
"name": "",
"path": "/pages/user/signIn/Integral/index",
"path_name": "积分",
"path_type": 1
}],
"name": "",
"style": 3
}
};
},
props: {},
computed: {},
created() {},
methods: {
//
jump(path) {
this.$yrouter.push({
path
});
}
}
};
</script>
<style lang="scss">
.adv-box {
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
image{
width: 100%;
}
.type1 {
.type1-img {
flex: 1;
height: 220rpx;
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type2 {
.type2-img1 {
width: (710rpx/2);
height: 340rpx;
border-right: 1rpx solid #f6f6f6;
}
.type2-box {
flex: 1;
height: 340rpx;
width: (710rpx/2);
.type2-img2 {
height: (340rpx/2);
}
}
}
.type3 {
.type3-box {
width: (710rpx/2);
border-right: 1rpx solid #f6f6f6;
.type3-img1 {
flex: 1;
height: (340rpx/2);
&:first-child {
border-bottom: 1rpx solid #f6f6f6;
}
}
}
.type3-img2 {
flex: 1;
height: 340rpx;
width: (710rpx/2);
}
}
.type4 {
.type4-box {
border-bottom: 1rpx solid #f6f6f6;
.type4-img1 {
flex: 1;
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type4-img2 {
flex: 1;
height: (340rpx/2);
width: 710rpx;
}
}
.type5 {
.type5-img1 {
width: 710rpx;
height: (340rpx/2);
border-bottom: 1rpx solid #f6f6f6;
}
.type5-box {
flex: 1;
height: (340rpx/2);
width: 710rpx;
.type5-img2 {
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
}
.type6 {
.type6-box1 {
.type6-img1 {
width: (710rpx/2);
height: (340rpx/2);
&:first-child {
border-right: 1rpx solid #f6f6f6;
}
}
}
.type6-box2 {
border-top: 1rpx solid #f6f6f6;
.type6-img2 {
width: (710rpx/3);
height: (340rpx/2);
border-right: 1rpx solid #f6f6f6;
&:last-child {
border-right: 0;
}
}
}
}
image {
// background-color: #ccc;
}
}
</style>

197
components/sh-groupon.vue

@ -0,0 +1,197 @@
<template>
<!-- 今日必拼 -->
<view class="group-goods pa20 mx20 mb10">
<view class="title-box x-bc" @tap="jump('/pages/activity/GoodsGroup/index')">
<text class="title">超值拼团</text>
<view class="group-people x-f">
<text class="tip">更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id">
<sh-activity-goods :detail="mgoods" class="goods-item">
<!-- <block slot="titleText">立减8.5</block> -->
</sh-activity-goods>
</block>
</view>
</swiper-item>
</swiper>
<view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text>
</view>
</view>
</view>
</template>
<script>
import shActivityGoods from './sh-activity-goods.vue';
export default {
name: 'shGroupon',
components: {
shActivityGoods
},
data() {
return {
goodsList: [],
swiperCurrent: 0
};
},
props: {
detail: Array
},
computed: {},
created() {},
watch: {
detail(next) {
this.goodsList = this.sortData(next, 4);
}
},
methods: {
swiperChange(e) {
this.swiperCurrent = e.detail.current;
},
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
jump(path, query) {
this.$yrouter.push({
path,
query,
});
},
}
};
</script>
<style lang="scss">
.swiper-box,
.carousel {
width: 700rpx;
height: 240upx;
position: relative;
border-radius: 20rpx;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
background: #ccc;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0rpx;
z-index: 66;
.dot {
width: 45rpx;
height: 3rpx;
background: #eee;
border-radius: 50%;
margin-right: 10rpx;
}
.dot-active {
width: 45rpx;
height: 3rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
// +
.group-goods {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.title-box {
padding-bottom: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.group-people {
.time-box {
font-size: 26rpx;
color: #edbf62;
.count-text-box {
width: 30rpx;
height: 34rpx;
background: #edbf62;
text-align: center;
line-height: 34rpx;
font-size: 24rpx;
border-radius: 6rpx;
color: rgba(#fff, 0.9);
margin: 0 8rpx;
}
}
.head-box {
.head-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ccc;
}
}
.tip {
font-size: 28rpx;
padding-left: 30rpx;
color: #666;
}
.cuIcon-right {
font-size: 30rpx;
line-height: 28rpx;
color: #666;
}
}
}
.goods-box {
.goods-item {
margin-right: 22rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
}
</style>

8
config/index.js

@ -1,5 +1,5 @@
// 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 = 'http://127.0.0.1:8008/api';
// export const VUE_APP_API_URL = 'https://h5api.dayouqiantu.cn/api'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';
export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static';

164
libs/order.js

@ -73,80 +73,120 @@ export function delOrderHandle(orderId) {
} }
// 使用订单号进行支付 // 使用订单号进行支付
export function payOrderHandle(orderId, type, from) { export async function payOrderHandle(orderId, type, from) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// dialog.loading.open(""); uni.showLoading({
title: "支付中",
mask: true
});
payOrder(orderId, type, from) payOrder(orderId, type, from)
.then(res => { .then(async res => {
handleOrderPayResults(res.data) await handleOrderPayResults(res.data, type)
resolve()
}) })
.catch(err => { .catch(err => {
dialog.loading.close(); reject()
dialog.toast({ mes: err.msg || "订单支付失败" }); uni.hideLoading()
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message || '订单支付失败',
icon: "none",
duration: 2000,
});
}); });
}); });
} }
// 处理调用支付接口的逻辑 // 处理调用支付接口的逻辑
// @type create(创建订单)||pay(支付订单) // @type create(创建订单)||pay(支付订单)
export function handleOrderPayResults(data, type) { export function handleOrderPayResults(data, type, payType) {
switch (data.status) { console.log(data, type, payType)
// 订单号已存在
case "ORDER_EXIST": console.log(data, type)
// 取消支付 return new Promise((resolve, reject) => {
case "EXTEND_ORDER": uni.hideLoading()
uni.showToast({ switch (data.status) {
title: res.msg, // 订单号已存在
icon: "none", case "ORDER_EXIST":
duration: 2000, resolve()
}); break;
goOrderDetails(data.result.orderId, type) // 取消支付
break; case "EXTEND_ORDER":
case "PAY_DEFICIENCY": uni.showToast({
break; title: data.msg,
// 支付出错 icon: "none",
case "PAY_ERROR": duration: 2000,
uni.showToast({ });
title: res.msg, resolve()
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
// 未传递支付环境
case "SUCCESS":
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
// H5支付
case "WECHAT_H5_PAY":
goOrderDetails(data.result.orderId, type)
console.log(data)
setTimeout(() => {
// #ifdef H5
// "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx15171343713577e9f3a418b0865ef90000&package=2547890641"
// location.href = data.result.jsConfig.mweb_url;
// #endif
}, 100);
break;
// 小程序支付
case "WECHAT_PAY":
weappPay(data.result.jsConfig).finally(() => {
goOrderDetails(data.result.orderId, type) goOrderDetails(data.result.orderId, type)
}); break;
break; case "PAY_DEFICIENCY":
// APP支付 break;
case "WECHAT_APP_PAY": // 支付出错
case "PAY_ERROR":
weappPay(data.result.jsConfig).finally(() => { uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
reject()
goOrderDetails(data.result.orderId, type) goOrderDetails(data.result.orderId, type)
}); break;
break; // 未传递支付环境
} case "SUCCESS":
uni.showToast({
title: data.msg || data.payMsg,
icon: "none",
duration: 2000,
});
resolve()
goOrderDetails(data.result.orderId, type)
break;
// H5支付
case "WECHAT_H5_PAY":
goOrderDetails(data.result.orderId, type)
console.log(data)
setTimeout(() => {
resolve()
// #ifdef H5
// "https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx15171343713577e9f3a418b0865ef90000&package=2547890641"
// location.href = data.result.jsConfig.mweb_url;
// #endif
}, 100);
break;
// 小程序支付
case "WECHAT_PAY":
weappPay(data.result.jsConfig).finally(() => {
resolve()
goOrderDetails(data.result.orderId, type)
}).then(res => {
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
})
break;
// APP支付
case "WECHAT_APP_PAY":
weappPay(data.result.jsConfig).finally(() => {
resolve()
goOrderDetails(data.result.orderId, type)
})
break;
}
})
}
export function subscribeMessage() {
// 调用订阅
console.log('调用订阅')
uni.requestSubscribeMessage({
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg', 'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'],
success(res) {
console.log(res)
},
fail(error){
console.log(error)
}
})
} }

25
libs/wechat.js

@ -1,3 +1,4 @@
import { subscribeMessage } from "@/libs/order";
import { getProvider } from "@/utils"; import { getProvider } from "@/utils";
import WechatJSSDK from "wechat-jssdk/dist/client.umd"; import WechatJSSDK from "wechat-jssdk/dist/client.umd";
import { getWechatConfig, wechatAuth } from "@/api/public"; import { getWechatConfig, wechatAuth } from "@/api/public";
@ -9,7 +10,6 @@ import dayjs from "dayjs";
// 支付模块 // 支付模块
export const weappPay = (option) => { export const weappPay = (option) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(option)
if (store.state.$deviceType == 'weixinh5') { if (store.state.$deviceType == 'weixinh5') {
setTimeout(() => { setTimeout(() => {
location.href = option.mweb_url; location.href = option.mweb_url;
@ -59,11 +59,16 @@ export const weappPay = (option) => {
clearTimeout(time) clearTimeout(time)
resolve(success) resolve(success)
}, 3000) }, 3000)
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
}, },
fail: (error) => { fail: (error) => {
console.log(error) console.log(error)
if (error.errMsg == 'requestPayment:fail cancel') { if (error.errMsg == 'requestPayment:fail cancel') {
uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 }); uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 });
} else {
uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 });
} }
reject(error) reject(error)
} }
@ -119,6 +124,7 @@ export function clearAuthStatus() {
export function oAuth() { export function oAuth() {
console.log('处理微信授权') console.log('处理微信授权')
console.log('处理微信授权cookie',cookie.get("spread"))
console.log(store) console.log(store)
console.log(store.state) console.log(store.state)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -142,8 +148,7 @@ export function auth(code) {
console.log('获取微信授权') console.log('获取微信授权')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE); let loginType = cookie.get(LOGINTYPE);
debugger wechatAuth(code, cookie.get("spread"), loginType)
wechatAuth(code, parseInt(cookie.get("spread")), loginType)
.then(({ data }) => { .then(({ data }) => {
console.log(data) console.log(data)
const expires_time = dayjs(data.expires_time); const expires_time = dayjs(data.expires_time);
@ -152,12 +157,10 @@ export function auth(code) {
cookie.set(WX_AUTH, code, expires_time); cookie.set(WX_AUTH, code, expires_time);
cookie.remove(STATE_KEY); cookie.remove(STATE_KEY);
loginType && cookie.remove(LOGINTYPE); loginType && cookie.remove(LOGINTYPE);
debugger
resolve(); resolve();
}) })
.catch(reject); .catch(reject);
}).catch(error => { }).catch(error => {
debugger
console.log(error) console.log(error)
}) })
} }
@ -347,12 +350,20 @@ export function wxShowLocation() {
cancel() { cancel() {
cookie.remove(LATITUDE); cookie.remove(LATITUDE);
cookie.remove(LONGITUDE); cookie.remove(LONGITUDE);
this.$dialog.error("取消获取位置"); uni.showToast({
title: "取消获取位置",
icon: "none",
duration: 2000,
});
}, },
fail() { fail() {
cookie.remove(LATITUDE); cookie.remove(LATITUDE);
cookie.remove(LONGITUDE); cookie.remove(LONGITUDE);
this.$dialog.error("授权失败"); uni.showToast({
title: "授权失败",
icon: "none",
duration: 2000,
});
} }
}); });
} }

2
main.js

@ -99,7 +99,9 @@ import {
ready, ready,
wxShowLocation, wxShowLocation,
} from '@/libs/wechat' } from '@/libs/wechat'
import { isWeixin } from '@/utils' import { isWeixin } from '@/utils'
// 判断是否是微信浏览器 // 判断是否是微信浏览器
if (isWeixin()) { if (isWeixin()) {
Vue.prototype.$deviceType = 'weixin' Vue.prototype.$deviceType = 'weixin'

11
manifest.json

@ -139,6 +139,14 @@
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示" "desc" : "你的位置信息将用于小程序位置接口的效果展示"
} }
},
"plugins" : {
"live-player-plugin" : {
//
"version" : "1.1.10",
// appidappid
"provider" : "wx2b03c6e691cd7370"
}
} }
}, },
"mp-alipay" : { "mp-alipay" : {
@ -164,6 +172,7 @@
"key" : "" "key" : ""
} }
} }
} },
"domain" : "h5.yixiang.co"
} }
} }

34
package-lock.json generated

@ -17,6 +17,21 @@
"defer-to-connect": "^1.0.1" "defer-to-connect": "^1.0.1"
} }
}, },
"@types/html5plus": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/@types/html5plus/download/@types/html5plus-1.0.1.tgz",
"integrity": "sha1-EjFll+Qvb4fLJbnJOGD1fNObOQY=",
"dev": true
},
"@types/uni-app": {
"version": "1.4.3",
"resolved": "https://registry.npm.taobao.org/@types/uni-app/download/@types/uni-app-1.4.3.tgz",
"integrity": "sha1-JRwBK9JAi2m/UB/g3I92rbOwV2w=",
"dev": true,
"requires": {
"vue": "^2.6.8"
}
},
"animate.css": { "animate.css": {
"version": "3.7.2", "version": "3.7.2",
"resolved": "https://registry.npm.taobao.org/animate.css/download/animate.css-3.7.2.tgz", "resolved": "https://registry.npm.taobao.org/animate.css/download/animate.css-3.7.2.tgz",
@ -193,6 +208,14 @@
"resolved": "https://registry.npm.taobao.org/mimic-response/download/mimic-response-1.0.1.tgz?cache=0&sync_timestamp=1589481629775&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-response%2Fdownload%2Fmimic-response-1.0.1.tgz", "resolved": "https://registry.npm.taobao.org/mimic-response/download/mimic-response-1.0.1.tgz?cache=0&sync_timestamp=1589481629775&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmimic-response%2Fdownload%2Fmimic-response-1.0.1.tgz",
"integrity": "sha1-SSNTiHju9CBjy4o+OweYeBSHqxs=" "integrity": "sha1-SSNTiHju9CBjy4o+OweYeBSHqxs="
}, },
"miniapp-color-thief": {
"version": "1.0.5",
"resolved": "https://registry.npm.taobao.org/miniapp-color-thief/download/miniapp-color-thief-1.0.5.tgz",
"integrity": "sha1-CdeHKwTUHIERDK9FbfVAOuOZ7iw=",
"requires": {
"quantize": "^1.0.2"
}
},
"mongodb": { "mongodb": {
"version": "3.4.1", "version": "3.4.1",
"resolved": "https://registry.npm.taobao.org/mongodb/download/mongodb-3.4.1.tgz", "resolved": "https://registry.npm.taobao.org/mongodb/download/mongodb-3.4.1.tgz",
@ -296,6 +319,11 @@
"once": "^1.3.1" "once": "^1.3.1"
} }
}, },
"quantize": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/quantize/download/quantize-1.0.2.tgz",
"integrity": "sha1-0lrCAKd7bXD0ASfKFxoQ4zyFRt4="
},
"regexp-clone": { "regexp-clone": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/regexp-clone/download/regexp-clone-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/regexp-clone/download/regexp-clone-1.0.0.tgz",
@ -379,6 +407,12 @@
"prepend-http": "^2.0.0" "prepend-http": "^2.0.0"
} }
}, },
"vue": {
"version": "2.6.12",
"resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.12.tgz",
"integrity": "sha1-9evU+mvShpQD4pqJau1JBEVskSM=",
"dev": true
},
"vue-ydui": { "vue-ydui": {
"version": "1.2.6", "version": "1.2.6",
"resolved": "https://registry.npm.taobao.org/vue-ydui/download/vue-ydui-1.2.6.tgz", "resolved": "https://registry.npm.taobao.org/vue-ydui/download/vue-ydui-1.2.6.tgz",

5
package.json

@ -14,7 +14,12 @@
"async-validator": "^3.2.4", "async-validator": "^3.2.4",
"dayjs": "^1.8.22", "dayjs": "^1.8.22",
"jweixin-module": "^1.6.0", "jweixin-module": "^1.6.0",
"miniapp-color-thief": "^1.0.5",
"vue-ydui": "^1.2.6", "vue-ydui": "^1.2.6",
"wechat-jssdk": "^5.0.4" "wechat-jssdk": "^5.0.4"
},
"devDependencies": {
"@types/html5plus": "^1.0.1",
"@types/uni-app": "^1.4.3"
} }
} }

28
pages.json

@ -39,7 +39,10 @@
{ {
"path": "pages/home/index", "path": "pages/home/index",
"style": { "style": {
"navigationBarTitleText": "yshop商城" "navigationBarTitleText": "yshop商城",
"navigationBarTextStyle": "white",
// "enablePullDownRefresh": true,
"navigationStyle": "custom"
} }
}, },
{ {
@ -90,6 +93,12 @@
"navigationBarTitleText": "商品收藏" "navigationBarTitleText": "商品收藏"
} }
}, },
{
"path": "pages/shop/GoodsFoot/index",
"style": {
"navigationBarTitleText": "我的足迹"
}
},
{ {
"path": "pages/shop/news/NewsDetail/index", "path": "pages/shop/news/NewsDetail/index",
"style": { "style": {
@ -401,13 +410,20 @@
"style": { "style": {
"navigationBarTitleText": "地图" "navigationBarTitleText": "地图"
} }
},
{
"path": "pages/shop/Live/LiveList/index",
"style": {
"navigationBarTitleText": "直播列表"
}
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "Yshop",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8" "backgroundColor": "#F8F8F8",
"navigationStyle": "default"
}, },
"tabBar": { "tabBar": {
"color": "#282828", "color": "#282828",
@ -415,9 +431,9 @@
"borderStyle": "black", "borderStyle": "black",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"height": "50px", "height": "50px",
"fontSize": "10px", "fontSize": "8px",
"iconWidth": "24px", "iconWidth": "16px",
"spacing": "3px", "spacing": "-3px",
"list": [{ "list": [{
"pagePath": "pages/home/index", "pagePath": "pages/home/index",
"iconPath": "static/icon-home.png", "iconPath": "static/icon-home.png",

15
pages/Loading/index.vue

@ -18,7 +18,7 @@ import { mapState, mapMutations, mapActions } from "vuex";
import { wxappAuth, getUser } from "@/api/user"; import { wxappAuth, getUser } from "@/api/user";
import dayjs from "dayjs"; import dayjs from "dayjs";
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie";
import { parseQuery, login, handleQrCode } from "@/utils"; import { parseQuery, login, handleQrCode ,getCurrentPageUrl,handleUrlParam} from "@/utils";
export default { export default {
name: "Loading", name: "Loading",
@ -26,8 +26,11 @@ export default {
return {}; return {};
}, },
onShow() { onShow() {
var url = handleQrCode(); var url = handleQrCode();
if(!url){
url = handleUrlParam(getCurrentPageUrl())
}
// //
if (url) { if (url) {
var spread = cookie.get("spread"); var spread = cookie.get("spread");
@ -44,7 +47,7 @@ export default {
} }
cookie.get("spread"); cookie.get("spread");
// this.toLaunch(); // this.toLaunch();
if (this.$deviceType == "app") { if (this.$deviceType == "app"||this.$deviceType == "h5") {
// this.toLaunch(); // this.toLaunch();
this.$yrouter.switchTab({ this.$yrouter.switchTab({
path: "/pages/home/index" path: "/pages/home/index"
@ -52,9 +55,9 @@ export default {
return; return;
} }
login().finally(() => { login().finally(() => {
// this.$yrouter.switchTab({ this.$yrouter.switchTab({
// path: "/pages/home/index" path: "/pages/home/index"
// }); });
}); });
}, },
methods: { methods: {

928
pages/activity/DargainDetails/index.vue

File diff suppressed because it is too large Load Diff

101
pages/activity/GoodsGroup/children/activity-card.vue

@ -0,0 +1,101 @@
<template>
<view class="activity-goods-box x-bc" @tap="jump('/pages/activity/GroupDetails/index', { id: id })">
<view class="img-box">
<slot name="tag"></slot>
<image class="img" :src="img" mode="aspectFill"></image>
</view>
<view class="goods-right y-bc">
<view class="title one-t">{{ title }}</view>
<view class="tip one-t">{{ info }}</view>
<view class="slod-end"><slot name="sell"></slot></view>
<view class=" price-box">
<view class="x-f">
<view class="current">{{ price }}</view>
<view class="original">{{ productPrice }}</view>
</view>
</view>
<slot name="btn"></slot>
</view>
</view>
</template>
<script>
export default {
name: 'activityCard',
components: {},
data() {
return {};
},
props: {
cId: 0,
img: '',
title: '',
info: '',
price: '',
productPrice: ''
},
computed: {},
created() {},
methods: {
//
jump(path, parmas) {
this.$yrouter.push({ path: path, query: parmas });
}
}
};
</script>
<style lang="scss">
.activity-goods-box {
padding: 40rpx 20rpx;
background: #fff;
.img-box {
margin-right: 20rpx;
width: 200rpx;
height: 200rpx;
overflow: hidden;
position: relative;
.img {
width: 200rpx;
height: 200rpx;
background-color: #ccc;
}
}
.goods-right {
width: 450rpx;
min-height: 200rpx;
align-items: flex-start;
position: relative;
.title {
font-size: 28rpx;
line-height: 28rpx;
width: 450rpx;
}
.tip {
font-size: 22rpx;
color: #a8700d;
width: 500rpx;
}
.price-box {
.current {
font-size: 28rpx;
font-weight: 500;
color: rgba(225, 33, 43, 1);
}
.original {
font-size: 22rpx;
font-weight: 400;
text-decoration: line-through;
color: rgba(153, 153, 153, 1);
margin-left: 14rpx;
}
}
}
}
</style>

298
pages/activity/GoodsGroup/index.vue

@ -1,90 +1,232 @@
<template> <template>
<view class="group-list" ref="container"> <view class="page_box">
<view class="list" v-if="combinationList.length>0"> <view class="content_box">
<view <scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore">
class="item acea-row row-between-wrapper" <view class="group-wrap">
v-for="(item, combinationListIndex) in combinationList" <view class="group-head x-bc">
:key="combinationListIndex" <text class="group-head__title">爆款拼团</text>
@click="link(item.id)" <text class="group-head__notice">省钱省心限时拼</text>
>
<view class="pictrue">
<image :src="item.image" />
</view>
<view class="text">
<view class="line1" v-text="item.title"></view>
<view class="acea-row">
<view class="team acea-row row-middle cart-color">
<view class="iconfont icon-pintuan"></view>
<view class="num" v-text="item.people + '人团'"></view>
</view>
</view> </view>
<view class="bottom acea-row row-between-wrapper"> <view class="group-box">
<view class="money"> <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"
<text class="num" v-text="item.price"></text> :price="groupon.price" :productPrice="groupon.productPrice">
<text class="y-money" v-text="'¥' + item.productPrice"></text> <block slot="tag">
</view> <view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
<view class="groupBnt bg-color-red"> </block>
去拼团 <block slot="sell">
<text class="iconfont icon-jiantou"></text> <view class="x-f">
<view class="sell-box">
<text class="cuIcon-hotfill"></text>
<text class="sell-num">已拼{{ groupon.sales }}</text>
</view>
<text class="group-num">{{ groupon.people || 0 }}人团</text>
</view>
</block>
<block slot="btn"><button class="cu-btn buy-btn"
@tap.stop="jump('/pages/activity/GroupDetails/index', { id: groupon.id })">马上拼</button></block>
</activity-card>
</view> </view>
</view> </view>
</view> </view>
</view> </scroll-view>
<Loading :loaded="status" :loading="loadingList"></Loading>
</view>
<view class="noCommodity" style="background-color: #fff;" v-if="combinationList.length === 0">
<view class="noPictrue">
<image src="@/static/images/noGood.png" class="image" />
</view>
</view> </view>
<Loading :loaded="loaded" :loading="loading"></Loading>
</view> </view>
</template> </template>
<script> <script>
import { getCombinationList } from "@/api/activity"; import activityCard from './children/activity-card.vue';
import Loading from "@/components/Loading"; import Loading from "@/components/Loading";
export default {
name: "GoodsGroup", import {
components: { getCombinationList
Loading } from "@/api/activity";
}, export default {
props: {}, components: {
data: function() { activityCard,
return { Loading
combinationList: [], },
status: false, // false true data() {
loading: false, // false true return {
page: 1, // emptyData: {
limit: 20, // img: '/static/imgs/empty/empty_goods.png',
loadingList: false tip: '还没有拼团商品噢,去首页看看吧~',
}; path: '/pages/index/index',
}, pathText: '去首页逛逛'
mounted: function() { },
// document.querySelector('body').setAttribute('style', 'background-color:#eb3729'); loaded: false,
this.getCombinationList(); loading: false,
}, lastPage: 0,
onReachBottom() { currentPage: 1,
!this.loadingList && this.getCombinationList(); limit: 10,
}, grouponList: []
methods: { };
getCombinationList: function() { },
var that = this; onLoad() {
if (that.loading) return; this.getGrouponList();
if (that.status) return;
getCombinationList({ page: that.page, limit: that.limit }).then(res => {
that.status = res.data.length < that.limit;
that.combinationList.push.apply(that.combinationList, res.data);
that.page++;
that.loading = false;
});
}, },
link: function(id) { onPullDownRefresh() {},
this.$yrouter.push({ computed: {},
path: "/pages/activity/GroupDetails/index", methods: {
query: { id } //
}); jump(path, parmas) {
this.$yrouter.push({
path: path,
query: parmas
});
},
//
loadMore() {
},
//
getGrouponList() {
let that = this;
if (this.loading || this.loaded) return;
this.loading = true;
getCombinationList({
page: that.currentPage,
limit: this.limit
}).then(res => {
that.grouponList = that.grouponList.concat(res.data.storeCombinationQueryVos)
this.currentPage++;
this.loaded = res.data.storeCombinationQueryVos.length < this.limit;
this.loading = false;
});
// that.$api('goods.grouponList', {
// page: that.currentPage
// }).then(res => {
// if (res.code === 1) {
// that.isLoading = false;
// that.grouponList = [...that.grouponList, ...res.data.data];
// // that.grouponList=[];
// that.lastPage = res.data.last_page;
// if (that.currentPage < res.data.last_page) {
// that.loadStatus = '';
// } else {
// that.loadStatus = 'over';
// }
// }
// });
}
},
onReachBottom() {
!this.loading && this.getGrouponList();
} }
} };
};
</script> </script>
<style lang="scss">
.group-wrap {
background: url('~@/static/images/index-bg.png') no-repeat;
background-size: 100% 374rpx;
}
.group-head {
padding: 0 25rpx;
height: 100rpx;
.group-head__title {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
.group-head__notice {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
}
.group-box {
width: 710rpx;
background: linear-gradient(#fff, #f5f5f5);
border-radius: 20rpx;
margin: 0 auto;
min-height: 1000rpx;
.goods-item {
border-radius: 20rpx;
overflow: hidden;
position: relative;
margin-bottom: 20rpx;
.tag {
position: absolute;
left: 0;
top: 10rpx;
z-index: 2;
line-height: 35rpx;
background: linear-gradient(132deg, rgba(255, 153, 93, 1), rgba(255, 99, 97, 1));
border-radius: 0px 18rpx 18rpx 0px;
padding: 0 10rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(255, 255, 255, 0.8);
}
/deep/.goods-right {
width: 460rpx;
.title {
width: 460rpx;
}
.tip {
width: 460rpx;
}
}
.buy-btn {
position: absolute;
right: 0;
bottom: -10rpx;
width: 160rpx;
height: 60rpx;
background: linear-gradient(90deg, rgba(254, 131, 42, 1), rgba(255, 102, 0, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(255, 104, 4, 0.22);
border-radius: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #fff;
padding: 0;
}
.group-num {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(153, 153, 153, 1);
margin-left: 20rpx;
}
.sell-box {
background: rgba(255, 224, 226, 0.3);
border-radius: 16rpx;
line-height: 32rpx;
padding: 0 10rpx;
.sell-num {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(247, 151, 156, 1);
}
.cuIcon-hotfill {
font-size: 26rpx;
color: #e1212b;
margin-right: 8rpx;
}
}
}
}
</style>

384
pages/activity/GoodsSeckill/index.vue

@ -5,6 +5,9 @@
</view> </view>
<scroll-view scroll-y="false" scroll-x="true"> <scroll-view scroll-y="false" scroll-x="true">
<view class="timeScroll"> <view class="timeScroll">
<div class="logoPic">
<image src="https://wx.yixiang.co/h5/img/baokuan.6313c8c8.png"></image>
</div>
<view v-for="(item, index) in timeList" :key="index"> <view v-for="(item, index) in timeList" :key="index">
<view v-if="active==index" class="timeItem active" @click="setTime(index)"> <view v-if="active==index" class="timeItem active" @click="setTime(index)">
<view class="time">{{ item.time }}</view> <view class="time">{{ item.time }}</view>
@ -19,26 +22,15 @@
</scroll-view> </scroll-view>
<view v-for="(item, index) in timeList" :key="index"> <view v-for="(item, index) in timeList" :key="index">
<view v-if="active == index"> <view v-if="active == index">
<view class="countDown font-color-red acea-row row-center-wrapper"> <!-- <view class="countDown font-color-red acea-row row-center-wrapper">
<view v-if="item.status === 0" class="activity">活动已结束</view> <view v-if="item.status === 0" class="activity">活动已结束</view>
<count-down <count-down :isDay="false" :tipText="'距结束仅剩 '" :dayText="false" :hourText="' : '" :minuteText="' : '"
:isDay="false" :secondText="false" :datatime="datatime" v-if="item.status === 1"></count-down>
:tipText="'距结束仅剩 '"
:dayText="false"
:hourText="' : '"
:minuteText="' : '"
:secondText="false"
:datatime="datatime"
v-if="item.status === 1"
></count-down>
<view v-if="item.status === 2" class="activity">活动即将开始</view> <view v-if="item.status === 2" class="activity">活动即将开始</view>
</view> </view> -->
<view class="list"> <view class="list">
<view <view class="item acea-row row-between-wrapper" v-for="(itemSeckill, indexSeckill) in seckillList"
class="item acea-row row-between-wrapper" :key="indexSeckill">
v-for="(itemSeckill, indexSeckill) in seckillList"
:key="indexSeckill"
>
<view class="pictrue"> <view class="pictrue">
<image :src="itemSeckill.image" /> <image :src="itemSeckill.image" />
</view> </view>
@ -46,28 +38,22 @@
<view class="line1" v-text="itemSeckill.title"></view> <view class="line1" v-text="itemSeckill.title"></view>
<view class="money"> <view class="money">
限时价 限时价
<text class="num font-color-red" v-text="'¥' + itemSeckill.price"></text> <text class="num font-color-red">{{itemSeckill.price||''}}</text>
</view> </view>
<view class="progress cart-color"> <view class="progress cart-color">
<view class="bg-red" :style="{ width: loading ? itemSeckill.percent + '%' : '' }"></view> <view class="bg-red" :style="{ width: loading ? itemSeckill.percent + '%' : '' }"></view>
<view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view> <view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view>
</view> </view>
</view> </view>
<view <view class="grab bg-color-red" v-if="item.status === 1 && itemSeckill.stock > 0"
class="grab bg-color-red" @click="goDetail(itemSeckill.id,item.status)">马上抢</view>
v-if="item.status === 1 && itemSeckill.stock > 0"
@click="goDetail(itemSeckill.id)"
>马上抢</view>
<view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view> <view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view>
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view> <view class="grab bg-color-red" @click="goDetail(itemSeckill.id,item.status)" v-if="item.status === 2">即将开始
</view>
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view> <view class="grab bg-color-red" v-if="item.status === 0">已结束</view>
</view> </view>
</view> </view>
<view <view class="noCommodity" style="background-color: #f5f5f5;" v-if="seckillList.length === 0 && page > 1">
class="noCommodity"
style="background-color: #fff;"
v-if="seckillList.length === 0 && page > 1"
>
<view class="noPictrue"> <view class="noPictrue">
<image src="@/static/images/noGood.png" class="image" /> <image src="@/static/images/noGood.png" class="image" />
</view> </view>
@ -77,185 +63,215 @@
</view> </view>
</template> </template>
<script> <script>
import { getSeckillConfig, getSeckillList } from "@/api/activity"; import {
import CountDown from "@/components/CountDown"; getSeckillConfig,
// import { Tab, Tabs } from "vant-weapp"; getSeckillList
import Loading from "@/components/Loading"; } from "@/api/activity";
import CountDown from "@/components/CountDown";
// import { Tab, Tabs } from "vant-weapp";
import Loading from "@/components/Loading";
export default { export default {
name: "GoodsSeckill", name: "GoodsSeckill",
components: { components: {
CountDown CountDown
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
headerImg: "", headerImg: "",
timeList: [], timeList: [],
sticky: false, sticky: false,
loading: false, loading: false,
datatime: 0, datatime: 0,
active: 0, active: 0,
seckillList: [], seckillList: [],
status: false, // false true status: false, // false true
loadingList: false, // false true loadingList: false, // false true
page: 1, // page: 1, //
limit: 5, // limit: 5, //
title: [] title: []
}; };
}, },
mounted: function() { mounted: function () {
this.mountedStart(); this.mountedStart();
},
onReachBottom() {
!this.loadingList && this.getSeckillList();
},
methods: {
changeTime: function(index) {
this.active = index;
this.getSeckillList();
}, },
mountedStart: function() { onReachBottom() {
var that = this; !this.loadingList && this.getSeckillList();
uni.showLoading(); },
getSeckillConfig().then(res => { methods: {
that.$set(that, "headerImg", res.data.lovely); changeTime: function (index) {
that.$set(that, "timeList", res.data.seckillTime); this.active = index;
that.$set(that, "active", res.data.seckillTimeIndex); this.getSeckillList();
},
mountedStart: function () {
var that = this;
uni.showLoading();
getSeckillConfig().then(res => {
that.$set(that, "headerImg", res.data.lovely);
that.$set(that, "timeList", res.data.seckillTime);
that.$set(that, "active", res.data.seckillTimeIndex);
let title = []; let title = [];
title = res.data.seckillTime.map((item, index) => { title = res.data.seckillTime.map((item, index) => {
return { return {
name: "div", name: "div",
attrs: { attrs: {
class: "timeItem" class: "timeItem"
}, },
children: [ children: [{
{ name: "div",
name: "div", attrs: {
attrs: { class: "time"
class: "time" },
}, children: [{
children: [
{
type: "text", type: "text",
text: item.time text: item.time
} }]
]
},
{
name: "div",
attrs: {
class: "state"
}, },
children: [ {
{ name: "div",
attrs: {
class: "state"
},
children: [{
type: "text", type: "text",
text: item.state text: item.state
} }]
] }
} ]
] };
}; });
that.$set(that, "title", title);
that.datatime = that.timeList[that.active].stop;
that.getSeckillList();
that.$nextTick(function () {
that.sticky = true;
uni.hideLoading();
});
}); });
that.$set(that, "title", title); },
setTime: function (index) {
var that = this;
that.page = 1;
that.loadingList = false;
that.status = false;
that.active = index;
that.datatime = that.timeList[that.active].stop; that.datatime = that.timeList[that.active].stop;
this.seckillList = [];
that.getSeckillList(); that.getSeckillList();
that.$nextTick(function() { },
that.sticky = true; getSeckillList: function () {
var that = this;
if (that.loadingList) return;
if (that.status) return;
var time = that.timeList[that.active].id;
getSeckillList(time, {
page: that.page,
limit: that.limit
}).then(res => {
that.status = res.data.length < that.limit;
that.seckillList.push.apply(that.seckillList, res.data);
that.page++;
uni.hideLoading(); uni.hideLoading();
}); });
}); },
}, goDetail: function (id, status) {
setTime: function(index) { var that = this;
var that = this; var time = that.timeList[that.active].stop;
that.page = 1; this.$yrouter.push({
that.loadingList = false; path: "/pages/activity/SeckillDetails/index",
that.status = false; query: {
that.active = index; id,
that.datatime = that.timeList[that.active].stop; time,
this.seckillList = []; status
that.getSeckillList(); }
}, });
getSeckillList: function() { }
var that = this;
if (that.loadingList) return;
if (that.status) return;
var time = that.timeList[that.active].id;
getSeckillList(time, {
page: that.page,
limit: that.limit
}).then(res => {
that.status = res.data.length < that.limit;
that.seckillList.push.apply(that.seckillList, res.data);
that.page++;
uni.hideLoading();
});
},
goDetail: function(id) {
var that = this;
var time = that.timeList[that.active].stop;
this.$yrouter.push({
path: "/pages/activity/SeckillDetails/index",
query: {
id,
time
}
});
} }
} };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.timeScroll { .flash-sale {
display: flex; background: #f5f5f5 !important;
align-items: center; height: 100%;
flex-direction: row; }
}
.timeItem { .timeScroll {
font-size: 0.22 * 100rpx; display: flex;
color: #282828; align-items: center;
width: 150rpx; flex-direction: row;
text-align: center; }
padding: 0.11 * 100rpx 0;
background-color: none; .list {
padding: 0 20rpx;
&.active { .item {
.time { padding: .25*100rpx;
color: #eb3729; border-bottom: 1px solid #f0f0f0;
height: auto;
position: relative;
background: #fff;
margin-bottom: .2*100rpx;
border-radius: .2*100rpx;
} }
}
.logoPic {
width: 75rpx;
height: 70rpx;
margin-left: 20rpx;
margin-right: 20rpx;
.state { image {
background-color: #eb3729; width: 75rpx;
color: #fff; height: 70rpx;
opacity: 1;
border-radius: 30rpx;
padding: 0 0.2 * 100rpx;
font-weight: 800;
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
} }
} }
}
.timeItem .time { .timeItem {
font-size: 0.32 * 100rpx; font-size: 0.22 * 100rpx;
font-weight: bold; color: #282828;
height: 0.37 * 100rpx; width: 150rpx;
line-height: 0.37 * 100rpx; text-align: center;
} padding: 20rpx 0;
background-color: none;
.timeItem .state { &.active {
height: 0.37 * 100rpx; .time {
line-height: 0.37 * 100rpx; color: #eb3729;
} }
.activity { .state {
color: #333; background: linear-gradient(90deg, #00c17b, #00c17b);
} color: #fff;
opacity: 1;
border-radius: 30rpx;
padding: 0 0.2 * 100rpx;
font-weight: 800;
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
}
}
}
.flash-sale .list .item .grab { .timeItem .time {
background-color: #999; font-size: 0.32 * 100rpx;
} font-weight: bold;
height: .5 * 100rpx;
line-height: .5 * 100rpx;
}
.timeItem .state {
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
}
.activity {
color: #333;
}
.flash-sale .list .item .grab {
background-color: #999;
}
</style> </style>

657
pages/activity/GroupDetails/index.vue

@ -1,12 +1,15 @@
<template> <template>
<view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus"> <view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus">
<!-- 商品轮播 -->
<product-con-swiper :imgUrls="imgUrls"></product-con-swiper> <product-con-swiper :imgUrls="imgUrls"></product-con-swiper>
<!-- 商品信息描述 -->
<view class="wrapper"> <view class="wrapper">
<view class="share acea-row row-between row-bottom"> <view class="share acea-row row-between row-bottom">
<view class="money font-color-red"> <view class="money font-color-red">
<text class="num" v-text="storeInfo.price"></text> <text class="num" v-text="storeInfo.price"></text>
<text class="y-money" v-text="'¥' + storeInfo.productPrice"></text> <!-- <text class="y-money" v-text="'¥' + storeInfo.productPrice"></text> -->
</view> </view>
</view> </view>
<view class="introduce" v-text="storeInfo.title"></view> <view class="introduce" v-text="storeInfo.title"></view>
@ -16,11 +19,22 @@
<view v-text="'已拼:' + storeInfo.sales + storeInfo.unitName"></view> <view v-text="'已拼:' + storeInfo.sales + storeInfo.unitName"></view>
</view> </view>
</view> </view>
<!-- 规格 -->
<view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
<view>
<text>{{ attrTxt }}</text>
<text class="atterTxt">{{ attrValue }}</text>
</view>
<view class="iconfont icon-jiantou"></view>
</view>
<!-- 拼团信息 -->
<view class="notice acea-row row-middle"> <view class="notice acea-row row-middle">
<view class="num font-color-red"> <view class="num font-color-red">
<text class="iconfont icon-laba"></text> <text class="iconfont icon-laba"></text>
已拼{{ storeInfo.sales 已拼{{ storeInfo.sales }}{{ storeInfo.unitName }}
}}{{ storeInfo.unitName }}
<text class="line">|</text> <text class="line">|</text>
</view> </view>
<view class="swiper-no-swiping swiper"> <view class="swiper-no-swiping swiper">
@ -33,6 +47,8 @@
</swiper> </swiper>
</view> </view>
</view> </view>
<!-- 拼团人数头像 -->
<view class="assemble"> <view class="assemble">
<view v-for="(item, groupListindex) in groupList" :key="groupListindex"> <view v-for="(item, groupListindex) in groupList" :key="groupListindex">
<view class="item acea-row row-between-wrapper" v-if="groupListindex < groupListCount"> <view class="item acea-row row-between-wrapper" v-if="groupListindex < groupListCount">
@ -49,15 +65,8 @@
<text class="font-color-red" v-text="item.count"></text> <text class="font-color-red" v-text="item.count"></text>
<text>人成团</text> <text>人成团</text>
</view> </view>
<count-down <count-down :isDay="false" :tipText="'剩余 '" :dayText="false" :hourText="':'" :minuteText="':'"
:isDay="false" :secondText="false" :datatime="item.stopTime/1000"></count-down>
:tipText="'剩余 '"
:dayText="false"
:hourText="':'"
:minuteText="':'"
:secondText="false"
:datatime="item.stopTime/1000"
></count-down>
</view> </view>
<view class="spellBnt" @click="groupRule(item.id)"> <view class="spellBnt" @click="groupRule(item.id)">
去拼单 去拼单
@ -71,6 +80,8 @@
<text class="iconfont icon-xiangxia"></text> <text class="iconfont icon-xiangxia"></text>
</view> </view>
</view> </view>
<!-- 拼团规则 -->
<view class="playWay"> <view class="playWay">
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view>拼团玩法</view> <view>拼团玩法</view>
@ -91,6 +102,8 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 用户评价 -->
<view class="userEvaluation"> <view class="userEvaluation">
<view class="title acea-row row-between-wrapper"> <view class="title acea-row row-between-wrapper">
<view v-text="'用户评价(' + replyCount + ')'"></view> <view v-text="'用户评价(' + replyCount + ')'"></view>
@ -101,278 +114,408 @@
</view> </view>
<UserEvaluation :reply="reply"></UserEvaluation> <UserEvaluation :reply="reply"></UserEvaluation>
</view> </view>
<!-- 产品介绍 -->
<view class="product-intro"> <view class="product-intro">
<view class="title">产品介绍</view> <view class="title">产品介绍</view>
<view class="conter" v-html="storeInfo.description"></view> <view class="conter" v-html="storeInfo.description"></view>
<!-- <view class="conter" v-html=""></view> --> <!-- <view class="conter" v-html=""></view> -->
</view> </view>
<!-- 操作栏 -->
<view style="height:100rpx;"></view> <view style="height:100rpx;"></view>
<view class="footer-group acea-row row-between-wrapper"> <view class="footer acea-row row-between-wrapper">
<!-- <view class="customerSer acea-row row-center-wrapper row-column"> <!-- #ifdef MP-WEIXIN -->
<view class="iconfont icon-kefu"></view> <view class="item">
<view>客服</view> <button open-type="contact" class='contacButton'>
</view>--> <view style="padding-bottom: 8rpx;" class="item">
<view class="customerSer acea-row row-center-wrapper row-column" @click="setCollect"> <view class="iconfont icon-kefu"></view>
<view class="iconfont" :class="userCollect ? 'icon-shoucang1' : 'icon-shoucang'"></view> <text>客服</text>
</view>
</button>
</view>
<!-- #endif -->
<view class="item" @click="setCollect" v-if="userCollect">
<view class="iconfont icon-shoucang1"></view>
<text>收藏</text>
</view>
<view class="item" @click="setCollect" v-if="!userCollect">
<view class="iconfont icon-shoucang"></view>
<text>收藏</text> <text>收藏</text>
</view> </view>
<view class="bnt bg-color-violet" @click="openAlone">单独购买</view> <view class="bnt acea-row">
<view class="bnt bg-color-red" @click="openTeam">立即开团</view> <view class="joinCart" @click="openAlone">
<text>单独购买</text>
</view>
<view class="buy" @click="openTeam">
<text>立即开团</text>
</view>
</view>
</view> </view>
<!-- 商品信息弹窗 -->
<ProductWindow v-if="cartNum" v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow> <ProductWindow v-if="cartNum" v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
<StorePoster <StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
v-on:setPosterImageStatus="setPosterImageStatus" :posterData="posterData"></StorePoster>
:posterImageStatus="posterImageStatus"
:posterData="posterData"
></StorePoster>
</view> </view>
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper"; // import { swiper, swiperSlide } from "vue-awesome-swiper";
import ProductConSwiper from "@/components/ProductConSwiper"; import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown"; import CountDown from "@/components/CountDown";
import UserEvaluation from "@/components/UserEvaluation"; import UserEvaluation from "@/components/UserEvaluation";
import ProductWindow from "@/components/ProductWindow"; import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster"; import StorePoster from "@/components/StorePoster";
import { getCombinationDetail } from "@/api/activity"; import {
import { postCartAdd } from "@/api/store"; getCombinationDetail
import { imageBase64 } from "@/api/public"; } from "@/api/activity";
import { import {
getCoupon, postCartAdd
getCollectAdd, } from "@/api/store";
getCollectDel, import {
getUserInfo imageBase64
} from "@/api/user"; } from "@/api/public";
const NAME = "GroupDetails"; import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
const NAME = "GroupDetails";
export default { export default {
name: "GroupDetails", name: "GroupDetails",
components: { components: {
ProductConSwiper, ProductConSwiper,
CountDown, CountDown,
UserEvaluation, UserEvaluation,
// swiper, // swiper,
// swiperSlide, // swiperSlide,
ProductWindow, ProductWindow,
StorePoster StorePoster
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
domStatus: false, domStatus: false,
posterData: { posterData: {
image: "",
title: "",
price: "",
code: ""
},
posterImageStatus: false,
reply: [],
replyCount: 0,
replyChance: 0,
imgUrls: [],
storeInfo: {},
itemNew: {},
groupListCount: 2,
groupList: {},
swiperTip: {
direction: "vertical",
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
},
attr: {
cartAttr: false,
productSelect: {
image: "", image: "",
store_name: "", title: "",
price: "", price: "",
stock: "", code: ""
unique: "", },
cart_num: 1 posterImageStatus: false,
reply: [],
replyCount: 0,
replyChance: 0,
imgUrls: [],
storeInfo: {},
itemNew: {},
groupListCount: 2,
groupList: {},
attrTxt: "请选择",
productValue: [],
attrValue: "",
swiperTip: {
direction: "vertical",
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
},
attr: {
cartAttr: false,
productAttr: [],
productSelect: {},
},
cartNum: 1,
userCollect: false
};
},
watch: {
$yroute: function (n) {
var that = this;
if (n.name === NAME) {
that.mountedStart();
} }
},
cartNum: 1,
userCollect: false
};
},
watch: {
$yroute: function(n) {
var that = this;
if (n.name === NAME) {
that.mountedStart();
} }
}
},
onShow: function() {
this.mountedStart();
},
methods: {
openAlone: function() {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: { id: this.storeInfo.productId }
});
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
}, },
// onShow: function () {
setCollect: function() { this.mountedStart();
let that = this, },
id = that.storeInfo.id, methods: {
category = "product"; onShareAppMessage: function() {
if (that.userCollect) { return {
getCollectDel(id, category).then(function() { title: this.storeInfo.title,
that.userCollect = !that.userCollect; imageUrl: this.storeInfo.image,
path: "pages/activity/GroupDetails/index?id="+this.storeInfo.id+"&spread=" + uni.getStorageSync("uid")+"&pageType=good&codeType=routine",
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
},
openAlone: function () {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: {
id: this.storeInfo.productId
}
}); });
} else { // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
getCollectAdd(id, category).then(function() { },
that.userCollect = !that.userCollect; //
setCollect: function () {
let that = this,
id = that.storeInfo.id,
category = "product";
if (that.userCollect) {
getCollectDel(id, category).then(function () {
that.userCollect = !that.userCollect;
});
} else {
getCollectAdd(id, category).then(function () {
that.userCollect = !that.userCollect;
});
}
},
mountedStart: function () {
var that = this;
let id = that.$yroute.query.id;
getCombinationDetail(id).then(res => {
that.userCollect = res.data.userCollect;
res.data.storeInfo.description = res.data.storeInfo.description.replace(
/\<img/gi,
'<img style="max-width:100%;height:auto;"'
);
that.$set(that.attr, "productAttr", res.data.productAttr);
that.$set(that, "productValue", res.data.productValue);
that.$set(that, "storeInfo", res.data.storeInfo);
that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr);
that.$set(that, "itemNew", res.data.pinkOkList);
that.$set(that, "groupList", res.data.pink);
that.$set(that, "reply", [res.data.reply]);
that.$set(that, "replyCount", res.data.replyCount);
that.$set(that, "replyChance", res.data.replyChance);
that.posterData.image = that.storeInfo.image;
if (that.storeInfo.title.length > 30) {
that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
} else {
that.posterData.title = that.storeInfo.title;
}
that.posterData.price = that.storeInfo.pinkPrice;
that.posterData.code = that.storeInfo.code_base;
that.domStatus = true;
console.log(this.storeInfo)
that.DefaultSelect();
}); });
} },
}, DefaultSelect: function () {
mountedStart: function() { let productAttr = this.attr.productAttr;
var that = this; let value = [];
let id = that.$yroute.query.id; for (let i = 0; i < productAttr.length; i++) {
getCombinationDetail(id).then(res => { this.$set(productAttr[i], "index", 0);
that.userCollect = res.data.userCollect; value.push(productAttr[i].attrValueArr[0]);
res.data.storeInfo.description = res.data.storeInfo.description.replace( }
/\<img/gi, //sort();:--
'<img style="max-width:100%;height:auto;"' let productSelect = this.productValue[value.sort().join(",")];
); console.log(productSelect)
that.$set(that, "storeInfo", res.data.storeInfo); if (productSelect && productAttr.length) {
that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr); this.$set(
that.$set(that, "itemNew", res.data.pinkOkList); this.attr.productSelect,
that.$set(that, "groupList", res.data.pink); "store_name",
that.$set(that, "reply", [res.data.reply]); this.storeInfo.title
that.$set(that, "replyCount", res.data.replyCount); );
that.$set(that, "replyChance", res.data.replyChance); this.$set(this.attr.productSelect, "image", productSelect.image);
that.setProductSelect(); this.$set(this.attr.productSelect, "price", productSelect.pinkPrice);
that.posterData.image = that.storeInfo.image; this.$set(this.attr.productSelect, "stock", productSelect.pinkStock);
if (that.storeInfo.title.length > 30) { this.$set(this.attr.productSelect, "unique", productSelect.unique);
that.posterData.title = that.storeInfo.title.substring(0, 30) + "..."; this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", value.sort().join(","));
this.$set(this, "attrTxt", "已选择");
} else if (!productSelect && productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.title
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.pinkPrice);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
} else if (!productSelect && !productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.title
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.pinkPrice);
this.$set(this.attr.productSelect, "stock", this.storeInfo.pinkStock);
this.$set(
this.attr.productSelect,
"unique",
this.storeInfo.unique || ""
);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
}
},
getImageBase64: function () {
let that = this;
imageBase64(this.posterData.image, that.posterData.code).then(res => {
that.posterData.image = res.data.image;
that.posterData.code = res.data.code;
});
},
setPosterImageStatus: function () {
// var sTop = document.body || document.documentElement;
// sTop.scrollTop = 0;
this.posterImageStatus = !this.posterImageStatus;
},
groupRule: function (id) {
var that = this;
that.$yrouter.push({
path: "/pages/activity/GroupRule/index",
query: {
id
}
});
},
goReply: function () {
var that = this;
that.$yrouter.push({
path: "/pages/shop/EvaluateList/index",
query: {
id: that.storeInfo.product_id
}
});
},
setGroupListCount: function () {
this.groupListCount = this.groupListCount + 2;
},
//
changeFun: function (opt) {
if (typeof opt !== "object") opt = {};
let action = opt.action || "";
let value = opt.value === undefined ? "" : opt.value;
this[action] && this[action](value);
},
changeattr: function (res) {
var that = this;
that.attr.cartAttr = res;
},
ChangeCartNum: function (res) {
var that = this;
that.attr.productSelect.cart_num = 1;
that.cartNum = 1;
uni.showToast({
title: "每人每次限购1" + that.storeInfo.unitName,
icon: "none",
duration: 2000
});
},
//
ChangeAttr: function (res) {
//
let productSelect = this.productValue[res.value];
if (productSelect) {
this.attr.productAttr[res.indexw].index = res.indexn;
this.$set(this.attr.productSelect, "image", productSelect.image);
this.$set(this.attr.productSelect, "price", productSelect.pinkPrice);
this.$set(this.attr.productSelect, "stock", productSelect.pinkStock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", res.value);
this.$set(this, "attrTxt", "已选择");
} else { } else {
that.posterData.title = that.storeInfo.title; this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.pinkPrice);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
} }
that.posterData.price = that.storeInfo.price; },
that.posterData.code = that.storeInfo.code_base;
that.domStatus = true; openTeam: function () {
console.log(this.storeInfo) var that = this;
//that.getImageBase64(); if (that.attr.cartAttr == false) {
}); that.attr.cartAttr = !this.attr.cartAttr;
}, } else {
getImageBase64: function() { var data = {};
let that = this; data.productId = that.storeInfo.productId;
imageBase64(this.posterData.image, that.posterData.code).then(res => { data.cartNum = that.attr.productSelect.cart_num;
that.posterData.image = res.data.image; data.uniqueId = that.attr.productSelect.unique;
that.posterData.code = res.data.code; data.combinationId = that.storeInfo.id;
}); data.new = 1;
}, postCartAdd(data)
setPosterImageStatus: function() { .then(res => {
// var sTop = document.body || document.documentElement; that.$yrouter.push({
// sTop.scrollTop = 0; path: "/pages/order/OrderSubmission/index",
this.posterImageStatus = !this.posterImageStatus; query: {
}, id: res.data.cartId
groupRule: function(id) { }
var that = this; });
that.$yrouter.push({ })
path: "/pages/activity/GroupRule/index", .catch(err => {
query: { id } uni.showToast({
}); title: err.msg || err.response.data.msg || err.response.data.message,
}, icon: "none",
goReply: function() { duration: 2000
var that = this; });
that.$yrouter.push({
path: "/pages/shop/EvaluateList/index",
query: { id: that.storeInfo.product_id }
});
},
setGroupListCount: function() {
this.groupListCount = this.groupListCount + 2;
},
//
changeFun: function(opt) {
if (typeof opt !== "object") opt = {};
let action = opt.action || "";
let value = opt.value === undefined ? "" : opt.value;
this[action] && this[action](value);
},
changeattr: function(res) {
var that = this;
that.attr.cartAttr = res;
},
ChangeCartNum: function(res) {
var that = this;
that.attr.productSelect.cart_num = 1;
that.cartNum = 1;
uni.showToast({
title: "每人每次限购1" + that.storeInfo.unitName,
icon: "none",
duration: 2000
});
},
setProductSelect: function() {
var that = this;
var attr = that.attr;
attr.productSelect.image = that.storeInfo.image;
attr.productSelect.store_name = that.storeInfo.title;
attr.productSelect.price = that.storeInfo.price+'';
attr.productSelect.stock = that.storeInfo.stock;
attr.cartAttr = false;
console.log(that.storeInfo)
that.$set(that, "attr", attr);
console.log(this)
},
openTeam: function() {
var that = this;
if (that.attr.cartAttr == false) {
that.attr.cartAttr = !this.attr.cartAttr;
} else {
var data = {};
data.productId = that.storeInfo.productId;
data.cartNum = that.attr.productSelect.cart_num;
data.uniqueId = that.attr.productSelect.unique;
data.combinationId = that.storeInfo.id;
data.new = 1;
postCartAdd(data)
.then(res => {
that.$yrouter.push({
path: "/pages/order/OrderSubmission/index",
query: { id: res.data.cartId }
});
})
.catch(err => {
uni.showToast({
title:
err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
}); });
}); }
} },
//
selecAttrTap: function () {
this.attr.cartAttr = true;
this.isOpen = true;
},
} }
} };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.product-con .wrapper { .product-con .wrapper {
padding-bottom: 0.26 * 100rpx; padding-bottom: 0.26 * 100rpx;
} }
.noscroll {
height: 100%; .noscroll {
overflow: hidden; height: 100%;
} overflow: hidden;
.product-con .footer-group .bnt { }
// flex:1;
width: 43%; .product-con .footer-group .bnt {
} // flex:1;
.product-con .footer-group .bnt.bg-color-violet { width: 43%;
background-color: #fa8013; }
}
.footer-group {
button {
border: 0;
background: none;
}
}
.product-con .footer-group .bnt.bg-color-violet {
background-color: #fa8013;
}
</style> </style>

4
pages/activity/GroupRule/index.vue

@ -111,6 +111,7 @@ export default {
pinkT: [], // pinkT: [], //
storeCombination: [], // storeCombination: [], //
pinkId: 0, pinkId: 0,
uniqueId: "",
count: 0, // count: 0, //
iShidden: false iShidden: false
}; };
@ -140,7 +141,7 @@ export default {
var data = {}; var data = {};
data.productId = that.storeCombination.productId; data.productId = that.storeCombination.productId;
data.cartNum = that.pinkT.totalNum; data.cartNum = that.pinkT.totalNum;
data.uniqueId = ""; data.uniqueId = that.uniqueId;
data.combinationId = that.storeCombination.id; data.combinationId = that.storeCombination.id;
data.new = 1; data.new = 1;
postCartAdd(data) postCartAdd(data)
@ -208,6 +209,7 @@ export default {
that.$set(that, "pinkBool", res.data.pinkBool); that.$set(that, "pinkBool", res.data.pinkBool);
that.$set(that, "isOk", res.data.isOk); that.$set(that, "isOk", res.data.isOk);
that.$set(that, "currentPinkOrder", res.data.currentPinkOrder); that.$set(that, "currentPinkOrder", res.data.currentPinkOrder);
that.$set(that, "uniqueId", res.data.uniqueId);
}); });
}, },
// //

128
pages/activity/Poster/index.vue

@ -9,71 +9,81 @@
</view> </view>
</template> </template>
<script> <script>
import { getBargainPoster, getCombinationPoster } from "@/api/activity"; import {
getBargainPoster,
getCombinationPoster
} from "@/api/activity";
export default { export default {
name: "Poster", name: "Poster",
components: {}, components: {},
props: {}, props: {},
data: function() { data: function () {
return { return {
status: true, status: true,
id: 0, id: 0,
image: "" image: ""
}; };
},
mounted: function() {
var that = this;
var id = that.$yroute.query.id;
var type = that.$yroute.query.type;
that.id = id;
if (type == 2) {
that.getBargainPoster();
} else {
that.getCombinationPoster();
}
},
methods: {
getBargainPoster: function() {
var that = this;
getBargainPoster({ bargainId: that.id, from: "wechat" })
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
}, },
// mounted: function () {
getCombinationPoster: function() {
var that = this; var that = this;
getCombinationPoster({ id: that.id, from: "wechat" }) var id = that.$yroute.query.id;
.then(res => { var type = that.$yroute.query.type;
that.image = res.data.url; that.id = id;
that.status = false; if (type == 2) {
}) that.getBargainPoster();
.catch(res => { } else {
uni.showToast({ that.getCombinationPoster();
title: res.msg, }
icon: "none", },
duration: 2000 methods: {
getBargainPoster: function () {
var that = this;
getBargainPoster({
bargainId: that.id,
from: "wechat"
})
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
},
//
getCombinationPoster: function () {
var that = this;
getCombinationPoster({
id: that.id,
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
})
.then(res => {
that.image = res.data.url;
that.status = false;
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
}); });
}); }
} }
} };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
page { page {
background-color: #eb3729; background-color: #eb3729;
} }
.poster-poster {
height: unset !important; .poster-poster {
} height: unset !important;
}
</style> </style>

536
pages/activity/SeckillDetails/index.vue

@ -10,15 +10,8 @@
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<view class="times"> <view class="times">
<view>距秒杀结束仅剩</view> <view>距秒杀结束仅剩</view>
<count-down <count-down :isDay="false" :tipText="false" :dayText="false" :hourText="' : '" :minuteText="' : '"
:isDay="false" :secondText="false" :datatime="datatime"></count-down>
:tipText="false"
:dayText="false"
:hourText="' : '"
:minuteText="' : '"
:secondText="false"
:datatime="datatime"
></count-down>
</view> </view>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
@ -33,203 +26,382 @@
<view v-text="'销量:' + storeInfo.sales + '件'"></view> <view v-text="'销量:' + storeInfo.sales + '件'"></view>
</view> </view>
</view> </view>
<!-- 规格 -->
<view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
<view>
<text>{{ attrTxt }}</text>
<text class="atterTxt">{{ attrValue }}</text>
</view>
<view class="iconfont icon-jiantou"></view>
</view>
<view class="product-intro"> <view class="product-intro">
<view class="title">产品介绍</view> <view class="title">产品介绍</view>
<view class="conter" v-html="storeInfo.description"></view> <view class="conter" v-html="storeInfo.description"></view>
</view> </view>
<!-- 操作栏 -->
<view style="height:100rpx;"></view> <view style="height:100rpx;"></view>
<view class="footerRush acea-row row-between-wrapper"> <view class="footer acea-row row-between-wrapper">
<!-- <view <!-- #ifdef MP-WEIXIN -->
class="customerSer acea-row row-center-wrapper row-column" <view class="item">
@click="routerGo()" <button open-type="contact" class='contacButton'>
> <view style="padding-bottom: 8rpx;" class="item">
<view class="iconfont icon-kefu"></view> <view class="iconfont icon-kefu"></view>
<view>客服</view> <text>客服</text>
</view> --> </view>
<view class="bnt bg-color-red" @click="tapBuy">立即购买</view> </button>
</view>
<!-- #endif -->
<view class="item" @click="setCollect" v-if="userCollect">
<view class="iconfont icon-shoucang1"></view>
<text>收藏</text>
</view>
<view class="item" @click="setCollect" v-if="!userCollect">
<view class="iconfont icon-shoucang"></view>
<text>收藏</text>
</view>
<view class="bnt acea-row" v-if="
seckillStatus == 1 &&
storeInfo.num > 0 &&
storeInfo.stock > 0
">
<view class="joinCart" @click="openAlone">
<text>单独购买</text>
</view>
<view class="buy" @click="tapBuy">
<text>立即购买</text>
</view>
</view>
<div class="bnt acea-row" v-if="
seckillStatus == 1 &&
storeInfo.num <= 0 &&
storeInfo.stock <= 0
">
<div class="joinCart" @click="openAlone">原价购买</div>
<div class="buy bg-color-hui">已售罄</div>
</div>
<div class="bnt acea-row" v-if="seckillStatus == 2">
<div class="joinCart" @click="openAlone">原价购买</div>
<div class="buy bg-color-hui">即将开始</div>
</div>
<div class="bnt acea-row" v-if="seckillStatus == 0">
<div class="joinCart" @click="openAlone">原价购买</div>
<div class="buy bg-color-hui">已结束</div>
</div>
</view> </view>
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow> <ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
<StorePoster <StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
v-on:setPosterImageStatus="setPosterImageStatus" :posterData="posterData"></StorePoster>
:posterImageStatus="posterImageStatus"
:posterData="posterData"
></StorePoster>
</view> </view>
</template> </template>
<style scoped lang="less"> <style scoped lang="less">
.noscroll { .noscroll {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
</style> </style>
<script> <script>
import ProductConSwiper from "@/components/ProductConSwiper"; import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown"; import CountDown from "@/components/CountDown";
import ProductWindow from "@/components/ProductWindow"; import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster"; import StorePoster from "@/components/StorePoster";
import { getSeckillDetail } from "@/api/activity"; import {
import { postCartAdd } from "@/api/store"; getSeckillDetail
import { imageBase64 } from "@/api/public"; } from "@/api/activity";
const NAME = "SeckillDetails"; import {
postCartAdd
} from "@/api/store";
import {
imageBase64
} from "@/api/public";
import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
const NAME = "SeckillDetails";
export default { export default {
name: "SeckillDetails", name: "SeckillDetails",
components: { components: {
ProductConSwiper, ProductConSwiper,
CountDown, CountDown,
ProductWindow, ProductWindow,
StorePoster StorePoster
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
domStatus: false, seckillStatus: '',
posterData: { domStatus: false,
image: "", posterData: {
title: "",
price: "",
code: ""
},
posterImageStatus: false,
action: "",
imgUrls: [],
storeInfo: [],
replyCount: 0,
reply: [],
cartNum: 1,
attr: {
cartAttr: false,
productSelect: {
image: "", image: "",
store_name: "", title: "",
price: "", price: "",
stock: "", code: ""
unique: "", },
cart_num: 1 posterImageStatus: false,
action: "",
imgUrls: [],
storeInfo: [],
replyCount: 0,
reply: [],
cartNum: 1,
attrTxt: "请选择",
productValue: [],
attrValue: "",
attr: {
cartAttr: false,
productAttr: [],
productSelect: {},
},
datatime: 0,
userCollect: false
};
},
onShow: function () {
this.mountedStart();
},
methods: {
onShareAppMessage: function () {
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,
path: "pages/activity/GoodsSeckill/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid") +
"&pageType=good&codeType=routine",
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
} }
}, },
datatime: 0 openAlone: function () {
}; this.$yrouter.push({
}, path: "/pages/shop/GoodsCon/index",
watch: { query: {
$yroute: function(n) { id: this.storeInfo.productId
var that = this; }
if (n.name === NAME) { });
that.mountedStart(); // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
} },
} routerGo(item) {
}, this.$yrouter.push({
mounted: function() { path: '/pages/user/CustomerList/index'
this.mountedStart(); })
}, },
methods: { //
routerGo(item) { setCollect: function () {
this.$yrouter.push({ path: '/pages/user/CustomerList/index' }) let that = this,
}, id = that.storeInfo.id,
mountedStart: function() { category = "product";
var that = this; if (that.userCollect) {
let id = that.$yroute.query.id; getCollectDel(id, category).then(function () {
that.datatime = parseInt(that.$yroute.query.time); that.userCollect = !that.userCollect;
getSeckillDetail(id).then(res => { });
res.data.storeInfo.description = res.data.storeInfo.description.replace(
/\<img/gi,
'<img style="max-width:100%;height:auto;"'
);
that.$set(that, "storeInfo", res.data.storeInfo);
that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr);
that.$set(that, "replyCount", res.data.replyCount);
that.$set(that, "reply", res.data.reply);
that.posterData.image = that.storeInfo.image_base;
that.updateTitle();
if (that.storeInfo.title.length > 30) {
that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
} else { } else {
that.posterData.title = that.storeInfo.title; getCollectAdd(id, category).then(function () {
that.userCollect = !that.userCollect;
});
} }
that.posterData.price = that.storeInfo.price; },
that.posterData.code = that.storeInfo.code_base; mountedStart: function () {
that.setProductSelect(); var that = this;
that.domStatus = true; console.log(this)
}); let id = that.$yroute.query.id;
}, this.seckillStatus = that.$yroute.query.status;
updateTitle() { that.datatime = parseInt(that.$yroute.query.time);
// document.title = this.storeInfo.title || this.$yroute.meta.title; getSeckillDetail(id).then(res => {
}, that.userCollect = res.data.userCollect;
setPosterImageStatus: function() { res.data.storeInfo.description = res.data.storeInfo.description.replace(
// var sTop = document.body || document.documentElement; /\<img/gi,
// sTop.scrollTop = 0; '<img style="max-width:100%;height:auto;"'
this.posterImageStatus = !this.posterImageStatus; );
}, that.$set(that.attr, "productAttr", res.data.productAttr);
// that.$set(that, "productValue", res.data.productValue);
changeFun: function(opt) { that.$set(that, "storeInfo", res.data.storeInfo);
if (typeof opt !== "object") opt = {}; that.$set(that, "imgUrls", res.data.storeInfo.sliderImageArr);
let action = opt.action || ""; that.$set(that, "replyCount", res.data.replyCount);
let value = opt.value === undefined ? "" : opt.value; that.$set(that, "reply", res.data.reply);
this[action] && this[action](value); that.posterData.image = that.storeInfo.image_base;
}, that.updateTitle();
changeattr: function(res) { if (that.storeInfo.title.length > 30) {
var that = this; that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
that.attr.cartAttr = res; } else {
}, that.posterData.title = that.storeInfo.title;
ChangeCartNum: function(res) { }
var that = this; that.posterData.price = that.storeInfo.price;
if (res) { that.posterData.code = that.storeInfo.code_base;
if (that.attr.productSelect.cart_num < that.storeInfo.stock) { // that.setProductSelect();
that.attr.productSelect.cart_num++; that.domStatus = true;
this.cartNum++; that.DefaultSelect();
});
},
updateTitle() {
// document.title = this.storeInfo.title || this.$yroute.meta.title;
},
setPosterImageStatus: function () {
// var sTop = document.body || document.documentElement;
// sTop.scrollTop = 0;
this.posterImageStatus = !this.posterImageStatus;
},
DefaultSelect: function () {
let productAttr = this.attr.productAttr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], "index", 0);
value.push(productAttr[i].attrValueArr[0]);
} }
} else { //sort();:--
if (that.attr.productSelect.cart_num > 1) { let productSelect = this.productValue[value.sort().join(",")];
that.attr.productSelect.cart_num--; console.log(productSelect)
this.cartNum--; if (productSelect && productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.title
);
this.$set(this.attr.productSelect, "image", productSelect.image);
this.$set(this.attr.productSelect, "price", productSelect.seckillPrice);
this.$set(this.attr.productSelect, "stock", productSelect.seckillStock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", value.sort().join(","));
this.$set(this, "attrTxt", "已选择");
} else if (!productSelect && productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.title
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
} else if (!productSelect && !productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.title
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
this.$set(this.attr.productSelect, "stock", this.storeInfo.seckillStock);
this.$set(
this.attr.productSelect,
"unique",
this.storeInfo.unique || ""
);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
} }
} },
}, //
setProductSelect: function() { changeFun: function (opt) {
var that = this; if (typeof opt !== "object") opt = {};
var attr = that.attr; let action = opt.action || "";
attr.productSelect.image = that.storeInfo.image; let value = opt.value === undefined ? "" : opt.value;
attr.productSelect.store_name = that.storeInfo.title; this[action] && this[action](value);
attr.productSelect.price = that.storeInfo.price; },
attr.productSelect.stock = that.storeInfo.stock; changeattr: function (res) {
attr.cartAttr = false; var that = this;
that.$set(that, "attr", attr); that.attr.cartAttr = res;
}, },
selecAttrTap: function() { ChangeCartNum: function (res) {
this.cartAttr = true; var that = this;
}, if (res) {
tapBuy: function() { if (that.attr.productSelect.cart_num < that.storeInfo.seckillStock) {
var that = this; that.attr.productSelect.cart_num++;
if (that.attr.cartAttr == false) { this.cartNum++;
that.attr.cartAttr = !this.attr.attrcartAttr; }
} else { } else {
var data = {}; if (that.attr.productSelect.cart_num > 1) {
data.productId = that.storeInfo.productId; that.attr.productSelect.cart_num--;
data.cartNum = that.attr.productSelect.cart_num; this.cartNum--;
data.uniqueId = that.attr.productSelect.unique; }
data.secKillId = that.storeInfo.id; }
data.new = 1; },
postCartAdd(data) //
.then(res => { ChangeAttr: function (res) {
that.$yrouter.push({ //
path: "/pages/order/OrderSubmission/index", let productSelect = this.productValue[res.value];
query: { id: res.data.cartId } if (productSelect) {
}); this.attr.productAttr[res.indexw].index = res.indexn;
}) this.$set(this.attr.productSelect, "image", productSelect.image);
.catch(err => { this.$set(this.attr.productSelect, "price", productSelect.seckillPrice);
uni.showToast({ this.$set(this.attr.productSelect, "stock", productSelect.seckillStock);
title: err.msg || err.response.data.msg|| err.response.data.message, this.$set(this.attr.productSelect, "unique", productSelect.unique);
icon: 'none', this.$set(this.attr.productSelect, "cart_num", 1);
duration: 2000 this.$set(this, "attrValue", res.value);
this.$set(this, "attrTxt", "已选择");
} else {
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
}
},
selecAttrTap: function () {
this.attr.cartAttr = true;
this.isOpen = true;
},
tapBuy: function () {
var that = this;
if (that.attr.cartAttr == false) {
that.attr.cartAttr = !this.attr.attrcartAttr;
} else {
var data = {};
data.productId = that.storeInfo.productId;
data.cartNum = that.attr.productSelect.cart_num;
data.uniqueId = that.attr.productSelect.unique;
data.secKillId = that.storeInfo.id;
data.new = 1;
postCartAdd(data)
.then(res => {
that.$yrouter.push({
path: "/pages/order/OrderSubmission/index",
query: {
id: res.data.cartId
}
});
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: 'none',
duration: 2000
});
}); });
}); }
} }
} }
} };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.product-con .nav { .product-con .nav {
padding: 0 0.2*100rpx; padding: 0 0.2*100rpx;
} }
.product-con .footer .bnt .buy.bg-color-hui {
background: #ccc;
}
</style> </style>

339
pages/authorization/index.vue

@ -1,219 +1,192 @@
<template> <template>
<view class="container"> <view class="container">
<view v-if="!token"> <!-- #ifdef MP-WEIXIN -->
<!-- #ifdef MP-WEIXIN --> <view v-if="!token" class="force-login-wrap">
<view> <!-- <image class="logo-bg" src="@/static/images/logo_bg.png" mode="aspectFill"></image> -->
<view class="getUserInfo"> <view class="force-login__content y-f">
<text>您还未允许微信登录授权请点击下方按钮允许微信授权登录</text> <open-data class="user-avatar" type="userAvatarUrl"></open-data>
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button> <open-data class="user-name" type="userNickName"></open-data>
<view style="height:20rpx"></view> <view class="login-notice">为了提供更优质的服务需要获取您的头像昵称</view>
<button @click="back">取消微信登录授权</button> <button class="cu-btn author-btn" @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看</button>
</view> <button class="cu-btn close-btn" @tap="back">暂不授权</button>
</view> </view>
<!-- #endif --> </view>
<!-- #ifndef MP-WEIXIN --> <!-- #endif -->
<view> <!-- #ifndef MP-WEIXIN -->
<view class="getUserInfo"> <view class="force-login-wrap">
<text>请先登录</text> <!-- <image class="logo-bg" src="@/static/images/logo_bg.png" mode="aspectFill"></image> -->
<button type="primary" @tap="toLogin">去登录</button> <view class="force-login__content y-f">
</view> <view class="login-notice">为了提供更优质的服务请先登录</view>
<button class="cu-btn author-btn" @tap="toLogin">去登录</button>
</view> </view>
<!-- #endif -->
</view> </view>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
import { mapState, mapMutations, mapActions } from "vuex"; import {
import { wxappAuth, getUser } from "@/api/user"; mapState,
import dayjs from "dayjs"; mapMutations,
import cookie from "@/utils/store/cookie"; mapActions
import { login, authorize } from "@/utils"; } from "vuex";
import {
export default { wxappAuth,
data() { getUser
return { } from "@/api/user";
authorize: false, import dayjs from "dayjs";
}; import cookie from "@/utils/store/cookie";
}, import {
computed: { login,
...mapState(["isAuthorization", "$deviceType", "token"]), authorize
}, } from "@/utils";
onShow() {
// // export default {
}, data() {
onHide() { return {
this.updateAuthorizationPage(false); authorize: false,
this.changeAuthorization(false); };
}, },
onUnload() { computed: {
this.updateAuthorizationPage(false); ...mapState(["isAuthorization", "$deviceType", "token"]),
this.changeAuthorization(false); },
}, onShow() {
methods: { // //
...mapActions(["changeAuthorization", "setUserInfo"]), },
...mapMutations(["updateAuthorizationPage"]), onHide() {
toLogin() { this.updateAuthorizationPage(false);
this.$yrouter.push({ this.changeAuthorization(false);
path: "/pages/user/Login/index",
query: {},
});
}, },
back() { onUnload() {
this.$yrouter.switchTab({ this.updateAuthorizationPage(false);
path: "/pages/home/index", this.changeAuthorization(false);
query: {},
});
}, },
getUserInfo(data) { methods: {
if (data.detail.errMsg == "getUserInfo:fail auth deny") { ...mapActions(["changeAuthorization", "setUserInfo"]),
uni.showToast({ ...mapMutations(["updateAuthorizationPage"]),
title: "取消授权", toLogin() {
icon: "none", this.$yrouter.push({
duration: 2000, path: "/pages/user/Login/index",
query: {},
}); });
return; },
} back() {
uni.showLoading({ this.$yrouter.switchTab({
title: "登录中", path: "/pages/home/index",
}); query: {},
login() });
.then((res) => { },
this.$yrouter.replace({ path: cookie.get("redirect") }); getUserInfo(data) {
}) if (data.detail.errMsg == "getUserInfo:fail auth deny") {
.catch((error) => {
console.log(error);
uni.showToast({ uni.showToast({
title: error, title: "取消授权",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return;
}
uni.showLoading({
title: "登录中",
}); });
login()
.then((res) => {
this.$yrouter.replace({
path: cookie.get("redirect")
});
})
.catch((error) => {
console.log(error);
uni.showToast({
title: error,
icon: "none",
duration: 2000,
});
});
},
}, },
}, mounted() {},
mounted() {}, };
};
</script> </script>
<style lang="less"> <style lang="less">
.sp-cell { .container {
height: 20rpx;
}
.getUserInfo {
display: flex;
align-items: center;
flex-direction: column;
padding: 30px;
text {
font-size: 30rpx;
text-align: center;
margin-bottom: 20px;
}
}
.container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
}
.tab-bar {
font-size: 0;
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.9);
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 99;
border-top: 1px solid rgba(248, 248, 248, 1);
.tab-bar-item {
flex: 1; flex: 1;
height: 49px;
display: flex; display: flex;
justify-content: center;
align-items: center;
flex-direction: column; flex-direction: column;
justify-content: flex-start;
position: relative;
}
&.active { .force-login-wrap {
text { width: 100%;
color: #ee7559; height: 100%;
} overflow: hidden;
z-index: 11111;
top: 0;
.tab-bar-pic { .logo-bg {
display: none; width: 640rpx;
background: #f9f9f9; height: 300rpx;
}
&.active { .force-login__content {
display: block; position: absolute;
} left: 50%;
top: 50%;
transform: translate(-50%, -50%);
.user-avatar {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
overflow: hidden;
margin-bottom: 40rpx;
} }
}
.tab-bar-pic { .user-name {
display: block; font-size: 35rpx;
background: #f9f9f9; font-family: PingFang SC;
font-weight: bold;
color: #000;
margin-bottom: 30rpx;
}
&.active { .login-notice {
display: none; font-size: 28rpx;
font-family: PingFang SC;
font-weight: 400;
color: #000;
line-height: 44rpx;
width: 500rpx;
text-align: center;
margin-bottom: 80rpx;
} }
}
}
.tab-bar-pic { .author-btn {
width: 25px; width: 630rpx;
height: 25px; height: 80rpx;
background: #f9f9f9; background: linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
background: -moz-linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
// box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
border-radius: 40rpx;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
}
image { .close-btn {
width: 25px; width: 630rpx;
height: 25px; height: 80rpx;
margin-top: 30rpx;
border-radius: 40rpx;
border: 2rpx solid #eb3729;
background: none;
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #eb3729;
}
} }
} }
.tab-bar-pic-active {
}
text {
font-size: 10px;
color: rgb(160, 160, 160);
line-height: 10px;
margin-top: 5px;
}
}
.tab-bar-bg {
padding-top: 46px;
width: 100%;
}
.view-item {
display: none;
width: 100%;
}
.view-item-active {
display: block;
}
.getUserInfo {
display: flex;
align-items: center;
flex-direction: column;
padding: 30px;
p {
margin-bottom: 20px;
}
}
._van-dialog {
z-index: 99999999999;
}
</style> </style>

173
pages/home/components/Banner.vue

@ -0,0 +1,173 @@
<template>
<view class="banner-swiper-box">
<canvas canvas-id="colorThief" class="hide-canvas"></canvas>
<swiper class="banner-carousel Shop-selector-rect" circular @change="swiperChange" :autoplay="true">
<swiper-item v-for="(item, index) in list" :key="index" class="carousel-item" @tap="routerTo(item.path)">
<image class="swiper-image " :src="item.pic" @click="goRoll(item)" mode="widthFix" lazy-load>
</image>
</swiper-item>
</swiper>
<view class="banner-swiper-dots">
<text :class="swiperCurrent === index ? 'banner-dot-active' : 'banner-dot'"
v-for="(dot, index) in list.length" :key="index"></text>
</view>
</view>
</template>
<script>
import colorThief from 'miniapp-color-thief';
export default {
data() {
return {
swiperCurrent: 0, //
webviewId: 0,
bgcolorAry: [],
list: []
};
},
props: {
banner: {
type: Array,
default: []
}
},
created: async function () {
await this.doColorThief();
},
async mounted() {
},
computed: {},
watch: {
banner(next) {
this.list = next;
this.doColorThief()
}
},
methods: {
async doColorThief() {
let that = this;
//
let item = this.list[this.swiperCurrent];
if(!item){
return
}
//
let bgcolor = this.bgcolorAry[this.swiperCurrent];
//
if (!bgcolor) {
let ctx = uni.createCanvasContext('colorThief', that.$scope);
if (0 === that.webviewId || ctx.webviewId === that.webviewId) {
that.webviewId = ctx.webviewId;
uni.getImageInfo({
src: item.pic,
success: function (image) {
ctx.drawImage(image.path, 0, 0, image.width, image.height);
ctx.draw(true, function (e) {
uni.canvasGetImageData({
canvasId: 'colorThief',
x: 0,
y: 0,
width: parseInt(image.width),
height: parseInt(image.height),
success(res) {
let newBgcolor = colorThief(res.data)
.color()
.getHex();
that.$set(that.bgcolorAry, that
.swiperCurrent,
newBgcolor);
that.$emit('getbgcolor', newBgcolor);
},
fail: function (error) {
}
}, that.$scope);
});
},
fail: function (error) {
}
});
}
} else {
that.$set(item, 'bgcolor', bgcolor);
that.$emit('getbgcolor', bgcolor);
}
},
swiperChange(e) {
this.swiperCurrent = e.detail.current;
this.doColorThief();
},
//
goRoll(item) {
if (item.uniapp_url) {
this.$yrouter.push(item.uniapp_url)
}
},
}
}
</script>
<style lang="less">
//
.banner-swiper-box {
background: #fff;
}
.banner-swiper-box,
.banner-carousel {
width: 750rpx;
height: 350upx;
position: relative;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
// background: #ccc;
}
}
.banner-swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 20rpx;
z-index: 5;
.banner-dot {
width: 14rpx;
height: 14rpx;
background: rgba(255, 255, 255, 1);
border-radius: 50%;
margin-right: 10rpx;
}
.banner-dot-active {
width: 14rpx;
height: 14rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
.hide-canvas {
position: fixed !important;
top: -99999upx;
left: -99999upx;
z-index: -99999;
}
</style>

216
pages/home/components/FirstNewProduct.vue

@ -0,0 +1,216 @@
<template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push({ path: '/pages/shop/HotNewGoods/index',query:{type:3} })">
<text class="title">首发新品</text>
<view class="group-people x-f">
<text class="tip">更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods"
@tap="$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:mgoods.id} })">
<view class="img-box">
<view class="tag">new</view>
<image class="img" :src="mgoods.image" mode="widthFix"></image>
</view>
<view class="price-box">
<view class="y-f">
<text class="seckill-current">{{ mgoods.price }}</text>
<text class="original">销量{{ mgoods.sales }}{{mgoods.unitName}}</text>
</view>
</view>
<view class="title">
<slot name="titleText"></slot>
</view>
</view>
</block>
</view>
</swiper-item>
</swiper>
<view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text>
</view>
</view>
</view>
</template>
<script>
import shActivityGoods from '@/components/sh-activity-goods.vue';
export default {
name: "FirstNewProduct",
components: {
shActivityGoods
},
data() {
return {
goodsList: [],
swiperCurrent: 0
};
},
props: {
detail: Array
},
computed: {},
created() {},
watch: {
detail(next) {
this.goodsList = this.sortData(next, 4);
}
},
methods: {
swiperChange(e) {
this.swiperCurrent = e.detail.current;
},
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
jump(path, query) {
this.$yrouter.push({
path,
query,
});
},
}
}
</script>
<style lang="scss" scoped>
.group-goods {
position: relative;
z-index: 9;
}
.swiper-box,
.carousel {
width: 700rpx;
height: 240upx;
position: relative;
border-radius: 20rpx;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
background: #ccc;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0rpx;
z-index: 66;
.dot {
width: 45rpx;
height: 3rpx;
background: #eee;
border-radius: 50%;
margin-right: 10rpx;
}
.dot-active {
width: 45rpx;
height: 3rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
// +
.group-goods {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.title-box {
padding-bottom: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.group-people {
.time-box {
font-size: 26rpx;
color: #edbf62;
.count-text-box {
width: 30rpx;
height: 34rpx;
background: #edbf62;
text-align: center;
line-height: 34rpx;
font-size: 24rpx;
border-radius: 6rpx;
color: rgba(#fff, 0.9);
margin: 0 8rpx;
}
}
.head-box {
.head-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ccc;
}
}
.tip {
font-size: 28rpx;
padding-left: 30rpx;
color: #666;
}
.cuIcon-right {
font-size: 30rpx;
line-height: 28rpx;
color: #666;
}
}
}
.goods-box {
.goods-item {
margin-right: 22rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
}
</style>

219
pages/home/components/HotCommodity.vue

@ -0,0 +1,219 @@
<template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push({ path: '/pages/shop/HotNewGoods/index',query:{type:2} })">
<text class="title">热门榜单</text>
<view class="group-people x-f">
<text class="tip">更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods" @tap="jump('/pages/shop/GoodsCon/index',{id:mgoods.id})">
<view class="img-box">
<view class="tag">hot</view>
<image class="img" :src="mgoods.image" mode="widthFix"></image>
</view>
<view class="price-box">
<view class="y-f">
<text class="seckill-current">{{ mgoods.price }}</text>
<text class="original">销量{{ mgoods.sales }}{{mgoods.unitName}}</text>
</view>
</view>
<view class="title">
<slot name="titleText"></slot>
</view>
</view>
</block>
</view>
</swiper-item>
</swiper>
<view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text>
</view>
</view>
</view>
</template>
<script>
import shActivityGoods from '@/components/sh-activity-goods.vue';
export default {
name: "HotCommodity",
components: {
shActivityGoods
},
data() {
return {
goodsList: [],
swiperCurrent: 0
};
},
props: {
detail: Array
},
computed: {},
created() {},
watch: {
detail(next) {
this.goodsList = this.sortData(next, 4);
}
},
methods: {
swiperChange(e) {
this.swiperCurrent = e.detail.current;
},
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
jump(path, query) {
this.$yrouter.push({
path,
query,
});
},
}
}
</script>
<style lang="scss" scoped>
.group-goods {
position: relative;
z-index: 9;
}
.swiper-box,
.carousel {
width: 700rpx;
height: 240upx;
position: relative;
border-radius: 20rpx;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
background: #ccc;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0rpx;
z-index: 66;
.dot {
width: 45rpx;
height: 3rpx;
background: #eee;
border-radius: 50%;
margin-right: 10rpx;
}
.dot-active {
width: 45rpx;
height: 3rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
// +
.group-goods {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.title-box {
padding-bottom: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.group-people {
.time-box {
font-size: 26rpx;
color: #edbf62;
.count-text-box {
width: 30rpx;
height: 34rpx;
background: #edbf62;
text-align: center;
line-height: 34rpx;
font-size: 24rpx;
border-radius: 6rpx;
color: rgba(#fff, 0.9);
margin: 0 8rpx;
}
}
.head-box {
.head-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ccc;
}
}
.tip {
font-size: 28rpx;
padding-left: 30rpx;
color: #666;
}
.cuIcon-right {
font-size: 30rpx;
line-height: 28rpx;
color: #666;
}
}
}
.goods-box {
.goods-item {
margin-right: 22rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
.min-goods{
margin-right: 22rpx;
}
}
</style>

249
pages/home/components/Live.vue

@ -0,0 +1,249 @@
<template>
<view class="live-el mx20 mb10">
<view class="head">
<text class="head-title">热门直播</text>
<view class="head-more" @tap="$yrouter.push('/pages/shop/Live/LiveList/index')">
<text>更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="content-one">
<view class="content-one__item" v-for="live in detail" :key="live.roomId" @tap="goRoom(live)">
<image class="item-cover" :src="live.shareImge" mode="widthFix"></image>
<view class="item-status">
<image class="status-img" :src="liveStatus[live.liveStatus].img" mode=""></image>
<text class="status-text">{{ liveStatus[live.liveStatus].title }}</text>
</view>
<view class="item-title">{{ live.name }}</view>
<image v-if="live.liveStatus == 101" class="like-img" src="http://Shop.7wpp.com/imgs/live/zan.gif"
mode=""></image>
</view>
</view>
</view>
</template>
<script>
import ShopLiveCard from '@/components/ShopLiveCard.vue'
let HAS_LIVE = false
// #ifdef MP-WEIXIN
HAS_LIVE = true
let livePlayer = null;
if (HAS_LIVE) {
livePlayer = requirePlugin('live-player-plugin');
}
// #endif
import {
yxWechatLive,
getLiveReplay
} from '@/api/live';
let timer = null;
export default {
components: {
ShopLiveCard
},
data() {
return {
liveList: [],
liveStatus: {
'101': {
img: 'https://wx.yixiang.co/static/images/live.png',
title: '直播中'
},
'102': {
img: 'https://wx.yixiang.co/static/images/prevue.png',
title: '未开始'
},
'103': {
img: 'https://wx.yixiang.co/static/images/playback.png',
title: '已结束'
},
'104': {
img: 'https://wx.yixiang.co/static/images/104.png',
title: '禁播'
},
'105': {
img: 'https://wx.yixiang.co/static/images/105.png',
title: '暂停中'
},
'106': {
img: 'https://wx.yixiang.co/static/images/106.png',
title: '异常'
},
'107': {
img: 'https://wx.yixiang.co/static/images/past.png',
title: '已过期'
}
}
};
},
props: {
detail: Array
},
created() {
},
mounted() {
let that = this;
timer = setInterval(() => {
that.getLiveStatus();
}, 60000);
},
beforeDestroy() {
timer = null;
},
computed: {},
methods: {
//
getLiveList() {
// let that = this;
// yxWechatLive({
// page: 1,
// size: 10,
// }).then(res => {
// console.log(res)
// })
},
// liveStatus
getLiveStatus() {
// if (HAS_LIVE) {
// let that = this;
// let date = '';
// if (that.detail.liveStatus == 102) {
// date = that.$tools.dateFormat('mm-dd HH:MM', new Date(that.detail.starttime * 1000)).replace('-',
// '/');
// that.liveStatus['102'].title = ' ' + date;
// }
// livePlayer
// .getLiveStatus({
// room_id: that.detail.roomId
// })
// .then(res => {
// // 101: , 102: , 103: , 104: , 105: , 106: 107
// that.detail.liveStatus = res.liveStatus;
// })
// .catch(err => {
// console.log('get live status', err);
// });
// }
},
goRoom(live) {
console.log(live.roomId,9999)
wx.navigateTo({
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${live.roomId}`
});
}
}
};
</script>
<style lang="scss">
.live-el {
background: #fff;
border-radius: 20rpx;
padding: 30rpx 20rpx 25rpx;
.head {
display: flex;
justify-content: space-between;
align-items: center;
&-title {
font-size: 32rpx;
font-weight: bold;
font-family: PingFang SC;
color: rgba(51, 51, 51, 1);
}
&-more {
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(51, 51, 51, 1);
}
}
//
.content-one {
.content-one__item {
position: relative;
height: 280rpx;
border-radius: 20rpx;
margin-top: 25rpx;
overflow: hidden;
.item-cover {
background-color: #eee;
width: 100%;
height: 100%;
}
.item-status {
position: absolute;
top: 20rpx;
left: 10rpx;
height: 40rpx;
background: rgba(0, 0, 0, 0.4);
border-radius: 20rpx;
display: flex;
justify-content: center;
align-items: center;
.status-img {
width: 38rpx;
height: 38rpx;
}
.status-text {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
padding: 0 10rpx;
}
}
.item-title {
width: 680rpx;
position: absolute;
bottom: 0;
line-height: 60rpx;
padding: 0 20rpx;
font-size: 26rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
background: linear-gradient(transparent, rgba(#000, 0.5));
}
.like-img {
position: absolute;
bottom: 20rpx;
right: 10rpx;
width: 60rpx;
height: 130rpx;
}
}
}
//
.content-two {
width: 100%;
// -moz-column-count: 2;
// -webkit-column-count: 2;
// column-count: 2;
// padding-top: 20rpx;
display: flex;
flex-wrap: wrap;
&__item {
margin-right: 30rpx;
margin-top: 20rpx;
&:nth-child(2n) {
margin-right: 0;
}
}
}
}
</style>

215
pages/home/components/ProductsRecommended.vue

@ -0,0 +1,215 @@
<template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push({ path: '/pages/shop/HotNewGoods/index',query:{type:1} })">
<text class="title">精品推荐</text>
<view class="group-people x-f">
<text class="tip">更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods" @tap="$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:mgoods.id} })">
<view class="img-box">
<!-- <view class="tag">{{ mgoods.people}}人团</view> -->
<image class="img" :src="mgoods.image" mode="widthFix"></image>
</view>
<view class="price-box">
<view class="y-f">
<text class="seckill-current">{{ mgoods.price }}</text>
<text class="original">销量{{ mgoods.sales }}{{mgoods.unitName}}</text>
</view>
</view>
<view class="title">
<slot name="titleText"></slot>
</view>
</view>
</block>
</view>
</swiper-item>
</swiper>
<view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text>
</view>
</view>
</view>
</template>
<script>
import shActivityGoods from '@/components/sh-activity-goods.vue';
export default {
name: "ProductsRecommended",
components: {
shActivityGoods
},
data() {
return {
goodsList: [],
swiperCurrent: 0
};
},
props: {
detail: Array
},
computed: {},
created() {},
watch: {
detail(next) {
this.goodsList = this.sortData(next, 4);
}
},
methods: {
swiperChange(e) {
this.swiperCurrent = e.detail.current;
},
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
jump(path, query) {
this.$yrouter.push({
path,
query,
});
},
}
}
</script>
<style lang="scss" scoped>
.group-goods {
position: relative;
z-index: 9;
}
.swiper-box,
.carousel {
width: 700rpx;
height: 240upx;
position: relative;
border-radius: 20rpx;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
background: #ccc;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0rpx;
z-index: 66;
.dot {
width: 45rpx;
height: 3rpx;
background: #eee;
border-radius: 50%;
margin-right: 10rpx;
}
.dot-active {
width: 45rpx;
height: 3rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
// +
.group-goods {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.title-box {
padding-bottom: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.group-people {
.time-box {
font-size: 26rpx;
color: #edbf62;
.count-text-box {
width: 30rpx;
height: 34rpx;
background: #edbf62;
text-align: center;
line-height: 34rpx;
font-size: 24rpx;
border-radius: 6rpx;
color: rgba(#fff, 0.9);
margin: 0 8rpx;
}
}
.head-box {
.head-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ccc;
}
}
.tip {
font-size: 28rpx;
padding-left: 30rpx;
color: #666;
}
.cuIcon-right {
font-size: 30rpx;
line-height: 28rpx;
color: #666;
}
}
}
.goods-box {
.goods-item {
margin-right: 22rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
}
</style>

216
pages/home/components/PromoteProduct.vue

@ -0,0 +1,216 @@
<template>
<view class="group-goods pa20 mx20 mb10" v-if="detail.length>0">
<view class="title-box x-bc" @tap="$yrouter.push('/pages/shop/GoodsPromotion/index')">
<text class="title">促销单品</text>
<view class="group-people x-f">
<text class="tip">更多</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="goods-box swiper-box x-f">
<swiper class="carousel" circular @change="swiperChange" :autoplay="true" duration="2000">
<swiper-item v-for="(goods, index) in goodsList" :key="index" class="carousel-item">
<view class="goods-list-box x-f">
<block v-for="mgoods in goods" :key="mgoods.id">
<view class="min-goods"
@tap="$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } })">
<view class="img-box">
<view class="tag">促销</view>
<image class="img" :src="mgoods.image" mode="widthFix"></image>
</view>
<view class="price-box">
<view class="y-f">
<text class="seckill-current">日常价{{ mgoods.price }}</text>
<text class="original">仅剩{{ mgoods.stock }}{{ mgoods.unitName }}</text>
</view>
</view>
<view class="title">
<slot name="titleText"></slot>
</view>
</view>
</block>
</view>
</swiper-item>
</swiper>
<view class="swiper-dots" v-if="goodsList.length > 1">
<text :class="swiperCurrent === index ? 'dot-active' : 'dot'" v-for="(dot, index) in goodsList.length"
:key="index"></text>
</view>
</view>
</view>
</template>
<script>
import shActivityGoods from '@/components/sh-activity-goods.vue';
export default {
name: "ProductsRecommended",
components: {
shActivityGoods
},
data() {
return {
goodsList: [],
swiperCurrent: 0
};
},
props: {
detail: Array
},
computed: {},
created() {},
watch: {
detail(next) {
this.goodsList = this.sortData(next, 4);
}
},
methods: {
swiperChange(e) {
this.swiperCurrent = e.detail.current;
},
//
sortData(oArr, length) {
let arr = [];
let minArr = [];
oArr.forEach(c => {
if (minArr.length === length) {
minArr = [];
}
if (minArr.length === 0) {
arr.push(minArr);
}
minArr.push(c);
});
return arr;
},
jump(path, query) {
this.$yrouter.push({
path,
query,
});
},
}
}
</script>
<style lang="scss" scoped>
.group-goods {
position: relative;
z-index: 9;
}
.swiper-box,
.carousel {
width: 700rpx;
height: 240upx;
position: relative;
border-radius: 20rpx;
.carousel-item {
width: 100%;
height: 100%;
// padding: 0 28upx;
overflow: hidden;
}
.swiper-image {
width: 100%;
height: 100%;
// border-radius: 10upx;
background: #ccc;
}
}
.swiper-dots {
display: flex;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 0rpx;
z-index: 66;
.dot {
width: 45rpx;
height: 3rpx;
background: #eee;
border-radius: 50%;
margin-right: 10rpx;
}
.dot-active {
width: 45rpx;
height: 3rpx;
background: #a8700d;
border-radius: 50%;
margin-right: 10rpx;
}
}
// +
.group-goods {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.title-box {
padding-bottom: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.group-people {
.time-box {
font-size: 26rpx;
color: #edbf62;
.count-text-box {
width: 30rpx;
height: 34rpx;
background: #edbf62;
text-align: center;
line-height: 34rpx;
font-size: 24rpx;
border-radius: 6rpx;
color: rgba(#fff, 0.9);
margin: 0 8rpx;
}
}
.head-box {
.head-img {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
background: #ccc;
}
}
.tip {
font-size: 28rpx;
padding-left: 30rpx;
color: #666;
}
.cuIcon-right {
font-size: 30rpx;
line-height: 28rpx;
color: #666;
}
}
}
.goods-box {
.goods-item {
margin-right: 22rpx;
&:nth-child(4n) {
margin-right: 0;
}
}
}
}
</style>

332
pages/home/index.vue

@ -1,6 +1,19 @@
<template> <template>
<view class="index"> <view class="index">
<view class="header fixed-header acea-row row-center-wrapper"> <!-- 导航栏 -->
<view class="head_box " :style="{ background: bgcolor }" :class="{ active: bgcolor }">
<view class="cu-custom" :style="[{height:CustomBar+ 'px',}]">
<view class="cu-bar fixed" :style="customStyle" :class="[bgcolor]">
<view class="action">
<text class="nav-title Shop-selector-rect">{{ 'yshop商城' }}</text>
</view>
<view class="content" :style="[{top:StatusBar + 'px'}]">
</view>
</view>
</view>
</view>
<view class="header header-search acea-row row-center-wrapper" :style="{ background: bgcolor }">
<view @click="goGoodSearch()" class="search acea-row row-middle"> <view @click="goGoodSearch()" class="search acea-row row-middle">
<text class="iconfont icon-xiazai5"></text> <text class="iconfont icon-xiazai5"></text>
搜索商品 搜索商品
@ -9,138 +22,38 @@
<image src="@/static/images/qr.png" /> <image src="@/static/images/qr.png" />
</view> </view>
</view> </view>
<view class="fixed-header-box"></view> <Banner :banner="banner" @getbgcolor="getbgcolor"></Banner>
<view class="slider-banner banner"> <uni-notice-bar scrollable="true" @click="goRoll(singNew)" single="true" :speed="10" showIcon="true"
<swiper indicatorDots="true" v-if="banner.length > 0" autoplay circular> :text="singNew.info"></uni-notice-bar>
<block v-for="(item, bannerIndex) in banner" :key="bannerIndex"> <view class="content_box home_content_box">
<swiper-item> <!-- 菜单 -->
<view @click="goRoll(item)" class="swiper-item"> <Menu :list="menus"></Menu>
<image :src="item.pic" /> <!-- 滚动新闻 -->
</view> <!-- 广告 -->
</swiper-item> <Adv />
</block> <!-- 热门榜单 -->
</swiper> <HotCommodity :detail="likeInfo"></HotCommodity>
</view> <!-- 超值拼团 -->
<Groupon :detail="combinationList" />
<view class="nav acea-row"> <!-- 首发新品->秒杀 -->
<view @click="goWxappUrl(item)" class="item" v-for="(item, menusIndex) in menus" :key="menusIndex"> <!-- <FirstNewProduct :detail="firstList"></FirstNewProduct> -->
<view class="pictrue"> <!-- 精品推荐 -->
<image :src="item.pic" /> <!-- <ProductsRecommended :detail="bastList"></ProductsRecommended> -->
</view> <!-- 促销单品
<view>{{ item.name }}</view> <PromoteProduct :detail="benefit"></PromoteProduct> -->
</view> <!-- 直播 -->
</view> <!-- #ifdef MP-WEIXIN -->
<!-- <view class="news acea-row "> <Live :detail="live"></Live>
<view class="pictrue" v-if="$VUE_APP_RESOURCES_URL"> <!-- #endif -->
<image src="@/static/images/news.png" />
</view>
<view class="swiper-no-swiping new-banner">
<swiper class="swiper-wrapper" v-if="roll.length > 0" :indicator-dots="false" autoplay circular vertical>
<block v-for="(item, rollIndex) in roll" :key="rollIndex">
<swiper-item class="swiper-slide">
<view @click="goRoll(item)" class="swiper-item acea-row row-between-wrapper">
<view class="text acea-row row-between-wrapper">
<view class="label" v-if="item.show === '是'">最新</view>
<view class="newsTitle line1">{{ item.info }}</view>
</view>
<view class="iconfont icon-xiangyou"></view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view> -->
<!-- <view class="wrapper hot" v-if="likeInfo.length > 0"> -->
<uni-notice-bar scrollable="true" @click="goRoll(singNew)" single="true" :speed="10" showIcon="true" :text="singNew.info"></uni-notice-bar>
<view class="wrapper hot" v-if="bastList.length > 0">
<image class="bg" src="../../static/images/index-bg.png" mode="widthFix"></image>
<view class="title no-border acea-row row-between-wrapper">
<div class="text line1">
<span class="iconfont icon-remen"></span>
<span class="label">热门榜单</span>
</div>
<view @click="goHotNewGoods(2)" class="more">
更多
<text class="iconfont icon-jiantou"></text>
</view>
</view>
<view class="newProducts">
<scroll-view :show-scrollbar="false" scroll-y="false" scroll-x="true">
<view class="newProductsScroll">
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, likeInfoIndex) in likeInfo" :key="likeInfoIndex">
<view class="img-box">
<image :src="item.image" />
</view>
<view class="pro-info line1"><text>{{ item.storeName }}</text></view>
<view class="money font-color-red"><text>{{ item.price }}</text></view>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="wrapper" v-if="bastList.length > 0">
<view class="title no-border acea-row row-between-wrapper">
<view class="text">
<div class="name line1">
<span class="iconfont icon-jingpintuijian"></span>
<span class="label">精品推荐</span>
</div>
</view>
<view @click="goHotNewGoods(1)" class="more">
更多
<text class="iconfont icon-jiantou"></text>
</view>
</view>
<Good-list :good-list="bastList" :is-sort="false"></Good-list>
</view>
<view class="wrapper" v-if="firstList.length > 0"> <!-- 为您推荐 -->
<view class="title acea-row row-between-wrapper"> <PromotionGood :benefit="benefit"></PromotionGood>
<view class="text">
<view class="name line1">
<span class="iconfont icon-xinpin"></span>
<span class="label">首发新品</span>
</view>
</view>
<view @click="goHotNewGoods(3)" class="more">
更多
<text class="iconfont icon-jiantou"></text>
</view>
</view>
<view class="newProducts">
<scroll-view :show-scrollbar="false" scroll-y="false" scroll-x="true">
<view class="newProductsScroll">
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, firstListIndex) in firstList" :key="firstListIndex">
<view class="img-box">
<image :src="item.image" />
</view>
<view class="pro-info line1">{{ item.storeName }}</view>
<view class="money font-color-red">{{ item.price }}</view>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="wrapper" v-if="benefit.length > 0">
<view class="title acea-row row-center">
<view class="text text-center">
<div class="name line1 new-name">
<span class="iconfont icon-shoucang"></span>
<span class="txt">猜你喜欢</span>
</div>
</view>
<!-- <view @click="goGoodsPromotion(4)" class="more">
更多
<text class="iconfont icon-jiantou"></text>
</view> -->
</view>
</view> </view>
<PromotionGood :benefit="benefit"></PromotionGood> <Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"></Coupon-window> </Coupon-window>
</view> </view>
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import { import {
mapState, mapState,
mapMutations, mapMutations,
@ -149,7 +62,17 @@
import GoodList from '@/components/GoodList'; import GoodList from '@/components/GoodList';
import PromotionGood from '@/components/PromotionGood'; import PromotionGood from '@/components/PromotionGood';
import CouponWindow from '@/components/CouponWindow'; import CouponWindow from '@/components/CouponWindow';
import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue' import Menu from '@/components/Menu';
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar'
import Adv from '@/components/sh-adv'
import Groupon from '@/components/sh-groupon.vue'
import Banner from './components/Banner';
import HotCommodity from './components/HotCommodity';
import FirstNewProduct from './components/FirstNewProduct';
import ProductsRecommended from './components/ProductsRecommended';
import Live from './components/Live';
import { import {
getHomeData, getHomeData,
getShare getShare
@ -167,18 +90,36 @@
components: { components: {
// swiper, // swiper,
// swiperSlide, // swiperSlide,
uniNoticeBar, UniNoticeBar,
GoodList, GoodList,
PromotionGood, PromotionGood,
CouponWindow CouponWindow,
Menu,
Adv,
Groupon,
Banner,
HotCommodity,
FirstNewProduct,
ProductsRecommended,
Live
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
CustomBar: this.CustomBar,
StatusBar: this.StatusBar,
formatMenus: [],
categoryCurrent: 0,
menuNum: 4,
bgcolor: '',
bgColor: '',
swiperCurrent: 0, //
webviewId: 0,
showCoupon: false, showCoupon: false,
logoUrl: '', logoUrl: '',
banner: [], banner: [],
menus: [], menus: [],
combinationList: [],
roll: [], roll: [],
activity: [], activity: [],
activityOne: {}, activityOne: {},
@ -191,6 +132,7 @@
bastList: [] bastList: []
}, },
likeInfo: [], likeInfo: [],
live: [],
lovely: [], lovely: [],
benefit: [], benefit: [],
couponList: [], couponList: [],
@ -246,15 +188,26 @@
slidesPerView: 'auto', slidesPerView: 'auto',
observer: true, observer: true,
observeParents: true observeParents: true
} },
bgImage: ''
}; };
}, },
computed: { computed: {
singNew() { singNew() {
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!"; return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!";
} },
customStyle() {
var bgImage = this.bgImage;
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
return style
},
}, },
onShow: function() { onShow: function () {
this.getLocation() this.getLocation()
let that = this; let that = this;
uni.showLoading({ uni.showLoading({
@ -269,15 +222,32 @@
that.$set(that, 'firstList', res.data.firstList); that.$set(that, 'firstList', res.data.firstList);
that.$set(that, 'bastList', res.data.bastList); that.$set(that, 'bastList', res.data.bastList);
that.$set(that, 'likeInfo', res.data.likeInfo); that.$set(that, 'likeInfo', res.data.likeInfo);
that.$set(that, 'live', res.data.liveList);
that.$set(that, 'lovely', res.data.lovely); that.$set(that, 'lovely', res.data.lovely);
that.$set(that, 'benefit', res.data.benefit); that.$set(that, 'benefit', res.data.benefit);
that.$set(that, 'couponList', res.data.couponList); that.$set(that, 'couponList', res.data.couponList);
that.$set(that, 'combinationList', res.data.combinationList);
uni.hideLoading(); uni.hideLoading();
that.setOpenShare(); that.setOpenShare();
// that.doColorThief()
}); });
}, },
methods: { methods: {
...mapActions(["getLocation"]), ...mapActions(["getLocation"]),
onShareTimeline: function () {
return {
title: this.miniHomeRemark,
imageUrl: this.miniHomeImg,
path: "pages/home/index?spread=" + uni.getStorageSync("uid")
}
},
onShareAppMessage: function () {
return {
title: this.miniHomeRemark,
imageUrl: this.miniHomeImg,
path: "pages/home/index?spread=" + uni.getStorageSync("uid")
}
},
goRoll(item) { goRoll(item) {
if (item.uniapp_url) { if (item.uniapp_url) {
this.$yrouter.push(item.uniapp_url) this.$yrouter.push(item.uniapp_url)
@ -309,7 +279,7 @@
goGoodsPromotion() { goGoodsPromotion() {
this.$yrouter.push('/pages/shop/GoodsPromotion/index'); this.$yrouter.push('/pages/shop/GoodsPromotion/index');
}, },
setOpenShare: function() { setOpenShare: function () {
if (this.$deviceType == 'weixin') { if (this.$deviceType == 'weixin') {
getShare().then(res => { getShare().then(res => {
var data = res.data.data; var data = res.data.data;
@ -323,15 +293,10 @@
}) })
} }
}, },
startQr: function() { startQr: function () {
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
let option = handleUrlParam(res.result) let option = handleUrlParam(res.result)
console.log(option)
// {productId: "19", spread: "21", codeType: "routine"}
// {productId: "19", spread: "21", pageType: "good", codeType: "routine"}
switch (option.pageType) { switch (option.pageType) {
case 'good': case 'good':
// //
@ -370,15 +335,23 @@
}); });
break; break;
} }
} }
}); });
} },
} getbgcolor(e) {
this.bgcolor = e;
},
},
created: async function () {
// await this.doColorThief();
},
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.content_box {
background: #f6f6f6;
}
.index { .index {
background-color: #fff; background-color: #fff;
} }
@ -390,7 +363,13 @@
.fixed-header { .fixed-header {
position: fixed; position: fixed;
z-index: 99; z-index: 99;
// #ifdef H5
top: 88rpx;
// #endif
// #ifndef H5
top: 0; top: 0;
// #endif
left: 0; left: 0;
right: 0; right: 0;
background: #fff; background: #fff;
@ -400,4 +379,65 @@
height: 98rpx height: 98rpx
} }
} }
.head_box {
position: relative;
z-index: 10;
width: 100%;
// background: #fff;
transition: all linear 0.3s;
/deep/.cuIcon-back {
display: none;
}
.nav-title {
font-size: 38rpx;
font-family: PingFang SC;
font-weight: 500;
color: #fff;
}
}
.cu-bar.fixed {
position: fixed;
width: 100%;
top: 0;
z-index: 1024;
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
}
.cu-bar {
box-sizing: border-box;
.index .header {
height: 64rpx;
// width: 100%;
// padding: 0 30rpx;
// box-sizing: border-box;
}
}
.header-search {
transition: all linear 0.3s;
}
.cu-bar .action {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
height: 100%;
max-height: 100%;
&:first-child {
margin-left: 15px;
font-size: 15px;
}
}
.home_content_box {
margin-top: -10rpx;
}
</style> </style>

13
pages/order/OrderDetails/index.vue

@ -126,7 +126,7 @@
<view class="name"> <view class="name">
{{ orderInfo.realName }} {{ orderInfo.realName }}
<text class="phone">{{ orderInfo.userPhone }}</text> <text class="phone">{{ orderInfo.userPhone }}</text>
<text 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>
@ -134,7 +134,7 @@
<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 class="iconfont icon-tonghua font-color-red" :href="'tel:' + system_store.phone"></span> <span @click="telPhone(system_store.phone)" class="iconfont icon-tonghua font-color-red" :href="'tel:' + system_store.phone"></span>
</div> </div>
<div>{{ system_store.address }}</div> <div>{{ system_store.address }}</div>
</div> </div>
@ -366,6 +366,15 @@ export default {
}, },
}); });
}, },
//
telPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
fail() {
console.log("取消拨打");
}
});
},
showChang: function (data) { showChang: function (data) {
// //
this.$yrouter.push({ this.$yrouter.push({

735
pages/order/OrderSubmission/index.vue

@ -2,24 +2,12 @@
<view class="order-submission"> <view class="order-submission">
<view class="allAddress" :style="systemStore ? '' : 'padding-top: 0.2*100rpx'"> <view class="allAddress" :style="systemStore ? '' : 'padding-top: 0.2*100rpx'">
<view class="nav acea-row"> <view class="nav acea-row">
<view <view class="item font-color-red" :class="shipping_type === 0 ? 'on' : 'on2'" @click="addressType(0)"
class="item font-color-red" v-if="systemStore"></view>
:class="shipping_type === 0 ? 'on' : 'on2'" <view class="item font-color-red" :class="shipping_type === 1 ? 'on' : 'on2'" @click="addressType(1)"
@click="addressType(0)" v-if="systemStore"></view>
v-if="systemStore"
></view>
<view
class="item font-color-red"
:class="shipping_type === 1 ? 'on' : 'on2'"
@click="addressType(1)"
v-if="systemStore"
></view>
</view> </view>
<view <view class="address acea-row row-between-wrapper" v-if="shipping_type === 0" @click="addressTap">
class="address acea-row row-between-wrapper"
v-if="shipping_type === 0"
@click="addressTap"
>
<view class="addressCon" v-if="addressInfo.realName"> <view class="addressCon" v-if="addressInfo.realName">
<view class="name"> <view class="name">
{{ addressInfo.realName }} {{ addressInfo.realName }}
@ -35,11 +23,7 @@
</view> </view>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
<div <div class="address acea-row row-between-wrapper" v-if="shipping_type === 1" @click="showStoreList">
class="address acea-row row-between-wrapper"
v-if="shipping_type === 1"
@click="showStoreList"
>
<div class="addressCon" v-if="storeItems"> <div class="addressCon" v-if="storeItems">
<div class="name"> <div class="name">
{{ storeItems.name }} {{ storeItems.name }}
@ -69,10 +53,7 @@
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
</view> </view>
<view <view class="item acea-row row-between-wrapper" v-if="deduction === false && enableIntegral === true">
class="item acea-row row-between-wrapper"
v-if="deduction === false && enableIntegral === true"
>
<view>积分抵扣</view> <view>积分抵扣</view>
<view class="discount"> <view class="discount">
<view class="select-btn"> <view class="select-btn">
@ -124,33 +105,21 @@
<view class="item"> <view class="item">
<view>支付方式</view> <view>支付方式</view>
<view class="list"> <view class="list">
<view <view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')"
class="payItem acea-row row-middle" v-show="isWeixin">
:class="active === 'weixin' ? 'on' : ''"
@click="payItem('weixin')"
v-show="isWeixin"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付
</view> </view>
<view class="tip">微信快捷支付</view> <view class="tip">微信快捷支付</view>
</view> </view>
<view <view class="payItem acea-row row-middle" :class="active === 'weixin' ? 'on' : ''" @click="payItem('weixin')"
class="payItem acea-row row-middle" v-show="!isWeixin">
:class="active === 'weixin' ? 'on' : ''"
@click="payItem('weixin')"
v-show="!isWeixin"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付 <view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>微信支付
</view> </view>
<view class="tip">微信快捷支付</view> <view class="tip">微信快捷支付</view>
</view> </view>
<view <view class="payItem acea-row row-middle" :class="active === 'yue' ? 'on' : ''" @click="payItem('yue')">
class="payItem acea-row row-middle"
:class="active === 'yue' ? 'on' : ''"
@click="payItem('yue')"
>
<view class="name acea-row row-center-wrapper"> <view class="name acea-row row-center-wrapper">
<view class="iconfont icon-icon-test" :class="active === 'yue' ? 'bounceIn' : ''"></view>余额支付 <view class="iconfont icon-icon-test" :class="active === 'yue' ? 'bounceIn' : ''"></view>余额支付
</view> </view>
@ -185,392 +154,396 @@
</view> </view>
<view class="settlement" @click="createOrder">立即结算</view> <view class="settlement" @click="createOrder">立即结算</view>
</view> </view>
<CouponListWindow <CouponListWindow v-on:couponchange="changecoupon($event)" v-model="showCoupon" :price="orderPrice.totalPrice"
v-on:couponchange="changecoupon($event)" :checked="usableCoupon.id" @checked="changeCoupon" :cartid="cartid"></CouponListWindow>
v-model="showCoupon" <AddressWindow @checked="changeAddress" @redirect="addressRedirect" v-model="showAddress" :checked="addressInfo.id"
:price="orderPrice.totalPrice" ref="mychild"></AddressWindow>
:checked="usableCoupon.id"
@checked="changeCoupon"
:cartid="cartid"
></CouponListWindow>
<AddressWindow
@checked="changeAddress"
@redirect="addressRedirect"
v-model="showAddress"
:checked="addressInfo.id"
ref="mychild"
></AddressWindow>
</view> </view>
</template> </template>
<style scoped lang="less"> <style scoped lang="less">
.order-submission .wrapper .shipping select { .order-submission .wrapper .shipping select {
color: #999; color: #999;
padding-right: 0.15 * 100rpx; padding-right: 0.15 * 100rpx;
} }
.order-submission .wrapper .shipping .iconfont { .order-submission .wrapper .shipping .iconfont {
font-size: 0.3 * 100rpx; font-size: 0.3 * 100rpx;
color: #515151; color: #515151;
} }
.order-submission .allAddress { .order-submission .allAddress {
width: 100%; width: 100%;
background-image: linear-gradient(to bottom, #eb3729 0%, #eb3729 100%); background-image: linear-gradient(to bottom, #eb3729 0%, #eb3729 100%);
background-image: -webkit-linear-gradient( background-image: -webkit-linear-gradient(to bottom,
to bottom, #eb3729 0%,
#eb3729 0%, #eb3729 100%);
#eb3729 100% background-image: -moz-linear-gradient(to bottom, #eb3729 0%, #eb3729 100%);
); padding-top: 1 * 100rpx;
background-image: -moz-linear-gradient(to bottom, #eb3729 0%, #eb3729 100%); }
padding-top: 1 * 100rpx;
}
.order-submission .allAddress .nav { .order-submission .allAddress .nav {
margin: 0 auto; margin: 0 auto;
padding: 0 30rpx; padding: 0 30rpx;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
.order-submission .allAddress .nav .item { .order-submission .allAddress .nav .item {
flex: 1; flex: 1;
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on { .order-submission .allAddress .nav .item.on {
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on:before { .order-submission .allAddress .nav .item.on:before {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
content: "快递配送"; content: "快递配送";
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
display: block; display: block;
height: 0; height: 0;
left: 0; left: 0;
right: 0; right: 0;
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
border-style: solid; border-style: solid;
border-color: #fff; border-color: #fff;
z-index: 9; z-index: 9;
text-align: center; text-align: center;
line-height: 0.14 * 100rpx; line-height: 0.14 * 100rpx;
} }
.order-submission .allAddress .nav .item:nth-of-type(2).on:before { .order-submission .allAddress .nav .item:nth-of-type(2).on:before {
content: "到店自提"; content: "到店自提";
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
} }
.order-submission .allAddress .nav .item.on2 { .order-submission .allAddress .nav .item.on2 {
position: relative; position: relative;
} }
.order-submission .allAddress .nav .item.on2:before { .order-submission .allAddress .nav .item.on2:before {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
content: "到店自提"; content: "到店自提";
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
display: block; display: block;
height: 0; height: 0;
left: 0; left: 0;
right: 0; right: 0;
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
border-style: solid; border-style: solid;
border-color: #d5e6e6; border-color: #d5e6e6;
text-align: center; text-align: center;
line-height: 0.14 * 100rpx; line-height: 0.14 * 100rpx;
} }
.order-submission .allAddress .nav .item:nth-of-type(1).on2:before { .order-submission .allAddress .nav .item:nth-of-type(1).on2:before {
content: "快递配送"; content: "快递配送";
border-width: 0.4 * 100rpx; border-width: 0.4 * 100rpx;
} }
.order-submission .allAddress .address { .order-submission .allAddress .address {
width: 6.91 * 100rpx; width: 6.91 * 100rpx;
height: 1.5 * 100rpx; height: 1.5 * 100rpx;
margin: 0 auto; margin: 0 auto;
box-sizing: border-box; box-sizing: border-box;
} }
.order-submission .allAddress .line { .order-submission .allAddress .line {
width: 7.1 * 100rpx; width: 7.1 * 100rpx;
margin: 0 auto; margin: 0 auto;
} }
.order-submission .wrapper .item .discount input::placeholder { .order-submission .wrapper .item .discount input::placeholder {
color: #ccc; color: #ccc;
} }
</style> </style>
<script> <script>
import OrderGoods from "@/components/OrderGoods"; import OrderGoods from "@/components/OrderGoods";
import CouponListWindow from "@/components/CouponListWindow"; import CouponListWindow from "@/components/CouponListWindow";
import AddressWindow from "@/components/AddressWindow"; import AddressWindow from "@/components/AddressWindow";
import { postOrderConfirm, postOrderComputed, createOrder } from "@/api/order"; import {
import { mapGetters } from "vuex"; postOrderConfirm,
import { handleOrderPayResults } from "@/libs/order"; postOrderComputed,
import { weappPay } from "@/libs/wechat"; createOrder
import { isWeixin, handleErrorMessage } from "@/utils"; } from "@/api/order";
import {
mapGetters
} from "vuex";
import {
handleOrderPayResults,
subscribeMessage
} from "@/libs/order";
import {
weappPay
} from "@/libs/wechat";
import {
isWeixin,
handleErrorMessage
} from "@/utils";
const NAME = "OrderSubmission", const NAME = "OrderSubmission",
_isWeixin = isWeixin(); _isWeixin = isWeixin();
export default { export default {
name: NAME, name: NAME,
components: { components: {
OrderGoods, OrderGoods,
CouponListWindow, CouponListWindow,
AddressWindow, AddressWindow,
},
props: {},
data: function () {
return {
offlinePayStatus: 2,
from: this.$deviceType,
deduction: true,
enableIntegral: true,
enableIntegralNum: 0,
isWeixin: _isWeixin,
pinkId: 0,
active: _isWeixin ? "weixin" : "yue",
showCoupon: false,
showAddress: false,
addressInfo: {},
couponId: 0,
orderGroupInfo: {
priceGroup: {},
},
usableCoupon: {},
addressLoaded: false,
useIntegral: false,
orderPrice: {
payPrice: "计算中",
},
mark: "",
systemStore: {},
shipping_type: 0,
contacts: "",
contactsTel: "",
storeSelfMention: 0,
cartid: "",
};
},
computed: mapGetters(["userInfo", "storeItems"]),
watch: {
useIntegral() {
this.computedPrice();
}, },
$yroute(n) { props: {},
if (n.name === NAME) this.getCartInfo(); data: function () {
return {
offlinePayStatus: 2,
from: this.$deviceType,
deduction: true,
enableIntegral: true,
enableIntegralNum: 0,
isWeixin: _isWeixin,
pinkId: 0,
active: _isWeixin ? "weixin" : "yue",
showCoupon: false,
showAddress: false,
addressInfo: {},
couponId: 0,
orderGroupInfo: {
priceGroup: {},
},
usableCoupon: {},
addressLoaded: false,
useIntegral: false,
orderPrice: {
payPrice: "计算中",
},
mark: "",
systemStore: {},
shipping_type: 0,
contacts: "",
contactsTel: "",
storeSelfMention: 0,
cartid: "",
};
}, },
shipping_type() { computed: mapGetters(["userInfo", "storeItems"]),
this.computedPrice(); watch: {
}, useIntegral() {
}, this.computedPrice();
mounted: function () { },
let that = this; $yroute(n) {
this.$store.dispatch("getUser", true); if (n.name === NAME) this.getCartInfo();
that.getCartInfo(); },
console.log(that.$yroute); shipping_type() {
if (that.$yroute.query.pinkid !== undefined) { this.computedPrice();
that.pinkId = that.$yroute.query.pinkid; },
}
if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id;
console.log(that.cartid);
}
},
methods: {
showStoreList() {
this.$store.commit("get_to", "orders");
this.$yrouter.push({
path: "/pages/shop/StoreList/index",
});
}, },
addressType: function (index) { onShow: function () {
if (index && !this.systemStore.id) { let that = this;
uni.showToast({ this.$store.dispatch("getUser", true);
title: "暂无门店信息,您无法选择到店自提!", that.getCartInfo();
icon: "none", console.log(that.$yroute);
duration: 2000, if (that.$yroute.query.pinkid !== undefined) {
}); that.pinkId = that.$yroute.query.pinkid;
return; }
if (that.$yroute.query.id !== undefined) {
that.cartid = that.$yroute.query.id;
console.log(that.cartid);
} }
console.log(this);
this.shipping_type = index;
},
changeUseIntegral: function (e) {
// this.computedPrice();
this.useIntegral = e.mp.detail.value[0];
},
computedPrice() {
let shipping_type = this.shipping_type;
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
shipping_type: parseInt(shipping_type) + 1,
}).then((res) => {
const data = res.data;
if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
id: data.result.orderId,
},
});
} else {
this.orderPrice = data.result;
}
});
}, },
getCartInfo() { methods: {
const cartIds = this.$yroute.query.id; showStoreList() {
if (!cartIds) { this.$store.commit("get_to", "orders");
uni.showToast({ this.$yrouter.push({
title: "参数有误", path: "/pages/shop/StoreList/index",
icon: "none",
duration: 2000,
}); });
return this.$yrouter.back(); },
} addressType: function (index) {
postOrderConfirm(cartIds) if (index && !this.systemStore.id) {
.then((res) => {
console.log(res, 999999);
console.log(res.data.systemStore || {}, 999999);
this.offlinePayStatus = res.data.offline_pay_status;
this.orderGroupInfo = res.data;
this.deduction = res.data.deduction;
this.usableCoupon = res.data.usableCoupon || {};
this.addressInfo = res.data.addressInfo || {};
//
this.systemStore = res.data.systemStore || {};
this.storeSelfMention = res.data.storeSelfMention;
this.computedPrice();
})
.catch(() => {
uni.showToast({ uni.showToast({
title: "加载订单数据失败", title: "暂无门店信息,您无法选择到店自提!",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return;
}
console.log(this);
this.shipping_type = index;
},
changeUseIntegral: function (e) {
// this.computedPrice();
this.useIntegral = e.mp.detail.value[0];
},
computedPrice() {
let shipping_type = this.shipping_type;
postOrderComputed(this.orderGroupInfo.orderKey, {
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
shipping_type: parseInt(shipping_type) + 1,
}).then((res) => {
const data = res.data;
if (data.status === "EXTEND_ORDER") {
this.$yrouter.replace({
path: "/pages/order/OrderDetails/index",
query: {
id: data.result.orderId,
},
});
} else {
this.orderPrice = data.result;
}
}); });
}, },
addressTap: function () { getCartInfo() {
this.showAddress = true; const cartIds = this.$yroute.query.id;
if (!this.addressLoaded) { if (!cartIds) {
this.addressLoaded = true;
this.$refs.mychild.getAddressList();
}
},
addressRedirect() {
this.addressLoaded = false;
this.showAddress = false;
},
couponTap: function () {
this.showCoupon = true;
},
changeCoupon: function (coupon) {
if (!coupon) {
this.usableCoupon = {
couponTitle: "不使用优惠券",
id: 0,
};
} else {
this.usableCoupon = coupon;
}
this.computedPrice();
},
payItem: function (index) {
this.active = index;
},
changeAddress(addressInfo) {
this.addressInfo = addressInfo;
this.computedPrice();
},
createOrder() {
let shipping_type = this.shipping_type;
if (!this.active) {
uni.showToast({
title: "请选择支付方式",
icon: "none",
duration: 2000,
});
return;
}
if (!this.addressInfo.id && !this.shipping_type) {
uni.showToast({
title: "请选择收货地址",
icon: "none",
duration: 2000,
});
return;
}
if (this.shipping_type) {
if (
(this.contacts === "" || this.contactsTel === "") &&
this.shipping_type
) {
uni.showToast({ uni.showToast({
title: "请填写联系人或联系人电话", title: "参数有误",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return this.$yrouter.back();
} }
postOrderConfirm(cartIds)
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) { .then((res) => {
console.log(res, 999999);
console.log(res.data.systemStore || {}, 999999);
this.offlinePayStatus = res.data.offline_pay_status;
this.orderGroupInfo = res.data;
this.deduction = res.data.deduction;
this.usableCoupon = res.data.usableCoupon || {};
this.addressInfo = res.data.addressInfo || {};
//
this.systemStore = res.data.systemStore || {};
this.storeSelfMention = res.data.storeSelfMention;
this.computedPrice();
})
.catch(() => {
uni.showToast({
title: "加载订单数据失败",
icon: "none",
duration: 2000,
});
});
},
addressTap: function () {
this.showAddress = true;
if (!this.addressLoaded) {
this.addressLoaded = true;
this.$refs.mychild.getAddressList();
}
},
addressRedirect() {
this.addressLoaded = false;
this.showAddress = false;
},
couponTap: function () {
this.showCoupon = true;
},
changeCoupon: function (coupon) {
if (!coupon) {
this.usableCoupon = {
couponTitle: "不使用优惠券",
id: 0,
};
} else {
this.usableCoupon = coupon;
}
this.computedPrice();
},
payItem: function (index) {
this.active = index;
},
changeAddress(addressInfo) {
this.addressInfo = addressInfo;
this.computedPrice();
},
createOrder() {
let shipping_type = this.shipping_type;
if (!this.active) {
uni.showToast({ uni.showToast({
title: "请填写正确的手机号", title: "请选择支付方式",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return;
} }
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) { if (!this.addressInfo.id && !this.shipping_type) {
uni.showToast({ uni.showToast({
title: "请填写您的真实姓名", title: "请选择收货地址",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
return; return;
} }
}
uni.showLoading({ if (this.shipping_type) {
title: "生成订单中", if (
}); (this.contacts === "" || this.contactsTel === "") &&
let from = {}; this.shipping_type
if (this.$deviceType == "app") { ) {
from.from = "app"; uni.showToast({
} title: "请填写联系人或联系人电话",
createOrder(this.orderGroupInfo.orderKey, { icon: "none",
realName: this.contacts, duration: 2000,
phone: this.contactsTel, });
addressId: this.addressInfo.id, return;
useIntegral: this.useIntegral ? 1 : 0, }
couponId: this.usableCoupon.id || 0,
payType: this.active, if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
pinkId: this.pinkId, uni.showToast({
seckillId: this.orderGroupInfo.seckill_id, title: "请填写正确的手机号",
combinationId: this.orderGroupInfo.combination_id, icon: "none",
bargainId: this.orderGroupInfo.bargain_id, duration: 2000,
from: this.from, });
mark: this.mark || "", return;
shippingType: parseInt(shipping_type) + 1, }
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id, if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
...from, uni.showToast({
}) title: "请填写您的真实姓名",
.then((res) => { icon: "none",
uni.hideLoading(); duration: 2000,
handleOrderPayResults.call(this, res.data, "create"); });
}) return;
.catch((err) => { }
handleErrorMessage(err, "创建订单失败"); }
uni.showLoading({
title: "生成订单中",
}); });
let from = {};
if (this.$deviceType == "app") {
from.from = "app";
}
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
createOrder(this.orderGroupInfo.orderKey, {
realName: this.contacts,
phone: this.contactsTel,
addressId: this.addressInfo.id,
useIntegral: this.useIntegral ? 1 : 0,
couponId: this.usableCoupon.id || 0,
payType: this.active,
pinkId: this.pinkId,
seckillId: this.orderGroupInfo.seckill_id,
combinationId: this.orderGroupInfo.combination_id,
bargainId: this.orderGroupInfo.bargain_id,
from: this.from,
mark: this.mark || "",
shippingType: parseInt(shipping_type) + 1,
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id,
...from,
})
.then((res) => {
uni.hideLoading();
handleOrderPayResults.call(this, res.data, "create", this.active);
})
.catch((err) => {
handleErrorMessage(err, "创建订单失败");
});
},
}, },
}, };
};
</script> </script>

7
pages/orderAdmin/AdminOrder/index.vue

@ -66,9 +66,10 @@
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>下单时间</view> <view>下单时间</view>
<view class="conter"> <!-- <view class="conter"> -->
<data-format :date="orderInfo.addTime"></data-format> <view class="conter">{{ orderInfo.createTime }}</view>
</view> <!-- <data-format :date="orderInfo.addTime"></data-format> -->
<!-- </view> -->
</view> </view>
<view class="item acea-row row-between"> <view class="item acea-row row-between">
<view>支付状态</view> <view>支付状态</view>

9
pages/orderAdmin/AdminOrderList/index.vue

@ -12,9 +12,9 @@
<view class="item" v-for="(item, listIndex) in list" :key="listIndex"> <view class="item" v-for="(item, listIndex) in list" :key="listIndex">
<view class="order-num acea-row row-middle" @click="toDetail(item)"> <view class="order-num acea-row row-middle" @click="toDetail(item)">
<text>订单号{{ item.orderId }}</text> <text>订单号{{ item.orderId }}</text>
<text class="time"> <text class="time acea-row row-between">
<text>下单时间</text> <text>下单时间</text>
<data-format :date="item.addTime"></data-format> <text class="conter">{{ item.createTime }}</text>
</text> </text>
</view> </view>
<view class="pos-order-goods" v-for="(val, key) in item.cartInfo" :key="key"> <view class="pos-order-goods" v-for="(val, key) in item.cartInfo" :key="key">
@ -38,10 +38,7 @@
<view class="public-total"> <view class="public-total">
{{ item.totalNum }}件商品应支付 {{ item.totalNum }}件商品应支付
<text class="money">{{ item.payPrice }}</text> <text class="money">{{ item.payPrice }}</text>
( 邮费 ¥{{ ( 邮费 ¥{{item.totalPostage}})
item.totalPostage
}}
)
</view> </view>
<view class="operation acea-row row-between-wrapper"> <view class="operation acea-row row-between-wrapper">
<view class="more"> <view class="more">

3
pages/shop/GoodsCollection/index.vue

@ -47,6 +47,7 @@ export default {
return { return {
page: 1, page: 1,
limit: 20, limit: 20,
type:'collect',
collectProductList: [], collectProductList: [],
loadTitle: "", loadTitle: "",
loading: false, loading: false,
@ -71,7 +72,7 @@ export default {
if (that.loading) return; //false if (that.loading) return; //false
if (that.loadend) return; //false if (that.loadend) return; //false
that.loading = true; that.loading = true;
getCollectUser(that.page, that.limit).then(res => { getCollectUser(that.page, that.limit,that.type).then(res => {
that.loading = false; that.loading = false;
//apply();js; //apply();js;
that.collectProductList.push.apply(that.collectProductList, res.data); that.collectProductList.push.apply(that.collectProductList, res.data);

1581
pages/shop/GoodsCon/index.vue

File diff suppressed because it is too large Load Diff

102
pages/shop/GoodsFoot/index.vue

@ -0,0 +1,102 @@
<template>
<view ref="container">
<view class="collectionGoods" v-if="collectProductList.length > 0">
<view
class="item acea-row row-between-wrapper"
v-for="(item, collectProductListIndex) in collectProductList"
:key="collectProductListIndex"
@click="goGoodsCon(item)"
>
<view class="pictrue">
<image :src="item.image" />
</view>
<view class="text acea-row row-column-between">
<view class="infor line1">{{ item.storeName }}</view>
<view class="acea-row row-between-wrapper">
<view class="money font-color-red">{{ item.price }}</view>
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
</view>
</view>
</view>
</view>
<Loading :loaded="loadend" :loading="loading"></Loading>
<view
class="noCommodity"
style="background-color:#fff;"
v-if="collectProductList.length < 1 && page > 1"
>
<view class="noPictrue">
<image src="@/static/images/noCollection.png" class="image" />
</view>
<Recommend></Recommend>
</view>
</view>
</template>
<script>
import Recommend from "@/components/Recommend";
import { getCollectUser, getCollectDel } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "GoodsFoot",
components: {
Recommend,
Loading
},
props: {},
data: function() {
return {
page: 1,
limit: 20,
type:'foot',
collectProductList: [],
loadTitle: "",
loading: false,
loadend: false
};
},
mounted: function() {
this.get_user_collect_product();
},
onReachBottom() {
!this.loading && this.get_user_collect_product();
},
methods: {
goGoodsCon(item) {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: { id: item.pid }
});
},
get_user_collect_product: function() {
let that = this;
if (that.loading) return; //false
if (that.loadend) return; //false
that.loading = true;
getCollectUser(that.page, that.limit,that.type).then(res => {
that.loading = false;
//apply();js;
that.collectProductList.push.apply(that.collectProductList, res.data);
that.loadend = res.data.length < that.limit; //
that.page = that.page + 1;
});
},
//
delCollection: function(index) {
let that = this,
id = that.collectProductList[index].pid,
category = that.collectProductList[index].category;
getCollectDel(id, category).then(function() {
uni.showToast({
title: "删除成功",
icon: "success",
duration: 2000,
complete: () => {
that.collectProductList.splice(index, 1);
that.$set(that, "collectProductList", that.collectProductList);
}
});
});
}
}
};
</script>

182
pages/shop/Live/LiveList/index.vue

@ -0,0 +1,182 @@
<template>
<view class="page_box">
<view class="head_box">
<view class="live-tab">
<view class="live-tab__item" v-for="tab in liveTab" :key="tab.title" @tap="selTab(tab)">
<view class="live-tab__item-name">{{ tab.name }}</view>
<text class="live-tab__item--link" :class="{ 'live-tab__item--active': tabCur == tab.title }"></text>
</view>
</view>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<view class="list-box">
<block v-for="live in liveList" :key="live.roomId">
<shop-live-card :detail="live"></shop-live-card>
</block>
</view>
<view v-if="liveList.length" class="cu-load text-gray" :class="loadStatus"></view>
</scroll-view>
</view>
<Loading :loaded="loaded" :loading="loading"></Loading>
</view>
</template>
<script>
import {
yxWechatLive
} from "@/api/live";
import ShopLiveCard from '@/components/ShopLiveCard.vue'
import Loading from "@/components/Loading";
export default {
components: {
ShopLiveCard,
Loading
},
data() {
return {
tabCur: 'all',
liveStatus: '',
loaded: false,
loading: false,
liveTab: [{
title: 'all',
name: '全部',
code: ''
},
{
title: 'prevue',
name: '预告',
code: '102'
},
{
title: 'living',
name: '直播中',
code: '101'
},
{
title: 'lived',
name: '已结束',
code: '103'
}
],
liveList: [],
loadStatus: '', //loading,over
currentPage: 0,
size: 10,
lastPage: 0
};
},
computed: {},
onLoad() {
this.getLiveList();
},
onHide() {},
methods: {
// tab
selTab(tab) {
console.log(tab)
this.tabCur = tab.title;
this.liveStatus = tab.code;
this.liveList = [];
this.loaded=false;
this.loading=false;
this.getLiveListTab();
},
//
getLiveListTab() {
let that = this;
yxWechatLive({
liveStatus: that.liveStatus,
page: 0,
size: that.size
}).then(res => {
that.liveList = [...that.liveList, ...res.data.content];
that.lastPage = res.data.lastPage;
this.loaded = res.data.content.length < that.size;
this.loading = false;
});
},
//
getLiveList() {
let that = this;
if (this.loading || this.loaded) return;
this.loading = true;
yxWechatLive({
liveStatus: this.liveStatus,
page: this.currentPage,
size: this.size
}).then(res => {
that.liveList = that.liveList.concat(res.data.content)
this.currentPage++;
this.loaded = res.data.content.length < that.size;
this.loading = false;
});
}
},
onReachBottom() {
!this.loading && this.getLiveList();
}
};
</script>
<style lang="scss">
// tab
.live-tab {
width: 100%;
height: 96rpx;
background: #fff;
display: flex;
align-items: center;
&__item {
flex: 1;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
&__item-name {
font-size: 28rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(51, 51, 51, 1);
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
&__item--link {
width: 68rpx;
height: 4rpx;
background: transparent;
border-radius: 2rpx;
}
&__item--active {
width: 68rpx;
height: 4rpx;
background: rgba(213, 166, 90, 1);
border-radius: 2rpx;
}
}
// list
.scroll-box {
.list-box {
width: 100%;
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
padding: 25rpx;
}
}
</style>

735
pages/shop/ShoppingCart/index.vue

@ -17,19 +17,13 @@
购物数量 购物数量
<text class="num font-color-red">{{ count }}</text> <text class="num font-color-red">{{ count }}</text>
</view> </view>
<view <view v-if="cartList.valid.length > 0" class="administrate acea-row row-center-wrapper" @click="manage">
v-if="cartList.valid.length > 0" {{ footerswitch ? '取消' : '管理' }}</view>
class="administrate acea-row row-center-wrapper"
@click="manage"
>{{ footerswitch ? '取消' : '管理' }}</view>
</view> </view>
<view v-if="validList.length > 0 || cartList.invalid.length > 0"> <view v-if="validList.length > 0 || cartList.invalid.length > 0">
<view class="list"> <view class="list">
<view <view class="item acea-row row-between-wrapper" v-for="(item, cartListValidIndex) in validList"
class="item acea-row row-between-wrapper" :key="cartListValidIndex">
v-for="(item, cartListValidIndex) in validList"
:key="cartListValidIndex"
>
<view class="select-btn"> <view class="select-btn">
<view class="checkbox-wrapper"> <view class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)"> <checkbox-group @change="switchSelect(cartListValidIndex)">
@ -46,31 +40,19 @@
</view> </view>
<view class="text"> <view class="text">
<view class="line1">{{ item.productInfo.storeName }}</view> <view class="line1">{{ item.productInfo.storeName }}</view>
<view <view class="infor line1" v-if="item.productInfo.attrInfo">属性{{ item.productInfo.attrInfo.sku }}</view>
class="infor line1"
v-if="item.productInfo.attrInfo"
>属性{{ item.productInfo.attrInfo.sku }}</view>
<view class="money">{{ item.truePrice }}</view> <view class="money">{{ item.truePrice }}</view>
</view> </view>
<view class="carnum acea-row row-center-wrapper"> <view class="carnum acea-row row-center-wrapper">
<view <view class="reduce" :class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''"
class="reduce" @click.prevent="reduce(cartListValidIndex)">-</view>
:class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''"
@click.prevent="reduce(cartListValidIndex)"
>-</view>
<view class="num">{{ item.cartNum }}</view> <view class="num">{{ item.cartNum }}</view>
<view <view class="plus" v-if="validList[cartListValidIndex].attrInfo"
class="plus"
v-if="validList[cartListValidIndex].attrInfo"
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].attrInfo.stock ? 'on' : ''" :class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].attrInfo.stock ? 'on' : ''"
@click.prevent="plus(cartListValidIndex)" @click.prevent="plus(cartListValidIndex)">+</view>
>+</view> <view class="plus" v-else
<view
class="plus"
v-else
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock ? 'on' : ''" :class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock ? 'on' : ''"
@click.prevent="plus(cartListValidIndex)" @click.prevent="plus(cartListValidIndex)">+</view>
>+</view>
</view> </view>
</view> </view>
</view> </view>
@ -78,25 +60,15 @@
<view class="invalidGoods" v-if="cartList.invalid.length > 0"> <view class="invalidGoods" v-if="cartList.invalid.length > 0">
<view class="goodsNav acea-row row-between-wrapper"> <view class="goodsNav acea-row row-between-wrapper">
<view @click="goodsOpen"> <view @click="goodsOpen">
<text <text class="iconfont" :class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"></text>失效商品
class="iconfont"
:class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"
></text>失效商品
</view> </view>
<view class="del" @click="delInvalidGoods"> <view class="del" @click="delInvalidGoods">
<text class="iconfont icon-shanchu1"></text>清空 <text class="iconfont icon-shanchu1"></text>清空
</view> </view>
</view> </view>
<view class="goodsList" :hidden="goodsHidden"> <view class="goodsList" :hidden="goodsHidden">
<view <view v-for="(item, cartListinvalidIndex) in cartList.invalid" :key="cartListinvalidIndex">
v-for="(item, cartListinvalidIndex) in cartList.invalid" <view @click="goGoodsCon(item)" class="item acea-row row-between-wrapper" v-if="item.productInfo">
:key="cartListinvalidIndex"
>
<view
@click="goGoodsCon(item)"
class="item acea-row row-between-wrapper"
v-if="item.productInfo"
>
<view class="invalid acea-row row-center-wrapper">失效</view> <view class="invalid acea-row row-center-wrapper">失效</view>
<view class="pictrue"> <view class="pictrue">
<image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" /> <image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" />
@ -104,10 +76,8 @@
</view> </view>
<view class="text acea-row row-column-between"> <view class="text acea-row row-column-between">
<view class="line1">{{ item.productInfo.storeName }}</view> <view class="line1">{{ item.productInfo.storeName }}</view>
<view <view class="infor line1" v-if="item.productInfo.attrInfo">属性{{ item.productInfo.attrInfo.sku }}
class="infor line1" </view>
v-if="item.productInfo.attrInfo"
>属性{{ item.productInfo.attrInfo.sku }}</view>
<view class="acea-row row-between-wrapper"> <view class="acea-row row-between-wrapper">
<view class="end">该商品已下架</view> <view class="end">该商品已下架</view>
</view> </view>
@ -160,77 +130,96 @@
</view> </view>
</view> </view>
</view> </view>
<Authorization v-if="!$store.getters.token" /> <Authorization v-else />
</view> </view>
</template> </template>
<script> <script>
import Recommend from "@/components/Recommend"; import Recommend from "@/components/Recommend";
import Authorization from "@/pages/authorization/index"; import Authorization from "@/pages/authorization/index";
import { mapGetters } from "vuex"; import {
mapGetters
} from "vuex";
import { import {
getCartList, getCartList,
postCartDel, postCartDel,
changeCartNum, changeCartNum,
getCartCount getCartCount
} from "@/api/store"; } from "@/api/store";
import { postCollectAll } from "@/api/user"; import {
import { mul, add } from "@/utils/bc"; postCollectAll
import cookie from "@/utils/store/cookie"; } from "@/api/user";
import {
mul,
add
} from "@/utils/bc";
import cookie from "@/utils/store/cookie";
const CHECKED_IDS = "cart_checked"; const CHECKED_IDS = "cart_checked";
export default { export default {
name: "ShoppingCart", name: "ShoppingCart",
components: { components: {
Recommend, Recommend,
Authorization Authorization
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
cartList: { cartList: {
invalid: [], invalid: [],
valid: [] valid: []
}, },
validList: [], validList: [],
isAllSelect: false, isAllSelect: false,
cartCount: 0, cartCount: 0,
countmoney: 0, countmoney: 0,
goodsHidden: true, goodsHidden: true,
footerswitch: false, footerswitch: false,
count: 0, count: 0,
checkedIds: [], checkedIds: [],
loaded: false loaded: false
}; };
}, },
computed: mapGetters(["userInfo", "token"]), computed: mapGetters(["userInfo", "token"]),
// watch: { // watch: {
// $yroute(n) { // $yroute(n) {
// if (n.name === "ShoppingCart") { // if (n.name === "ShoppingCart") {
// this.carnum(); // this.carnum();
// this.countMoney(); // this.countMoney();
// this.getCartList(); // this.getCartList();
// this.gainCount(); // this.gainCount();
// this.goodsHidden = true; // this.goodsHidden = true;
// this.footerswitch = false; // this.footerswitch = false;
// } // }
// }, // },
// cartList(list) { // cartList(list) {
// this.validList = list.valid; // this.validList = list.valid;
// } // }
// }, // },
watch: { watch: {
userInfo(user) { userInfo(user) {
if (user.uid) { if (user.uid) {
this.carnum(); this.carnum();
this.countMoney(); this.countMoney();
this.getCartList(); this.getCartList();
this.gainCount(); this.gainCount();
}
},
token(token) {
if (this.userInfo.uid) {
this.carnum();
this.countMoney();
this.getCartList();
this.gainCount();
}
},
cartList(list) {
this.validList = list.valid;
} }
}, },
token(token) { onShow: function () {
if (this.userInfo.uid) { if (this.userInfo.uid) {
this.carnum(); this.carnum();
this.countMoney(); this.countMoney();
@ -238,297 +227,285 @@ export default {
this.gainCount(); this.gainCount();
} }
}, },
cartList(list) { methods: {
this.validList = list.valid; goGoodsCon(item) {
} this.$yrouter.push({
}, path: "/pages/shop/GoodsCon/index",
onShow: function() { query: {
if (this.userInfo.uid) { id: item.productId
this.carnum(); }
this.countMoney(); });
this.getCartList(); },
this.gainCount(); getCartList: function () {
} let that = this;
}, getCartList().then(res => {
methods: { that.cartList = res.data;
goGoodsCon(item) { let checkedIds = cookie.get(CHECKED_IDS) || [];
this.$yrouter.push({ if (!Array.isArray(checkedIds)) checkedIds = [];
path: "/pages/shop/GoodsCon/index", this.cartList.valid.forEach(cart => {
query: { if (checkedIds.indexOf(cart.id) !== -1) cart.checked = true;
id: item.productId });
} if (checkedIds.length) {
}); that.checkedIds = checkedIds;
}, that.isAllSelect = checkedIds.length === this.cartList.valid.length;
getCartList: function() { that.carnum();
let that = this; that.countMoney();
getCartList().then(res => { }
that.cartList = res.data; this.loaded = true;
let checkedIds = cookie.get(CHECKED_IDS) || []; });
if (!Array.isArray(checkedIds)) checkedIds = []; },
this.cartList.valid.forEach(cart => { //
if (checkedIds.indexOf(cart.id) !== -1) cart.checked = true; delgoods: function () {
let that = this,
id = [],
valid = [],
list = that.cartList.valid;
list.forEach(function (val) {
if (val.checked === true) {
id.push(val.id);
}
}); });
if (checkedIds.length) { if (id.length === 0) {
that.checkedIds = checkedIds; uni.showToast({
that.isAllSelect = checkedIds.length === this.cartList.valid.length; title: "请选择产品",
icon: "none",
duration: 2000
});
return;
}
postCartDel(id).then(function () {
list.forEach(function (val, i) {
if (val.checked === false || val.checked === undefined)
valid.push(list[i]);
});
that.$set(that.cartList, "valid", valid);
that.carnum(); that.carnum();
that.countMoney(); that.countMoney();
} that.gainCount();
this.loaded = true; that.getCartList();
}); });
}, },
// // //
delgoods: function() { gainCount: function () {
let that = this, let that = this;
id = [], getCartCount().then(res => {
valid = [], that.count = res.data.count;
list = that.cartList.valid; });
list.forEach(function(val) { },
if (val.checked === true) { //
delInvalidGoods: function () {
let that = this,
id = [],
list = that.cartList.invalid;
list.forEach(function (val) {
id.push(val.id); id.push(val.id);
}
});
if (id.length === 0) {
uni.showToast({
title: "请选择产品",
icon: "none",
duration: 2000
}); });
return; postCartDel(id).then(function () {
} list.splice(0, list.length);
postCartDel(id).then(function() { that.gainCount();
list.forEach(function(val, i) { that.getCartList();
if (val.checked === false || val.checked === undefined)
valid.push(list[i]);
}); });
that.$set(that.cartList, "valid", valid); },
that.carnum(); //;
that.countMoney(); collectAll: function () {
that.gainCount(); let that = this,
that.getCartList(); data = {
}); id: [],
}, category: ""
// // },
gainCount: function() { list = that.cartList.valid;
let that = this; list.forEach(function (val) {
getCartCount().then(res => { if (val.checked === true) {
that.count = res.data.count; data.id.push(val.product_id);
}); data.category = val.type;
}, }
// });
delInvalidGoods: function() { if (data.id.length === 0) {
let that = this, uni.showToast({
id = [], title: "请选择产品",
list = that.cartList.invalid; icon: "none",
list.forEach(function(val) { duration: 2000
id.push(val.id); });
}); return;
postCartDel(id).then(function() {
list.splice(0, list.length);
that.gainCount();
that.getCartList();
});
},
//;
collectAll: function() {
let that = this,
data = {
id: [],
category: ""
},
list = that.cartList.valid;
list.forEach(function(val) {
if (val.checked === true) {
data.id.push(val.product_id);
data.category = val.type;
} }
}); postCollectAll(data).then(function () {
if (data.id.length === 0) { uni.showToast({
uni.showToast({ title: "收藏成功!",
title: "请选择产品", icon: "none",
icon: "none", duration: 2000
duration: 2000 });
}); });
return; },
} //
postCollectAll(data).then(function() { placeOrder: function () {
uni.showToast({ let that = this,
title: "收藏成功!", list = that.cartList.valid,
icon: "none", id = [];
duration: 2000 list.forEach(function (val) {
if (val.checked === true) {
id.push(val.id);
}
}); });
}); if (id.length === 0) {
}, uni.showToast({
// title: "请选择产品",
placeOrder: function() { icon: "none",
let that = this, duration: 2000
list = that.cartList.valid, });
id = []; return;
list.forEach(function(val) {
if (val.checked === true) {
id.push(val.id);
} }
}); this.$yrouter.push({
if (id.length === 0) { path: "/pages/order/OrderSubmission/index",
uni.showToast({ query: {
title: "请选择产品", id: id.join(",")
icon: "none", }
duration: 2000
}); });
return; },
} manage: function () {
this.$yrouter.push({ let that = this;
path: "/pages/order/OrderSubmission/index", that.footerswitch = !that.footerswitch;
query: { },
id: id.join(",") goodsOpen: function () {
let that = this;
that.goodsHidden = !that.goodsHidden;
},
//
plus: function (index) {
let that = this;
let list = that.cartList.valid[index];
list.cartNum++;
if (list.attrInfo) {
if (list.cartNum >= list.attrInfo.stock) {
that.$set(list, "cart_num", list.attrInfo.stock);
}
} else {
if (list.cartNum >= list.stock) {
that.$set(list, "cart_num", list.stock);
}
} }
}); that.carnum();
}, that.countMoney();
manage: function() { that.syncCartNum(list);
let that = this; },
that.footerswitch = !that.footerswitch; //
}, reduce: function (index) {
goodsOpen: function() { let that = this;
let that = this; let list = that.cartList.valid[index];
that.goodsHidden = !that.goodsHidden; if (list.cartNum <= 1) {
}, uni.showToast({
// title: "已经是底线啦!",
plus: function(index) { icon: "none",
let that = this; duration: 2000
let list = that.cartList.valid[index]; });
list.cartNum++; return;
if (list.attrInfo) {
if (list.cartNum >= list.attrInfo.stock) {
that.$set(list, "cart_num", list.attrInfo.stock);
} }
} else { list.cartNum--;
if (list.cartNum >= list.stock) { if (list.cartNum < 1) {
that.$set(list, "cart_num", list.stock); that.$set(list, "cart_num", 1);
} }
} that.carnum();
that.carnum(); that.countMoney();
that.countMoney(); that.syncCartNum(list);
that.syncCartNum(list); },
}, syncCartNum(cart) {
// if (!cart.sync) {
reduce: function(index) { changeCartNum(cart.id, Math.max(cart.cartNum, 1) || 1)
let that = this; .then(res => {
let list = that.cartList.valid[index]; this.getCartList();
if (list.cartNum <= 1) { this.gainCount();
uni.showToast({ })
title: "已经是底线啦!", .catch(error => {
icon: "none", this.gainCount();
duration: 2000 uni.showToast({
}); title: error.response.data.msg,
return; icon: "none",
} duration: 2000
list.cartNum--; });
if (list.cartNum < 1) {
that.$set(list, "cart_num", 1);
}
that.carnum();
that.countMoney();
that.syncCartNum(list);
},
syncCartNum(cart) {
if (!cart.sync) {
changeCartNum(cart.id, Math.max(cart.cartNum, 1) || 1)
.then(res => {
this.getCartList();
this.gainCount();
})
.catch(error => {
this.gainCount();
uni.showToast({
title: error.response.data.msg,
icon: "none",
duration: 2000
}); });
}); }
} },
}, //
// switchSelect: function (index) {
switchSelect: function(index) { let that = this,
let that = this, cart = that.cartList.valid[index],
cart = that.cartList.valid[index], i = this.checkedIds.indexOf(cart.id);
i = this.checkedIds.indexOf(cart.id); cart.checked = !cart.checked;
cart.checked = !cart.checked;
if (i !== -1) this.checkedIds.splice(i, 1); if (i !== -1) this.checkedIds.splice(i, 1);
if (cart.checked) { if (cart.checked) {
this.checkedIds.push(cart.id); this.checkedIds.push(cart.id);
}
let len = that.cartList.valid.length;
let selectnum = [];
for (let i = 0; i < len; i++) {
if (that.cartList.valid[i].checked === true) {
selectnum.push(true);
} }
} let len = that.cartList.valid.length;
that.isAllSelect = selectnum.length === len; let selectnum = [];
that.$set(that, "cartList", that.cartList); for (let i = 0; i < len; i++) {
that.$set(that, "isAllSelect", that.isAllSelect); if (that.cartList.valid[i].checked === true) {
cookie.set(CHECKED_IDS, that.checkedIds); selectnum.push(true);
that.carnum(); }
that.gainCount();
that.countMoney();
},
//
allChecked: function(e) {
console.log(e);
let that = this;
let selectAllStatus = e.mp.detail.value[0] == "allSelect" ? true : false;
console.log(selectAllStatus);
// let selectAllStatus = that.isAllSelect;
let checkedIds = [];
// for (let i = 0; i < array.length; i++) {
// array[i].checked = selectAllStatus;
// checked.push()
// }
that.cartList.valid.forEach(cart => {
cart.checked = selectAllStatus;
if (selectAllStatus) {
checkedIds.push(cart.id);
} }
}); that.isAllSelect = selectnum.length === len;
let cartList = { that.$set(that, "cartList", that.cartList);
...that.cartList that.$set(that, "isAllSelect", that.isAllSelect);
}; cookie.set(CHECKED_IDS, that.checkedIds);
that.cartList = []; that.carnum();
that.cartList = cartList; that.gainCount();
console.log(this.cartList); that.countMoney();
this.$set(this, "cartList", this.cartList); },
this.$set(this, "isAllSelect", selectAllStatus); //
this.checkedIds = checkedIds; allChecked: function (e) {
cookie.set(CHECKED_IDS, checkedIds); console.log(e);
that.carnum(); let that = this;
that.countMoney(); let selectAllStatus = e.mp.detail.value[0] == "allSelect" ? true : false;
this.$forceUpdate(); console.log(selectAllStatus);
}, // let selectAllStatus = that.isAllSelect;
// let checkedIds = [];
carnum: function() { // for (let i = 0; i < array.length; i++) {
let that = this; // array[i].checked = selectAllStatus;
var carnum = 0; // checked.push()
var array = that.cartList.valid; // }
for (let i = 0; i < array.length; i++) { that.cartList.valid.forEach(cart => {
if (array[i].checked === true) { cart.checked = selectAllStatus;
carnum += parseInt(array[i].cartNum); if (selectAllStatus) {
checkedIds.push(cart.id);
}
});
let cartList = {
...that.cartList
};
that.cartList = [];
that.cartList = cartList;
console.log(this.cartList);
this.$set(this, "cartList", this.cartList);
this.$set(this, "isAllSelect", selectAllStatus);
this.checkedIds = checkedIds;
cookie.set(CHECKED_IDS, checkedIds);
that.carnum();
that.countMoney();
this.$forceUpdate();
},
//
carnum: function () {
let that = this;
var carnum = 0;
var array = that.cartList.valid;
for (let i = 0; i < array.length; i++) {
if (array[i].checked === true) {
carnum += parseInt(array[i].cartNum);
}
} }
} that.$set(that, "cartCount", carnum);
that.$set(that, "cartCount", carnum); },
}, //
// countMoney: function () {
countMoney: function() { let that = this;
let that = this; let carmoney = 0;
let carmoney = 0; let array = that.cartList.valid;
let array = that.cartList.valid; for (let i = 0; i < array.length; i++) {
for (let i = 0; i < array.length; i++) { if (array[i].checked === true) {
if (array[i].checked === true) { carmoney = add(carmoney, mul(array[i].cartNum, array[i].truePrice));
carmoney = add(carmoney, mul(array[i].cartNum, array[i].truePrice)); }
} }
that.countmoney = carmoney;
} }
that.countmoney = carmoney;
} }
} };
};
</script> </script>

19
pages/shop/StoreList/index.vue

@ -16,7 +16,7 @@
</view> </view>
<view class="row-right"> <view class="row-right">
<view> <view>
<a class="store-phone" :href="'tel:' + item.phone"> <a class="store-phone" @click="telPhone(item.phone)">
<text class="iconfont icon-dadianhua01"></text> <text class="iconfont icon-dadianhua01"></text>
</a> </a>
</view> </view>
@ -35,7 +35,7 @@
<script> <script>
import Loading from "@/components/Loading"; import Loading from "@/components/Loading";
import { storeListApi } from "@/api/store"; import { storeListApi } from "@/api/store";
import { isWeixin } from "@/utils/index"; import { isWeixin,tel } from "@/utils/index";
import { wechatEvevt, wxShowLocation } from "@/libs/wechat"; import { wechatEvevt, wxShowLocation } from "@/libs/wechat";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie";
@ -79,6 +79,15 @@ export default {
this.$yrouter.back(); this.$yrouter.back();
} }
}, },
//
telPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
fail() {
console.log("取消拨打");
}
});
},
// //
getList: function() { getList: function() {
if (this.loading || this.loaded) return; if (this.loading || this.loaded) return;
@ -98,7 +107,11 @@ export default {
this.mapKey = res.data.mapKey; this.mapKey = res.data.mapKey;
}) })
.catch(err => { .catch(err => {
this.$dialog.error(err.msg); uni.showToast({
title: err.msg,
icon: "none",
duration: 2000,
});
}); });
} }
} }

443
pages/user/Login/index.vue

@ -1,19 +1,9 @@
<template> <template>
<view class="register absolute"> <view class="register absolute">
<view class="shading">
<view class="pictrue acea-row row-center-wrapper">
<image src="@/static/images/logo.png" />
</view>
</view>
<view class="whiteBg" v-if="formItem === 1"> <view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row row-center-wrapper"> <view class="title acea-row row-between-wrapper">
<view <view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
class="item" @click="navTap(index)" :key="index">{{ item }}</view>
:class="current === index ? 'on' : ''"
v-for="(item, index) in navList"
@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">
@ -50,12 +40,8 @@
<use xlink:href="#icon-code_1" /> <use xlink:href="#icon-code_1" />
</svg>--> </svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
class="code" @click="code">{{ text }}</button>
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</view> </view>
</view> </view>
</view> </view>
@ -67,7 +53,9 @@
</view> </view>
</view> </view>
<view class="whiteBg" v-else> <view class="whiteBg" v-else>
<view class="title">注册账号</view> <view class="title acea-row row-between-wrapper">
<view class="item on">注册账号</view>
</view>
<view class="list"> <view class="list">
<view class="item"> <view class="item">
<view> <view>
@ -83,12 +71,8 @@
<use xlink:href="#icon-code_1" /> <use xlink:href="#icon-code_1" />
</svg>--> </svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
class="code" @click="code">{{ text }}</button>
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -99,6 +83,7 @@
<input type="password" placeholder="填写您的登录密码" v-model="password" /> <input type="password" placeholder="填写您的登录密码" v-model="password" />
</view> </view>
</view> </view>
<!-- #ifndef H5 -->
<view class="item"> <view class="item">
<view> <view>
<!-- <svg class="icon" aria-hidden="true"> <!-- <svg class="icon" aria-hidden="true">
@ -107,6 +92,8 @@
<input type="text" placeholder="输入邀请码" v-model="inviteCode" /> <input type="text" placeholder="输入邀请码" v-model="inviteCode" />
</view> </view>
</view> </view>
<!-- #endif -->
</view> </view>
<view class="logon" @click="register">注册</view> <view class="logon" @click="register">注册</view>
<view class="tip"> <view class="tip">
@ -114,216 +101,242 @@
<text @click="formItem = 1" class="font-color-red">立即登录</text> <text @click="formItem = 1" class="font-color-red">立即登录</text>
</view> </view>
</view> </view>
<view class="bottom"></view>
</view> </view>
</template> </template>
<script> <script>
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from "@/mixins/SendVerifyCode";
import { login, loginMobile, registerVerify, register } from "@/api/user"; import {
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate"; login,
import { validatorDefaultCatch } from "@/utils/dialog"; loginMobile,
import dayjs from "dayjs"; registerVerify,
import cookie from "@/utils/store/cookie"; 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"; import {
handleGetUserInfo
} from "@/utils";
const BACK_URL = "login_back_url"; const BACK_URL = "login_back_url";
export default { export default {
name: "Login", name: "Login",
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
data: function() { data: function () {
return { return {
navList: ["账号登录"], navList: ["账号登录"],
current: 0, current: 0,
account: "", account: "",
password: "", password: "",
captcha: "", captcha: "",
inviteCode: "", inviteCode: "",
formItem: 1, formItem: 1,
type: "login" type: "login"
}; };
}, },
methods: { methods: {
async loginMobile() { async loginMobile() {
var that = this; var that = this;
const { account, captcha } = that; const {
try { account,
await that captcha
.$validator({ } = that;
account: [ try {
required(required.message("手机号码")), await that
chs_phone(chs_phone.message()) .$validator({
], account: [
captcha: [ required(required.message("手机号码")),
required(required.message("验证码")), chs_phone(chs_phone.message())
alpha_num(alpha_num.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")
}) })
.validate({ .then(res => {
account, var data = res.data;
captcha 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
});
}); });
} catch (e) { },
return validatorDefaultCatch(e); async register() {
} var that = this;
loginMobile({ const {
phone: that.account, account,
captcha: that.captcha, captcha,
spread: cookie.get("spread") password
}) } = that;
.then(res => { try {
var data = res.data; await that
that.$store.commit("login", data.token, dayjs(data.expires_time)); .$validator({
handleGetUserInfo(); account: [
}) required(required.message("手机号码")),
.catch(err => { chs_phone(chs_phone.message())
uni.showToast({ ],
title: err.msg || err.response.data.msg|| err.response.data.message, captcha: [
icon: "none", required(required.message("验证码")),
duration: 2000 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() {
async register() { var that = this;
var that = this; const {
const { account, captcha, password } = that; account
try { } = that;
await that try {
.$validator({ 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: [ account: [
required(required.message("手机号码")), required(required.message("账号")),
chs_phone(chs_phone.message()) attrs.range([5, 16], attrs.range.message("账号")),
], alpha_num(alpha_num.message("账号"))
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
], ],
password: [ password: [
required(required.message("密码")), required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")), attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码")) alpha_num(alpha_num.message("密码"))
] ]
}) }).validate({
.validate({
account, account,
captcha,
password password
}); });
} catch (e) { } catch (e) {
return validatorDefaultCatch(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({ login({
username: account, username: account,
password, password,
spread: cookie.get("spread") spread: cookie.get("spread")
}) })
.then(({ data }) => { .then(({
this.$store.commit("login", data.token, dayjs(data.expires_time)); data
handleGetUserInfo(); }) => {
// let replace=this.$yroute.query.replace this.$store.commit("login", data.token, dayjs(data.expires_time));
// if(replace){ handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
// } // }
// this.$yrouter.replace({ // this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index' // path: this.$yroute.query.replace || '/pages/home/index'
// }); // });
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
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",
duration: 2000 duration: 2000
});
}); });
}); }
} }
} };
};
</script> </script>

17
pages/user/PersonalData/index.vue

@ -43,20 +43,23 @@
<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>密码</view> <view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view class="input acea-row row-between-wrapper"> <view>密码</view>
<text>点击修改密码</text> <view class="input acea-row row-between-wrapper">
<text class="iconfont icon-suozi"></text> <text>点击修改密码</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 -->
<view <view
class="logOut cart-color acea-row row-center-wrapper" class="logOut cart-color acea-row row-center-wrapper"
@click="logout" @click="logout"
v-if="$deviceType!='routine'"
>退出登录</view> >退出登录</view>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>

609
pages/user/Recharge/index.vue

@ -15,23 +15,16 @@
</view> </view>
<view class="info-wrapper"> <view class="info-wrapper">
<view class="picList acea-row row-between mt-20"> <view class="picList acea-row row-between mt-20">
<view <view class="pic-box pic-box-color acea-row row-center-wrapper row-column"
class="pic-box pic-box-color acea-row row-center-wrapper row-column" :class="activePic === index ? 'pic-box-color-active' : ''" v-for="(item, index) in picList" :key="index"
:class="activePic === index ? 'pic-box-color-active' : ''" @click="picCharge(index, item)">
v-for="(item, index) in picList"
:key="index"
@click="picCharge(index, item)"
>
<view class="pic-number-pic"> <view class="pic-number-pic">
<text> <text>
{{ item.value.price }} {{ item.value.price }}
<text class="pic-number"></text> <text class="pic-number"></text>
</text> </text>
</view> </view>
<view <view class="pic-number" v-if="item.value.give_price > 0">赠送{{ item.value.give_price }} </view>
class="pic-number"
v-if="item.value.give_price > 0"
>赠送{{ item.value.give_price }} </view>
</view> </view>
<!-- <view <!-- <view
class="pic-box pic-box-color acea-row row-center-wrapper" class="pic-box pic-box-color acea-row row-center-wrapper"
@ -52,293 +45,335 @@
</view> </view>
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import {
import { weappPay } from "@/libs/wechat"; mapGetters
import { rechargeWechat, getRechargeApi } from "@/api/user"; } from "vuex";
import { add, sub } from "@/utils/bc"; import {
weappPay
} from "@/libs/wechat";
import {
rechargeWechat,
getRechargeApi
} from "@/api/user";
import {
add,
sub
} from "@/utils/bc";
import {
subscribeMessage
} from "@/libs/order";
export default { export default {
name: "Recharge", name: "Recharge",
components: {}, components: {},
props: {}, props: {},
data: function () { data: function () {
return { return {
active: 0, active: 0,
from: this.$deviceType, from: this.$deviceType,
money: "", money: "",
now_money: "", now_money: "",
picList: [], picList: [],
activePic: 0, activePic: 0,
numberPic: "", numberPic: "",
paid_price: "", paid_price: "",
rechar_id: 0, rechar_id: 0,
}; };
}, },
computed: mapGetters(["userInfo"]), computed: mapGetters(["userInfo"]),
mounted: function () { mounted: function () {
this.now_money = this.userInfo.nowMoney; this.now_money = this.userInfo.nowMoney;
this.getRecharge(); this.getRecharge();
}, },
methods: { methods: {
/** /**
* 充值额度选择 * 充值额度选择
*/ */
getRecharge() { getRecharge() {
getRechargeApi() getRechargeApi()
.then((res) => { .then((res) => {
this.picList = res.data.recharge_price_ways || []; this.picList = res.data.recharge_price_ways || [];
if (this.picList[0]) { if (this.picList[0]) {
this.rechar_id = this.picList[0].id; this.rechar_id = this.picList[0].id;
this.paid_price = this.picList[0].value.price; this.paid_price = this.picList[0].value.price;
this.numberPic = this.picList[0].value.give_price; this.numberPic = this.picList[0].value.give_price;
} }
}) })
.catch((res) => { .catch((res) => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
},
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({ uni.showToast({
title: title: "请输入您要充值的金额",
err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
}); return;
}, } else if (this.picList.length == this.activePic && price < 0.01) {
/**
* 选择金额
*/
picCharge(idx, item) {
this.activePic = idx;
if (idx == this.picList.length) {
this.rechar_id = 0;
this.paid_price = "";
this.numberPic = "";
} else {
this.money = "";
this.rechar_id = item.id;
this.paid_price = item.value.give_price;
this.numberPic = item.value.price;
}
},
recharge: function () {
let that = this,
price = Number(this.money);
if (this.picList.length == this.activePic && price === 0) {
uni.showToast({
title: "请输入您要充值的金额",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price < 0.01) {
uni.showToast({
title: "充值金额不能低于0.01",
icon: "none",
duration: 2000,
});
return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: that.from,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
});
})
.catch((err) => {
console.log(err);
uni.showToast({ uni.showToast({
title: title: "充值金额不能低于0.01",
err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
}); return;
} else if (this.picList.length == this.activePic && price > 99999) {
uni.showToast({
title: "充值金额不能大于99999",
icon: "none",
duration: 2000,
});
return;
}
let prices = "",
paid_price = "";
if (price) {
prices = price;
paid_price = 0;
} else {
prices = that.numberPic;
paid_price = that.paid_price;
}
rechargeWechat({
price: prices,
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
paid_price: paid_price,
rechar_id: that.rechar_id,
})
.then((res) => {
console.log(res);
var data = res.data.data;
weappPay(res.data.data)
.then(() => {
prices = add(prices, paid_price);
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
uni.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
this.$yrouter.back();
})
.finally((res) => {
//if(typeof(res) == "undefined") return
uni.showToast({
title: res,
icon: "none",
duration: 2000,
});
})
.catch(function () {
uni.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
});
})
.catch((err) => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000,
});
});
},
}, },
}, };
};
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
#iframe { #iframe {
display: none; display: none;
} }
.pic-box-color-active {
background-color: #eb3729 !important; .pic-box-color-active {
color: #fff !important; background-color: #eb3729 !important;
} color: #fff !important;
.picList { }
margin-bottom: 0.3 * 100rpx;
margin-top: 0.3 * 100rpx; .picList {
} margin-bottom: 0.3 * 100rpx;
.font-color { margin-top: 0.3 * 100rpx;
color: #e83323; }
}
.recharge { .font-color {
border-radius: 0.1 * 100rpx; color: #e83323;
width: 100%; }
background-color: #fff;
margin: 0.2 * 100rpx auto 0 auto; .recharge {
padding: 0.3 * 100rpx; border-radius: 0.1 * 100rpx;
border-top-right-radius: 0.39 * 100rpx; width: 100%;
border-top-left-radius: 0.39 * 100rpx; background-color: #fff;
margin-top: -0.45 * 100rpx; margin: 0.2 * 100rpx auto 0 auto;
box-sizing: border-box; padding: 0.3 * 100rpx;
} border-top-right-radius: 0.39 * 100rpx;
.recharge .nav { border-top-left-radius: 0.39 * 100rpx;
height: 0.75 * 100rpx; margin-top: -0.45 * 100rpx;
line-height: 0.75 * 100rpx; box-sizing: border-box;
padding: 0 1 * 100rpx; }
}
.recharge .nav .item { .recharge .nav {
font-size: 0.3 * 100rpx; height: 0.75 * 100rpx;
color: #333; line-height: 0.75 * 100rpx;
} padding: 0 1 * 100rpx;
.recharge .nav .item.on { }
font-weight: bold;
border-bottom: 0.04 * 100rpx solid #e83323; .recharge .nav .item {
} font-size: 0.3 * 100rpx;
.recharge .info-wrapper { color: #333;
} }
.recharge .info-wrapper .money {
margin-top: 0.6 * 100rpx; .recharge .nav .item.on {
padding-bottom: 0.2 * 100rpx; font-weight: bold;
border-bottom: 1px dashed #ddd; border-bottom: 0.04 * 100rpx solid #e83323;
text-align: center; }
}
.recharge .info-wrapper .money span { .recharge .info-wrapper {}
font-size: 0.56 * 100rpx;
color: #333; .recharge .info-wrapper .money {
font-weight: bold; margin-top: 0.6 * 100rpx;
} padding-bottom: 0.2 * 100rpx;
.recharge .info-wrapper .money input { border-bottom: 1px dashed #ddd;
display: inline-block; text-align: center;
width: 3 * 100rpx; }
font-size: 0.84 * 100rpx;
text-align: center; .recharge .info-wrapper .money span {
color: #282828; font-size: 0.56 * 100rpx;
font-weight: bold; color: #333;
padding-right: 0.7 * 100rpx; font-weight: bold;
} }
.recharge .info-wrapper .money input::placeholder {
color: #ddd; .recharge .info-wrapper .money input {
} display: inline-block;
.recharge .info-wrapper .money input::-webkit-input-placeholder { width: 3 * 100rpx;
color: #ddd; font-size: 0.84 * 100rpx;
} text-align: center;
.recharge .info-wrapper .money input:-moz-placeholder { color: #282828;
color: #ddd; font-weight: bold;
} padding-right: 0.7 * 100rpx;
.recharge .info-wrapper .money input::-moz-placeholder { }
color: #ddd;
} .recharge .info-wrapper .money input::placeholder {
.recharge .info-wrapper .money input:-ms-input-placeholder { color: #ddd;
color: #ddd; }
}
.tip { .recharge .info-wrapper .money input::-webkit-input-placeholder {
font-size: 0.28 * 100rpx; color: #ddd;
color: #333333; }
font-weight: 800;
margin-bottom: 0.14 * 100rpx; .recharge .info-wrapper .money input:-moz-placeholder {
} color: #ddd;
.recharge .info-wrapper .tips span { }
color: #ef4a49;
} .recharge .info-wrapper .money input::-moz-placeholder {
.recharge .info-wrapper .pay-btn { color: #ddd;
display: block; }
width: 100%;
height: 0.86 * 100rpx; .recharge .info-wrapper .money input:-ms-input-placeholder {
margin: 0.5 * 100rpx auto 0 auto; color: #ddd;
line-height: 0.86 * 100rpx; }
text-align: center;
color: #fff; .tip {
border-radius: 0.5 * 100rpx; font-size: 0.28 * 100rpx;
font-size: 0.3 * 100rpx; color: #333333;
font-weight: bold; font-weight: 800;
} margin-bottom: 0.14 * 100rpx;
.payment-top { }
width: 100%;
height: 3.5 * 100rpx; .recharge .info-wrapper .tips span {
background-color: #eb3729; color: #ef4a49;
} }
.payment-top .name {
font-size: 0.26 * 100rpx; .recharge .info-wrapper .pay-btn {
color: rgba(255, 255, 255, 0.8); display: block;
margin-top: -0.38 * 100rpx; width: 100%;
margin-bottom: 0.3 * 100rpx; height: 0.86 * 100rpx;
} margin: 0.5 * 100rpx auto 0 auto;
.payment-top .pic { line-height: 0.86 * 100rpx;
font-size: 0.32 * 100rpx; text-align: center;
color: #fff; color: #fff;
} border-radius: 0.5 * 100rpx;
.payment-top .pic-font { font-size: 0.3 * 100rpx;
font-size: 0.78 * 100rpx; font-weight: bold;
color: #fff; }
}
.picList .pic-box { .payment-top {
width: 32%; width: 100%;
height: auto; height: 3.5 * 100rpx;
border-radius: 0.2 * 100rpx; background-color: #eb3729;
margin-top: 0.21 * 100rpx; }
padding: 0.2 * 100rpx 0;
} .payment-top .name {
.pic-box-color { font-size: 0.26 * 100rpx;
background-color: #f4f4f4; color: rgba(255, 255, 255, 0.8);
color: #656565; margin-top: -0.38 * 100rpx;
} margin-bottom: 0.3 * 100rpx;
.pic-number { }
font-size: 0.22 * 100rpx;
} .payment-top .pic {
.pic-number-pic { font-size: 0.32 * 100rpx;
font-size: 0.38 * 100rpx; color: #fff;
margin-right: 0.1 * 100rpx; }
text-align: center;
} .payment-top .pic-font {
.pic-box-money { font-size: 0.78 * 100rpx;
width: 100%; color: #fff;
display: block; }
}
.picList .pic-box {
width: 32%;
height: auto;
border-radius: 0.2 * 100rpx;
margin-top: 0.21 * 100rpx;
padding: 0.2 * 100rpx 0;
}
.pic-box-color {
background-color: #f4f4f4;
color: #656565;
}
.pic-number {
font-size: 0.22 * 100rpx;
}
.pic-number-pic {
font-size: 0.38 * 100rpx;
margin-right: 0.1 * 100rpx;
text-align: center;
}
.pic-box-money {
width: 100%;
display: block;
}
</style> </style>

520
pages/user/User/index.vue

@ -18,14 +18,17 @@
<text>ID{{ userInfo.uid || 0}}</text> <text>ID{{ userInfo.uid || 0}}</text>
<text class="iconfont icon-bianji1"></text> <text class="iconfont icon-bianji1"></text>
</view> </view>
<button <!-- #ifdef MP-WEIXIN -->
open-type="getPhoneNumber" <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
@getphonenumber="getPhoneNumber"
class="binding"
v-else
>
<text>绑定手机号</text> <text>绑定手机号</text>
</button> </button>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<button class="binding" @click="goBindPhone()" v-else>
<text>绑定手机号</text>
</button>
<!-- #endif -->
</view> </view>
</view> </view>
<text class="iconfont icon-shezhi" @click="goPersonalData()"></text> <text class="iconfont icon-shezhi" @click="goPersonalData()"></text>
@ -36,11 +39,7 @@
<text>我的余额</text> <text>我的余额</text>
<text class="num">{{ userInfo.nowMoney || 0 }}</text> <text class="num">{{ userInfo.nowMoney || 0 }}</text>
</view> </view>
<view <view @click="goUserPromotion()" class="item" v-if="userInfo.isPromoter === 1 || userInfo.statu === 2">
@click="goUserPromotion()"
class="item"
v-if="userInfo.isPromoter === 1 || userInfo.statu === 2"
>
<text>当前佣金</text> <text>当前佣金</text>
<text class="num">{{ userInfo.brokeragePrice || 0 }}</text> <text class="num">{{ userInfo.brokeragePrice || 0 }}</text>
</view> </view>
@ -65,50 +64,40 @@
<view @click="goMyOrder(0)" class="item"> <view @click="goMyOrder(0)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dfk.png" /> <image src="@/static/images/dfk.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.unpaidCount > 0">{{ userInfo.orderStatusNum.unpaidCount }}</text>
v-if="userInfo.orderStatusNum.unpaidCount > 0"
>{{ userInfo.orderStatusNum.unpaidCount }}</text>
</view> </view>
<view>待付款</view> <view>待付款</view>
</view> </view>
<view @click="goMyOrder(1)" class="item"> <view @click="goMyOrder(1)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dfh.png" /> <image src="@/static/images/dfh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.unshippedCount > 0">{{ userInfo.orderStatusNum.unshippedCount }}</text>
v-if="userInfo.orderStatusNum.unshippedCount > 0"
>{{ userInfo.orderStatusNum.unshippedCount }}</text>
</view> </view>
<view>待发货</view> <view>待发货</view>
</view> </view>
<view @click="goMyOrder(2)" class="item"> <view @click="goMyOrder(2)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dsh.png" /> <image src="@/static/images/dsh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.receivedCount > 0">{{ userInfo.orderStatusNum.receivedCount }}</text>
v-if="userInfo.orderStatusNum.receivedCount > 0"
>{{ userInfo.orderStatusNum.receivedCount }}</text>
</view> </view>
<text>待收货</text> <text>待收货</text>
</view> </view>
<view @click="goMyOrder(3)" class="item"> <view @click="goMyOrder(3)" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/dpj.png" /> <image src="@/static/images/dpj.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.evaluatedCount > 0">{{ userInfo.orderStatusNum.evaluatedCount }}</text>
v-if="userInfo.orderStatusNum.evaluatedCount > 0"
>{{ userInfo.orderStatusNum.evaluatedCount }}</text>
</view> </view>
<text>待评价</text> <text>待评价</text>
</view> </view>
<view @click="goReturnList()" class="item"> <view @click="goReturnList()" class="item">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/sh.png" /> <image src="@/static/images/sh.png" />
<text <text class="order-status-num"
class="order-status-num" v-if="userInfo.orderStatusNum.refundCount > 0">{{ userInfo.orderStatusNum.refundCount }}</text>
v-if="userInfo.orderStatusNum.refundCount > 0"
>{{ userInfo.orderStatusNum.refundCount }}</text>
</view> </view>
<text>售后/退款</text> <text>售后/退款</text>
</view> </view>
@ -144,262 +133,279 @@
:login_type="userInfo.login_type" :login_type="userInfo.login_type"
></SwitchWindow>--> ></SwitchWindow>-->
</view> </view>
<Authorization v-if="!$store.getters.token" /> <Authorization v-else />
</view> </view>
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex"; import {
import { getUserInfo, getMenuUser, bindingPhone } from "@/api/user"; mapState,
import { isWeixin, VUE_APP_RESOURCES_URL } from "@/utils"; mapGetters,
import SwitchWindow from "@/components/SwitchWindow"; mapMutations,
import Authorization from "@/pages/authorization/index"; mapActions
} from "vuex";
import {
getUserInfo,
getMenuUser,
bindingPhone
} from "@/api/user";
import {
isWeixin,
VUE_APP_RESOURCES_URL
} from "@/utils";
import SwitchWindow from "@/components/SwitchWindow";
import Authorization from "@/pages/authorization/index";
const NAME = "User"; const NAME = "User";
export default { export default {
name: NAME, name: NAME,
components: { components: {
SwitchWindow, SwitchWindow,
Authorization Authorization
},
props: {},
data: function() {
return {
MyMenus: [],
switchActive: false,
isWeixin: false
};
},
computed: mapGetters(["userInfo"]),
methods: {
...mapMutations(["updateAuthorizationPage"]),
goReturnList() {
this.$yrouter.push("/pages/order/ReturnList/index");
},
goMyOrder(type) {
this.$yrouter.push({
path: "/pages/order/MyOrder/index",
query: {
type
}
});
},
goUserCoupon() {
this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
},
goIntegral() {
this.$yrouter.push("/pages/user/signIn/Integral/index");
},
goUserPromotion() {
this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
}, },
goUserAccount() { props: {},
this.$yrouter.push({ data: function () {
path: "/pages/user/UserAccount/index" return {
}); MyMenus: [],
switchActive: false,
isWeixin: false
};
}, },
goPersonalData() { computed: mapGetters(["userInfo"]),
this.$yrouter.push("/pages/user/PersonalData/index"); methods: {
}, ...mapMutations(["updateAuthorizationPage"]),
getPhoneNumber: function(e) { goReturnList() {
let thit = this; this.$yrouter.push("/pages/order/ReturnList/index");
// },
if (e.mp.detail.errMsg == "getPhoneNumber:ok") { goMyOrder(type) {
uni.showLoading({ this.$yrouter.push({
title: "绑定中" path: "/pages/order/MyOrder/index",
}); query: {
// type
uni.getProvider({
service: "oauth",
success: function(res) {
// h5
if (res.provider) {
uni.login({
success: loginRes => {
bindingPhone({
code: loginRes.code,
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv
})
.then(res => {
console.log(res);
// this.User();
thit.$store.dispatch("userInfo", true);
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
})
.catch(error => {
uni.hideLoading();
thit.$store.dispatch("userInfo", true);
console.log(error);
uni.showToast({
title:
error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none",
duration: 2000
});
});
},
fail() {
reject("绑定失败");
}
});
}
},
fail() {
reject("获取环境服务商失败");
} }
}); });
} else { },
uni.showToast({ goBindPhone() {
title: "已拒绝授权", this.$yrouter.push({
icon: "none", path: "/pages/user/BindingPhone/index",
duration: 2000
}); });
} },
}, goUserCoupon() {
changeswitch: function(data) { this.$yrouter.push("/pages/user/coupon/UserCoupon/index");
this.switchActive = data; },
}, goIntegral() {
User: function() { this.$yrouter.push("/pages/user/signIn/Integral/index");
let that = this; },
getUserInfo().then(res => { goUserPromotion() {
that.user = res.data; this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
that.orderStatusNum = res.data.orderStatusNum; },
}); goUserAccount() {
}, this.$yrouter.push({
MenuUser: function() { path: "/pages/user/UserAccount/index"
let that = this;
getMenuUser()
.then(res => {
uni.hideLoading();
that.MyMenus = res.data.routine_my_menus;
})
.catch(error => {
uni.hideLoading();
console.log(error);
}); });
}, },
goPages: function(index) { goPersonalData() {
let url = this.MyMenus[index].uniapp_url; this.$yrouter.push("/pages/user/PersonalData/index");
if ( },
url === "/pages/user/promotion/UserPromotion/index" && getPhoneNumber: function (e) {
this.userInfo.statu === 1 let thit = this;
) { //
if (!this.userInfo.isPromoter) { if (e.mp.detail.errMsg == "getPhoneNumber:ok") {
uni.showLoading({
title: "绑定中"
});
//
uni.getProvider({
service: "oauth",
success: function (res) {
// h5
if (res.provider) {
uni.login({
success: loginRes => {
bindingPhone({
code: loginRes.code,
encryptedData: e.mp.detail.encryptedData,
iv: e.mp.detail.iv
})
.then(res => {
console.log(res);
// this.User();
thit.$store.dispatch("userInfo", true);
uni.hideLoading();
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
})
.catch(error => {
uni.hideLoading();
thit.$store.dispatch("userInfo", true);
console.log(error);
uni.showToast({
title: error.msg ||
error.response.data.msg ||
error.response.data.message,
icon: "none",
duration: 2000
});
});
},
fail() {
reject("绑定失败");
}
});
}
},
fail() {
reject("获取环境服务商失败");
}
});
} else {
uni.showToast({ uni.showToast({
title: "您还没有推广权限!!", title: "已拒绝授权",
icon: "none",
duration: 2000
});
}
},
changeswitch: function (data) {
this.switchActive = data;
},
User: function () {
let that = this;
getUserInfo().then(res => {
that.user = res.data;
that.orderStatusNum = res.data.orderStatusNum;
});
},
MenuUser: function () {
let that = this;
getMenuUser()
.then(res => {
uni.hideLoading();
that.MyMenus = res.data.routine_my_menus;
})
.catch(error => {
uni.hideLoading();
console.log(error);
});
},
goPages: function (index) {
let url = this.MyMenus[index].uniapp_url;
if (
url === "/pages/user/promotion/UserPromotion/index" &&
this.userInfo.statu === 1
) {
if (!this.userInfo.isPromoter) {
uni.showToast({
title: "您还没有推广权限!!",
icon: "none",
duration: 2000
});
return;
}
}
if (
url === "/pages/orderAdmin/OrderIndex/index" &&
!this.userInfo.adminid
) {
uni.showToast({
title: "您还不是管理员!!",
icon: "none",
duration: 2000
});
return;
}
console.log(this.userInfo)
if (url === "/pages/orderAdmin/OrderCancellation/index" && !this.userInfo.checkStatus) {
uni.showToast({
title: "您没有核销权限,请后台店员设置!!",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
return; return;
} }
}
if ( this.$yrouter.push({
url === "/pages/orderAdmin/OrderIndex/index" && path: this.MyMenus[index].uniapp_url
!this.userInfo.adminid
) {
uni.showToast({
title: "您还不是管理员!!",
icon: "none",
duration: 2000
}); });
return; },
goPages2: function () {
this.$yrouter.push({
path: "/pages/orderAdmin/OrderCancellation/index"
});
}
},
watch: {
userInfo() {
this.MenuUser();
} }
console.log(this.userInfo) },
if (url === "/pages/orderAdmin/OrderCancellation/index" && !this.userInfo.checkStatus) { onShow() {
uni.showToast({ if (this.$store.getters.token) {
title: "您没有核销权限,请后台店员设置!!", //
icon: "none", uni.showLoading({
duration: 2000 title: "加载中"
}); });
return; this.$store.dispatch("getUser", true);
this.MenuUser();
this.isWeixin = isWeixin();
} }
this.$yrouter.push({
path: this.MyMenus[index].uniapp_url
});
}, },
goPages2: function() { onHide() {
this.$yrouter.push({ console.log("离开用户中心");
path: "/pages/orderAdmin/OrderCancellation/index" this.updateAuthorizationPage(false);
});
}
},
watch: {
userInfo() {
this.MenuUser();
} }
}, };
onShow() {
if (this.$store.getters.token) {
//
uni.showLoading({
title: "加载中"
});
this.$store.dispatch("getUser", true);
this.MenuUser();
this.isWeixin = isWeixin();
}
},
onHide() {
console.log("离开用户中心");
this.updateAuthorizationPage(false);
}
};
</script> </script>
<style lang="less"> <style lang="less">
.footer-line-height { .footer-line-height {
height: 1 * 100rpx; height: 1 * 100rpx;
} }
.order-status-num { .order-status-num {
min-width: 0.33 * 100rpx; min-width: 0.33 * 100rpx;
background-color: #fff; background-color: #fff;
color: #eb3729; color: #eb3729;
border-radius: 15px; border-radius: 15px;
position: absolute; position: absolute;
right: -0.14 * 100rpx; right: -0.14 * 100rpx;
top: -0.15 * 100rpx; top: -0.15 * 100rpx;
font-size: 0.2 * 100rpx; font-size: 0.2 * 100rpx;
padding: 0 0.08 * 100rpx; padding: 0 0.08 * 100rpx;
border: 1px solid #eb3729; border: 1px solid #eb3729;
} }
.pictrue { .pictrue {
position: relative; position: relative;
} }
.switch-h5 { .switch-h5 {
margin-left: 0.2 * 100rpx; margin-left: 0.2 * 100rpx;
} }
.binding { .binding {
margin-top: 0.1 * 100rpx; margin-top: 0.1 * 100rpx;
display: inline-block; display: inline-block;
padding: 0.05 * 100rpx 0.2 * 100rpx; padding: 0.05 * 100rpx 0.2 * 100rpx;
background-color: #ca1f10; background-color: #ca1f10;
border-radius: 50px; border-radius: 50px;
font-size: 0.22 * 100rpx; font-size: 0.22 * 100rpx;
line-height: 1.5; line-height: 1.5;
border: 1px solid #e8695e; border: 1px solid #e8695e;
color: #ffffff; color: #ffffff;
} }
.by { .by {
text-align: center; text-align: center;
padding: 30rpx 0; padding: 30rpx 0;
} }
.by-text {
text-align: center; .by-text {
font-size: 24rpx; text-align: center;
} font-size: 24rpx;
}
</style> </style>

8
pages/user/UserAccount/index.vue

@ -8,7 +8,7 @@
<view>总资产()</view> <view>总资产()</view>
<view class="money">{{ now_money }}</view> <view class="money">{{ now_money }}</view>
</view> </view>
<!-- <navigator url="/pages/user/Recharge/index" class="recharge font-color-red">充值</navigator> --> <navigator url="/pages/user/Recharge/index" class="recharge font-color-red" v-if="is_hide=='0'">充值</navigator>
</view> </view>
<view class="cumulative acea-row row-top"> <view class="cumulative acea-row row-top">
<view class="item"> <view class="item">
@ -31,12 +31,12 @@
</view> </view>
<view>消费记录</view> <view>消费记录</view>
</view> </view>
<!-- <view class="item" @click="goUserBill(2)"> <view class="item" @click="goUserBill(2)" v-if="is_hide=='0'">
<view class="pictrue"> <view class="pictrue">
<image src="@/static/images/record3.png" /> <image src="@/static/images/record3.png" />
</view> </view>
<view>充值记录</view> <view>充值记录</view>
</view> --> </view>
</view> </view>
<view class="advert acea-row row-between-wrapper"></view> <view class="advert acea-row row-between-wrapper"></view>
</view> </view>
@ -54,6 +54,7 @@ export default {
props: {}, props: {},
data: function() { data: function() {
return { return {
is_hide: "1",
now_money: 0, now_money: 0,
orderStatusSum: 0, orderStatusSum: 0,
recharge: 0, recharge: 0,
@ -82,6 +83,7 @@ export default {
that.now_money = res.data.now_money; that.now_money = res.data.now_money;
that.orderStatusSum = res.data.orderStatusSum; that.orderStatusSum = res.data.orderStatusSum;
that.recharge = res.data.recharge; that.recharge = res.data.recharge;
this.is_hide = res.data.is_hide;
}, },
err => { err => {
uni.showToast({ uni.showToast({

25
pages/user/address/AddAddress/index.vue

@ -13,12 +13,7 @@
<view class="name">所在地区</view> <view class="name">所在地区</view>
<view class="picker acea-row row-between-wrapper select-value form-control"> <view class="picker acea-row row-between-wrapper select-value form-control">
<view class="address"> <view class="address">
<CitySelect <CitySelect ref="cityselect" :defaultValue="addressText" @callback="result" :items="district"></CitySelect>
ref="cityselect"
:defaultValue="addressText"
@callback="result"
:items="district"
></CitySelect>
</view> </view>
<view class="iconfont icon-dizhi font-color-red"></view> <view class="iconfont icon-dizhi font-color-red"></view>
</view> </view>
@ -47,7 +42,7 @@
</template> </template>
<script type="text/babel"> <script type="text/babel">
import CitySelect from "@/components/CitySelect"; import CitySelect from "@/components/CitySelect";
import { getAddress, postAddress, getCity } from "@/api/user"; import { getAddress, postAddress, getCity } from "@/api/user";
import attrs, { required, chs_phone } from "@/utils/validate"; import attrs, { required, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog"; import { validatorDefaultCatch } from "@/utils/dialog";
@ -89,7 +84,11 @@ export default {
that.ready = true; that.ready = true;
}) })
.catch(err => { .catch(err => {
that.$dialog.error(err.msg); uni.showToast({
title: err.msg,
icon: "none",
duration: 2000,
});
}); });
}, },
getUserAddress: function() { getUserAddress: function() {
@ -194,10 +193,10 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.address { .address {
text { text {
width: 100%; width: 100%;
display: block; display: block;
}
} }
}
</style> </style>

253
pages/user/promotion/Poster/index.vue

@ -4,12 +4,7 @@
<swiper indicatorDots="true"> <swiper indicatorDots="true">
<block v-for="(item, infoIndex) in info" :key="infoIndex"> <block v-for="(item, infoIndex) in info" :key="infoIndex">
<swiper-item> <swiper-item>
<image <image class="slide-image" :src="item.wap_poster" mode="widthFix" show-menu-by-longpress />
class="slide-image"
:src="item.wap_poster"
mode="widthFix"
show-menu-by-longpress
/>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
@ -18,143 +13,143 @@
</view> </view>
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper"; // import { swiper, swiperSlide } from "vue-awesome-swiper";
import { getSpreadImg } from "@/api/user"; import {
getSpreadImg
} from "@/api/user";
export default { export default {
name: "Poster", name: "Poster",
components: { components: {
// swiper, // swiper,
// swiperSlide // swiperSlide
}, },
props: {}, props: {},
data: function() { data: function () {
return { return {
swiperPosters: { swiperPosters: {
speed: 1000, speed: 1000,
effect: "coverflow", effect: "coverflow",
slidesPerView: "auto", slidesPerView: "auto",
centeredSlides: true, centeredSlides: true,
coverflowEffect: { coverflowEffect: {
rotate: 0, // rotate: 0, //
stretch: -20, // stretch: -20, //
depth: 100, // depth: 100, //
modifier: 3, // modifier: 3, //
slideShadows: false // slideShadows: false //
},
observer: true,
observeParents: true
}, },
observer: true, info: [],
observeParents: true activeIndex: 0
}, };
info: [], },
activeIndex: 0 mounted: function () {
}; this.getIndex();
},
mounted: function() {
this.getIndex();
let that = this;
// this.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex;
// });
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
}
},
methods: {
getIndex: function() {
let that = this; let that = this;
let from = {}; // this.swiper.on("slideChange", function() {
if (this.$deviceType == "app") { // that.activeIndex = that.swiper.activeIndex;
from.from = "app"; // });
},
computed: {
swiper() {
// return this.$refs.mySwiper.swiper;
} }
getSpreadImg(from).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
}, },
downloadIamge: function(imgsrc, name) { methods: {
var that = this; getIndex: function () {
this.isDown = true; let that = this;
var downloadUrl = imgsrc; getSpreadImg({
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
}).then(
res => {
that.info = res.data;
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
},
downloadIamge: function (imgsrc, name) {
var that = this;
this.isDown = true;
var downloadUrl = imgsrc;
if (!wx.saveImageToPhotosAlbum) { if (!wx.saveImageToPhotosAlbum) {
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。" });
}); that.openDialogVisible = true;
that.openDialogVisible = true;
return; return;
} }
// wx.getSetting "scope.writePhotosAlbum" scope // wx.getSetting "scope.writePhotosAlbum" scope
wx.getSetting({ wx.getSetting({
success(res) { success(res) {
if (!res.authSetting["scope.writePhotosAlbum"]) { if (!res.authSetting["scope.writePhotosAlbum"]) {
that.openDialogVisible = true; that.openDialogVisible = true;
// //
wx.authorize({ wx.authorize({
scope: "scope.writePhotosAlbum", scope: "scope.writePhotosAlbum",
success() { success() {
that.downloadImage(downloadUrl); that.downloadImage(downloadUrl);
}, },
fail() { fail() {
// //
// //
wx.openSetting({ wx.openSetting({
success: function(data) {}, success: function (data) {},
fail: function(data) {} fail: function (data) {}
}); });
} }
}); });
} else { } else {
that.downloadImage(downloadUrl); that.downloadImage(downloadUrl);
}
},
fail(res) {
that.openDialogVisible = true;
} }
}, });
fail(res) { },
that.openDialogVisible = true; saveImg: function () {
} this.downloadIamge(
}); this.info[this.activeIndex].wap_poster,
}, "poster" + this.activeIndex
saveImg: function() { );
this.downloadIamge( }
this.info[this.activeIndex].wap_poster,
"poster" + this.activeIndex
);
} }
} };
};
</script> </script>
<style lang="less"> <style lang="less">
page { page {
height: 100%; height: 100%;
} }
.distribution-posters {
height: 100%; .distribution-posters {
} height: 100%;
}
.banenr { .banenr {
height: 100%; height: 100%;
} }
.banner swiper { .banner swiper {
height: 100%; height: 100%;
} }
.banner .slide-image { .banner .slide-image {
width: 100%; width: 100%;
height: auto; height: auto;
} }
</style> </style>

339
pages/user/promotion/UserCash/index.vue

@ -1,17 +1,20 @@
<template> <template>
<view class="cash-withdrawal"> <view class="cash-withdrawal">
<view class="nav acea-row"> <!-- <view class="nav acea-row">
<view <view v-for="(item, navListIndex) in navList" class="item font-color-red" @click="swichNav(navListIndex, item)"
v-for="(item, navListIndex) in navList" :key="navListIndex">
class="item font-color-red"
@click="swichNav(navListIndex, item)"
:key="navListIndex"
>
<view class="line bg-color-red" :class="currentTab === navListIndex ? 'on' : ''"></view> <view class="line bg-color-red" :class="currentTab === navListIndex ? 'on' : ''"></view>
<view class="iconfont" :class="item.icon + ' ' + (currentTab === navListIndex ? 'on' : '')"></view> <view class="iconfont" :class="item.icon + ' ' + (currentTab === navListIndex ? 'on' : '')"></view>
<view>{{ item.name }}</view> <view>{{ item.name }}</view>
</view> </view>
</view> </view> -->
<div class="pos-order-list">
<view class="nav acea-row row-around row-middle">
<view v-for="(item, navListIndex) in navList" class="item" :class="currentTab === navListIndex ? 'on' : ''"
@click="swichNav(navListIndex, item)" :key="navListIndex">{{item.name}}</view>
</view>
</div>
<view class="wrapper"> <view class="wrapper">
<view :hidden="currentTab !== 0" class="list"> <view :hidden="currentTab !== 0" class="list">
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
@ -55,158 +58,198 @@
</view> </view>
</template> </template>
<script> <script>
import { getBank, postCashInfo } from "@/api/user"; import {
import { required } from "@/utils/validate"; getBank,
import { validatorDefaultCatch } from "@/utils/dialog"; postCashInfo
} from "@/api/user";
import {
required
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
export default { export default {
name: "UserCash", name: "UserCash",
components: {}, components: {},
props: {}, props: {},
data: function() { data: function () {
return { return {
navList: [ navList: [{
{ name: "微信", type: "weixin", icon: "icon-weixin2" }, name: "微信",
{ name: "支付宝", type: "alipay", icon: "icon-icon34" } type: "weixin",
], icon: "icon-weixin2"
post: { },
extract_type: "weixin", {
alipay_code: "", name: "支付宝",
money: "", type: "alipay",
name: "", icon: "icon-icon34"
bankname: "", }
cardnum: "", ],
weixin: "" post: {
}, extract_type: "weixin",
currentTab: 0, alipay_code: "",
minPrice: 0, money: "",
banks: [], name: "",
commissionCount: 0 bankname: "",
}; cardnum: "",
}, weixin: ""
mounted: function() {
this.getBank();
},
methods: {
swichNav: function(index, item) {
console.log(item);
this.currentTab = index;
this.post.extract_type = item.type;
},
getBank: function() {
let that = this;
getBank().then(
res => {
that.banks = res.data.extractBank;
that.minPrice = res.data.minPrice;
that.commissionCount = res.data.commissionCount;
}, },
function(err) { currentTab: 0,
uni.showToast({ minPrice: 0,
title: err.msg || err.response.data.msg|| err.response.data.message, banks: [],
icon: "none", commissionCount: 0
duration: 2000 };
});
}
);
}, },
async submitted() { mounted: function () {
let bankname = this.post.bankname, this.getBank();
alipay_code = this.post.alipay_code,
money = this.post.money,
name = this.post.name,
cardnum = this.post.cardnum,
weixin = this.post.weixin,
that = this;
// console.log(parseFloat(money))
if (
parseFloat(money) > parseFloat(that.commissionCount) ||
parseFloat(that.commissionCount) == 0
)
return that.$dialog.message("余额不足");
if (parseFloat(money) < parseFloat(that.minPrice))
return that.$dialog.message("最低提现金额" + that.minPrice);
//console.log(that.post.extract_type)
switch (that.post.extract_type) {
case "alipay":
// if (!name) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!alipay_code) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!money) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
try {
await this.$validator({
name: [required(required.message("支付宝用户名"))],
alipay_code: [required(required.message("支付宝账号"))],
money: [required(required.message("提现金额"))]
}).validate({ name, alipay_code, money });
let save = {
extractType: that.post.extract_type,
alipayCode: alipay_code,
name: name,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
case "weixin":
try {
await this.$validator({
weixin: [required(required.message("提现微信号"))],
money: [required(required.message("提现金额"))]
}).validate({ weixin, money });
let save = {
extractType: that.post.extract_type,
weixin: weixin,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
}
}, },
save: function(info) { methods: {
postCashInfo(info).then( swichNav: function (index, item) {
res => { console.log(item);
this.currentTab = index;
this.post.extract_type = item.type;
},
getBank: function () {
let that = this;
getBank().then(
res => {
that.banks = res.data.extractBank;
that.minPrice = res.data.minPrice;
that.commissionCount = res.data.commissionCount;
},
function (err) {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
},
async submitted() {
let bankname = this.post.bankname,
alipay_code = this.post.alipay_code,
money = this.post.money,
name = this.post.name,
cardnum = this.post.cardnum,
weixin = this.post.weixin,
that = this;
// console.log(parseFloat(money))
if (
parseFloat(money) > parseFloat(that.commissionCount) ||
parseFloat(that.commissionCount) == 0
) {
uni.showToast({ uni.showToast({
title: res.msg, title: "余额不足",
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
this.router.push({ path: "/user/audit" }); return
}, }
err => { if (parseFloat(money) < parseFloat(that.minPrice)) {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message, title: "最低提现金额" + that.minPrice,
icon: "none", icon: "none",
duration: 2000 duration: 2000
}); });
return
} }
); //console.log(that.post.extract_type)
switch (that.post.extract_type) {
case "alipay":
// if (!name) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!alipay_code) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
// if (!money) {
// uni.showToast({
// title: "",
// icon: "none",
// duration: 2000
// });
// return;
// }
try {
await this.$validator({
name: [required(required.message("支付宝用户名"))],
alipay_code: [required(required.message("支付宝账号"))],
money: [required(required.message("提现金额"))]
}).validate({
name,
alipay_code,
money
});
let save = {
extractType: that.post.extract_type,
alipayCode: alipay_code,
name: name,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
case "weixin":
try {
await this.$validator({
weixin: [required(required.message("提现微信号"))],
money: [required(required.message("提现金额"))]
}).validate({
weixin,
money
});
let save = {
extractType: that.post.extract_type,
weixin: weixin,
money: money
};
that.save(save);
} catch (e) {
return validatorDefaultCatch(e);
}
break;
}
},
save: function (info) {
postCashInfo(info).then(
res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
this.$yrouter.push({
path: "/pages/user/promotion/CashAudit/index"
});
},
err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}
);
}
} }
} };
};
</script> </script>
<style lang="less">
.cash-withdrawal .pos-order-list .nav .item.on {
color: #eb3729
}
</style>

1
pages/user/promotion/UserPromotion/index.vue

@ -20,7 +20,6 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="bnt bg-color-red" @click="toCash">立即提现</view> -->
<view class="list acea-row row-between-wrapper"> <view class="list acea-row row-between-wrapper">
<view class="item acea-row row-center-wrapper row-column" @click="goPoster()"> <view class="item acea-row row-center-wrapper row-column" @click="goPoster()">
<text class="iconfont icon-erweima"></text> <text class="iconfont icon-erweima"></text>

BIN
static/images/logo_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
static/images/title1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

12
store/index.js

@ -100,7 +100,11 @@ const vuexStore = new Vuex.Store({
reslove(res.data); reslove(res.data);
}); });
}).catch(() => { }).catch(() => {
dialog.error("获取信息失败!"); uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
}); });
} }
}, },
@ -113,7 +117,11 @@ const vuexStore = new Vuex.Store({
}); });
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
dialog.error("获取信息失败!"); uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
}); });
}, },
changeLogin({ changeLogin({

510
uni.css

@ -0,0 +1,510 @@
@charset "UTF-8";
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/* ==================
自定义变量
==================== */
/*盒子模型*/
.mt2 {
margin-top: 2rpx;
}
.mr2 {
margin-right: 2rpx;
}
.mb2 {
margin-bottom: 2rpx;
}
.ml2 {
margin-left: 2rpx;
}
.mx2 {
margin-left: 2rpx;
margin-right: 2rpx;
}
.my2 {
margin-top: 2rpx;
margin-bottom: 2rpx;
}
.ma2 {
margin: 2rpx;
}
.mt4 {
margin-top: 4rpx;
}
.mr4 {
margin-right: 4rpx;
}
.mb4 {
margin-bottom: 4rpx;
}
.ml4 {
margin-left: 4rpx;
}
.mx4 {
margin-left: 4rpx;
margin-right: 4rpx;
}
.my4 {
margin-top: 4rpx;
margin-bottom: 4rpx;
}
.ma4 {
margin: 4rpx;
}
.mt8 {
margin-top: 8rpx;
}
.mr8 {
margin-right: 8rpx;
}
.mb8 {
margin-bottom: 8rpx;
}
.ml8 {
margin-left: 8rpx;
}
.mx8 {
margin-left: 8rpx;
margin-right: 8rpx;
}
.my8 {
margin-top: 8rpx;
margin-bottom: 8rpx;
}
.ma8 {
margin: 8rpx;
}
.mt10 {
margin-top: 10rpx;
}
.mr10 {
margin-right: 10rpx;
}
.mb10 {
margin-bottom: 10rpx;
}
.ml10 {
margin-left: 10rpx;
}
.mx10 {
margin-left: 10rpx;
margin-right: 10rpx;
}
.my10 {
margin-top: 10rpx;
margin-bottom: 10rpx;
}
.ma10 {
margin: 10rpx;
}
.mt15 {
margin-top: 15rpx;
}
.mr15 {
margin-right: 15rpx;
}
.mb15 {
margin-bottom: 15rpx;
}
.ml15 {
margin-left: 15rpx;
}
.mx15 {
margin-left: 15rpx;
margin-right: 15rpx;
}
.my15 {
margin-top: 15rpx;
margin-bottom: 15rpx;
}
.ma15 {
margin: 15rpx;
}
.mt20 {
margin-top: 20rpx;
}
.mr20 {
margin-right: 20rpx;
}
.mb20 {
margin-bottom: 20rpx;
}
.ml20 {
margin-left: 20rpx;
}
.mx20 {
margin-left: 20rpx;
margin-right: 20rpx;
}
.my20 {
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.ma20 {
margin: 20rpx;
}
.mt24 {
margin-top: 24rpx;
}
.mr24 {
margin-right: 24rpx;
}
.mb24 {
margin-bottom: 24rpx;
}
.ml24 {
margin-left: 24rpx;
}
.mx24 {
margin-left: 24rpx;
margin-right: 24rpx;
}
.my24 {
margin-top: 24rpx;
margin-bottom: 24rpx;
}
.ma24 {
margin: 24rpx;
}
.mt30 {
margin-top: 30rpx;
}
.mr30 {
margin-right: 30rpx;
}
.mb30 {
margin-bottom: 30rpx;
}
.ml30 {
margin-left: 30rpx;
}
.mx30 {
margin-left: 30rpx;
margin-right: 30rpx;
}
.my30 {
margin-top: 30rpx;
margin-bottom: 30rpx;
}
.ma30 {
margin: 30rpx;
}
.pt2 {
padding-top: 2rpx;
}
.pr2 {
padding-right: 2rpx;
}
.pb2 {
padding-bottom: 2rpx;
}
.pl2 {
padding-left: 2rpx;
}
.px2 {
padding-left: 2rpx;
padding-right: 2rpx;
}
.py2 {
padding-top: 2rpx;
padding-bottom: 2rpx;
}
.pa2 {
padding: 2rpx;
}
.pt4 {
padding-top: 4rpx;
}
.pr4 {
padding-right: 4rpx;
}
.pb4 {
padding-bottom: 4rpx;
}
.pl4 {
padding-left: 4rpx;
}
.px4 {
padding-left: 4rpx;
padding-right: 4rpx;
}
.py4 {
padding-top: 4rpx;
padding-bottom: 4rpx;
}
.pa4 {
padding: 4rpx;
}
.pt8 {
padding-top: 8rpx;
}
.pr8 {
padding-right: 8rpx;
}
.pb8 {
padding-bottom: 8rpx;
}
.pl8 {
padding-left: 8rpx;
}
.px8 {
padding-left: 8rpx;
padding-right: 8rpx;
}
.py8 {
padding-top: 8rpx;
padding-bottom: 8rpx;
}
.pa8 {
padding: 8rpx;
}
.pt10 {
padding-top: 10rpx;
}
.pr10 {
padding-right: 10rpx;
}
.pb10 {
padding-bottom: 10rpx;
}
.pl10 {
padding-left: 10rpx;
}
.px10 {
padding-left: 10rpx;
padding-right: 10rpx;
}
.py10 {
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.pa10 {
padding: 10rpx;
}
.pt15 {
padding-top: 15rpx;
}
.pr15 {
padding-right: 15rpx;
}
.pb15 {
padding-bottom: 15rpx;
}
.pl15 {
padding-left: 15rpx;
}
.px15 {
padding-left: 15rpx;
padding-right: 15rpx;
}
.py15 {
padding-top: 15rpx;
padding-bottom: 15rpx;
}
.pa15 {
padding: 15rpx;
}
.pt20 {
padding-top: 20rpx;
}
.pr20 {
padding-right: 20rpx;
}
.pb20 {
padding-bottom: 20rpx;
}
.pl20 {
padding-left: 20rpx;
}
.px20 {
padding-left: 20rpx;
padding-right: 20rpx;
}
.py20 {
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.pa20 {
padding: 20rpx;
}
.pt24 {
padding-top: 24rpx;
}
.pr24 {
padding-right: 24rpx;
}
.pb24 {
padding-bottom: 24rpx;
}
.pl24 {
padding-left: 24rpx;
}
.px24 {
padding-left: 24rpx;
padding-right: 24rpx;
}
.py24 {
padding-top: 24rpx;
padding-bottom: 24rpx;
}
.pa24 {
padding: 24rpx;
}
.pt30 {
padding-top: 30rpx;
}
.pr30 {
padding-right: 30rpx;
}
.pb30 {
padding-bottom: 30rpx;
}
.pl30 {
padding-left: 30rpx;
}
.px30 {
padding-left: 30rpx;
padding-right: 30rpx;
}
.py30 {
padding-top: 30rpx;
padding-bottom: 30rpx;
}
.pa30 {
padding: 30rpx;
}
/*# sourceMappingURL=uni.css.map */

9
uni.css.map

File diff suppressed because one or more lines are too long

1
uni.min.css vendored

@ -0,0 +1 @@
.mt2{margin-top:2rpx}.mr2{margin-right:2rpx}.mb2{margin-bottom:2rpx}.ml2{margin-left:2rpx}.mx2{margin-left:2rpx;margin-right:2rpx}.my2{margin-top:2rpx;margin-bottom:2rpx}.ma2{margin:2rpx}.mt4{margin-top:4rpx}.mr4{margin-right:4rpx}.mb4{margin-bottom:4rpx}.ml4{margin-left:4rpx}.mx4{margin-left:4rpx;margin-right:4rpx}.my4{margin-top:4rpx;margin-bottom:4rpx}.ma4{margin:4rpx}.mt8{margin-top:8rpx}.mr8{margin-right:8rpx}.mb8{margin-bottom:8rpx}.ml8{margin-left:8rpx}.mx8{margin-left:8rpx;margin-right:8rpx}.my8{margin-top:8rpx;margin-bottom:8rpx}.ma8{margin:8rpx}.mt10{margin-top:10rpx}.mr10{margin-right:10rpx}.mb10{margin-bottom:10rpx}.ml10{margin-left:10rpx}.mx10{margin-left:10rpx;margin-right:10rpx}.my10{margin-top:10rpx;margin-bottom:10rpx}.ma10{margin:10rpx}.mt15{margin-top:15rpx}.mr15{margin-right:15rpx}.mb15{margin-bottom:15rpx}.ml15{margin-left:15rpx}.mx15{margin-left:15rpx;margin-right:15rpx}.my15{margin-top:15rpx;margin-bottom:15rpx}.ma15{margin:15rpx}.mt20{margin-top:20rpx}.mr20{margin-right:20rpx}.mb20{margin-bottom:20rpx}.ml20{margin-left:20rpx}.mx20{margin-left:20rpx;margin-right:20rpx}.my20{margin-top:20rpx;margin-bottom:20rpx}.ma20{margin:20rpx}.mt24{margin-top:24rpx}.mr24{margin-right:24rpx}.mb24{margin-bottom:24rpx}.ml24{margin-left:24rpx}.mx24{margin-left:24rpx;margin-right:24rpx}.my24{margin-top:24rpx;margin-bottom:24rpx}.ma24{margin:24rpx}.mt30{margin-top:30rpx}.mr30{margin-right:30rpx}.mb30{margin-bottom:30rpx}.ml30{margin-left:30rpx}.mx30{margin-left:30rpx;margin-right:30rpx}.my30{margin-top:30rpx;margin-bottom:30rpx}.ma30{margin:30rpx}.pt2{padding-top:2rpx}.pr2{padding-right:2rpx}.pb2{padding-bottom:2rpx}.pl2{padding-left:2rpx}.px2{padding-left:2rpx;padding-right:2rpx}.py2{padding-top:2rpx;padding-bottom:2rpx}.pa2{padding:2rpx}.pt4{padding-top:4rpx}.pr4{padding-right:4rpx}.pb4{padding-bottom:4rpx}.pl4{padding-left:4rpx}.px4{padding-left:4rpx;padding-right:4rpx}.py4{padding-top:4rpx;padding-bottom:4rpx}.pa4{padding:4rpx}.pt8{padding-top:8rpx}.pr8{padding-right:8rpx}.pb8{padding-bottom:8rpx}.pl8{padding-left:8rpx}.px8{padding-left:8rpx;padding-right:8rpx}.py8{padding-top:8rpx;padding-bottom:8rpx}.pa8{padding:8rpx}.pt10{padding-top:10rpx}.pr10{padding-right:10rpx}.pb10{padding-bottom:10rpx}.pl10{padding-left:10rpx}.px10{padding-left:10rpx;padding-right:10rpx}.py10{padding-top:10rpx;padding-bottom:10rpx}.pa10{padding:10rpx}.pt15{padding-top:15rpx}.pr15{padding-right:15rpx}.pb15{padding-bottom:15rpx}.pl15{padding-left:15rpx}.px15{padding-left:15rpx;padding-right:15rpx}.py15{padding-top:15rpx;padding-bottom:15rpx}.pa15{padding:15rpx}.pt20{padding-top:20rpx}.pr20{padding-right:20rpx}.pb20{padding-bottom:20rpx}.pl20{padding-left:20rpx}.px20{padding-left:20rpx;padding-right:20rpx}.py20{padding-top:20rpx;padding-bottom:20rpx}.pa20{padding:20rpx}.pt24{padding-top:24rpx}.pr24{padding-right:24rpx}.pb24{padding-bottom:24rpx}.pl24{padding-left:24rpx}.px24{padding-left:24rpx;padding-right:24rpx}.py24{padding-top:24rpx;padding-bottom:24rpx}.pa24{padding:24rpx}.pt30{padding-top:30rpx}.pr30{padding-right:30rpx}.pb30{padding-bottom:30rpx}.pl30{padding-left:30rpx}.px30{padding-left:30rpx;padding-right:30rpx}.py30{padding-top:30rpx;padding-bottom:30rpx}.pa30{padding:30rpx}

56
uni.scss

@ -73,4 +73,58 @@ $uni-font-size-title:40upx;
$uni-color-subtitle: #555555; // 二级标题颜色 $uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36upx; $uni-font-size-subtitle:36upx;
$uni-color-paragraph: #3F536E; // 文章段落颜色 $uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30upx; $uni-font-size-paragraph:30upx;
/* ==================
自定义变量
==================== */
$spaceTypes: (
m: margin,
p: padding
);
$spaceDirections: (
t: top,
r: right,
b: bottom,
l: left
);
$spaceSizes: (
2: 2rpx,
4: 4rpx,
8: 8rpx,
10: 10rpx,
15: 15rpx,
20: 20rpx,
24: 24rpx,
30: 30rpx
);
/*盒子模型*/
@each $typeKey, $type in $spaceTypes {
@each $sizeKey, $size in $spaceSizes {
// margin-top:10rpx
@each $directionKey, $direction in $spaceDirections {
.#{$typeKey}#{$directionKey}#{$sizeKey} {
#{$type}-#{$direction}: $size;
}
}
// margin: 10rpx 0;
.#{$typeKey}x#{$sizeKey} {
#{$type}-left: $size;
#{$type}-right: $size;
}
.#{$typeKey}y#{$sizeKey} {
#{$type}-top: $size;
#{$type}-bottom: $size;
}
// margin: 10rpx ;
.#{$typeKey}a#{$sizeKey} {
#{$type}: $size;
}
}
}

155
utils/index.js

@ -38,7 +38,27 @@ export function dataFormat(time, option) {
return timeStr return timeStr
} }
} }
// 年月日,时分秒
// "YYYY-mm-dd HH:MM"
export function dateFormatL(fmt, date) {
let ret;
const opt = {
"Y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}
export function dateFormatT(time) { export function dateFormatT(time) {
time = +time * 1000; time = +time * 1000;
const d = new Date(time); const d = new Date(time);
@ -62,7 +82,10 @@ export function isType(arg, type) {
} }
export function isWeixin() { export function isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1; if(navigator&&navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1){
return true
}
return false
} }
export function parseQuery() { export function parseQuery() {
@ -182,13 +205,11 @@ export const login = () => {
// } else { // } else {
// // wechat().then(() => oAuth().then((code) => { // // wechat().then(() => oAuth().then((code) => {
// // // const { code } = parseQuery() // // // const { code } = parseQuery()
// // debugger
// // auth(code) // // auth(code)
// // .then(() => { // // .then(() => {
// // // location.replace( // // // location.replace(
// // // decodeURIComponent(decodeURIComponent(this.$route.params.url)) // // // decodeURIComponent(decodeURIComponent(this.$route.params.url))
// // // ); // // // );
// // debugger
// // location.href = decodeURIComponent( // // location.href = decodeURIComponent(
// // decodeURIComponent(this.$route.params.url) // // decodeURIComponent(this.$route.params.url)
// // ); // // );
@ -250,6 +271,7 @@ export const login = () => {
store.dispatch('userInfo', true) store.dispatch('userInfo', true)
getUserInfo().then(user => { getUserInfo().then(user => {
console.log('获取用户信息成功') console.log('获取用户信息成功')
uni.setStorageSync('uid', user.data.uid);
store.dispatch('setUserInfo', user.data) store.dispatch('setUserInfo', user.data)
resolve(user) resolve(user)
}).catch(error => { }).catch(error => {
@ -659,13 +681,14 @@ export function handleQrCode() {
export function handleUrlParam(path) { export function handleUrlParam(path) {
console.log(path) console.log(path)
var url = path.split("?")[1]; //获取url中"?"符后的字串
console.log(url)
var theRequest = new Object(); var theRequest = new Object();
let strs = url.split("&"); if(path.includes("?")){
for (var i = 0; i < strs.length; i++) { var url = path.split("?")[1]; //获取url中"?"符后的字串
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); console.log(url)
let strs = url.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
} }
return theRequest; return theRequest;
} }
@ -700,8 +723,8 @@ const getImageInfo = (images) => {
* @param string store_name 素材文字 * @param string store_name 素材文字
* @param string price 价格 * @param string price 价格
* @param function successFn 回调函数 * @param function successFn 回调函数
* *
* *
*/ */
export const PosterCanvas = (store, successCallBack) => { export const PosterCanvas = (store, successCallBack) => {
uni.showLoading({ uni.showLoading({
@ -796,16 +819,115 @@ export const handleLoginFailure = () => {
console.log(store.getters) console.log(store.getters)
console.log('————————') console.log('————————')
store.commit("updateAuthorizationPage", true); store.commit("updateAuthorizationPage", true);
let path = '/' + getCurrentPageUrlWithArgs() let path = '/' + getCurrentPageUrlWithArgs()
console.log("getCurrentPageUrl",getCurrentPageUrl());
//判断小程序转发分享商品详情进来的
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleUrlParam(path) ) {
debugger;
console.log('————————')
console.log('判断小程序转发分享商品详情进来的')
console.log(' handleUrlParam()', handleUrlParam(path))
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的商品详情进来的,但是没有获取到参数')
console.log('————————')
}
}
// 是分享转发拼团进来的
if (getCurrentPageUrl() == 'pages/activity/GroupDetails/index' && handleUrlParam(path)) {
console.log('————————')
console.log('是分享转发拼团进来的')
console.log('————————')
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 是分享转发秒杀进来的
if (getCurrentPageUrl() == 'pages/activity/SeckillDetails/index' && handleUrlParam(path)) {
console.log('————————')
console.log('是分享转发秒杀进来的')
console.log('————————')
let url = handleUrlParam(path);
console.log(url)
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.id,
}
})
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是秒杀进来的,但是没有获取到参数')
console.log('————————')
handleNoParameters()
}
}
// 判断是不是转发分享的砍价海报进来的
if (getCurrentPageUrl() == 'pages/activity/DargainDetails/index' && handleUrlParam(path)) {
console.log('————————')
console.log('判断是不是转发分享的砍价海报进来的')
console.log('————————')
let url = handleUrlParam(path);
if (url) {
path = parseUrl({
path: `/${getCurrentPageUrl()}`,
query: {
id: url.bargainId,
partake: url.uid
}
})
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
console.log('是扫描的砍价海报进来的,但是没有获取到参数')
console.log('————————')
}
}
// 判断是不是拼团进来的 // 判断是不是拼团进来的
if (getCurrentPageUrl() == 'pages/activity/GroupRule/index' && handleQrCode()) { if (getCurrentPageUrl() == 'pages/activity/GroupRule/index' ) {
console.log('————————') console.log('————————')
console.log('是拼团进来的') console.log('是拼团进来的')
console.log('————————') console.log('————————')
let url = handleQrCode(); let url = handleQrCode();
if(!url){
url = handleUrlParam(path);
}
console.log(url) console.log(url)
if (url) { if (url) {
path = parseUrl({ path = parseUrl({
@ -814,7 +936,7 @@ export const handleLoginFailure = () => {
id: url.pinkId, id: url.pinkId,
} }
}) })
// cookie.set("spread", url.spread || 0); cookie.set("spread", url.spread || 0);
} else { } else {
console.log('————————') console.log('————————')
console.log('是拼团进来的,但是没有获取到参数') console.log('是拼团进来的,但是没有获取到参数')
@ -837,7 +959,7 @@ export const handleLoginFailure = () => {
partake: url.uid partake: url.uid
} }
}) })
// cookie.set("spread", url.spread || 0); cookie.set("spread", url.spread || 0);
} else { } else {
handleNoParameters() handleNoParameters()
console.log('————————') console.log('————————')
@ -849,6 +971,7 @@ export const handleLoginFailure = () => {
} }
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleQrCode()) { if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleQrCode()) {
debugger;
console.log('————————') console.log('————————')
console.log('是扫描的商品详情') console.log('是扫描的商品详情')
console.log('————————') console.log('————————')

8
utils/request.js

@ -1,7 +1,13 @@
// #ifndef MP-WEIXIN // #ifdef H5
// h5端
import Fly from "flyio/dist/npm/fly"; import Fly from "flyio/dist/npm/fly";
// #endif // #endif
// #ifdef APP-PLUS
// app端
import Fly from "flyio/dist/npm/wx";
// #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
import Fly from "flyio/dist/npm/wx"; import Fly from "flyio/dist/npm/wx";
// #endif // #endif

Loading…
Cancel
Save