Browse Source

yshop3.1正式发布

zyh
xuwenbo 4 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>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
import Vue from 'vue'
export default {
onLaunch: function() {
// debugger
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
//
console.log(res.hasUpdate)
})
//
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>
<style lang="less">
/*每个页面公共css */
@import "animate.css";
@import "./assets/iconfont/iconfont.css";
@import "./assets/css/base.less";
@import "./assets/css/reset.less";
@import "./assets/css/style.less";
</style>
/*每个页面公共css */
@import "animate.css";
@import "./assets/iconfont/iconfont.css";
@import "./assets/css/base.less";
@import "./assets/css/reset.less";
@import "./assets/css/style.less";
</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) {
return request.get("/product/poster/" + id, {}, {
export function getProductPoster(id, data) {
return request.get("/product/poster/" + id, data, {
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", {
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 */

4
assets/css/base.less

@ -104,7 +104,7 @@
.start {
width: 1.22*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-size: 1.22*100rpx auto;
}
@ -147,7 +147,7 @@
.checkbox-wrapper input:checked + .icon {
background-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-repeat: no-repeat;
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 */

2
assets/css/reset.less

@ -1,7 +1,7 @@
input{line-height: normal; box-sizing:border-box;}
@font-face {
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] {
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>
<view
class="Loads acea-row row-center-wrapper"
v-if="loading || !loaded"
style="margin-top: 20rpx;"
>
<view class="Loads acea-row row-center-wrapper" v-if="loading || !loaded" style="margin-top: 20rpx;">
<template v-if="loading">
<view
class="iconfont icon-jiazai loading acea-row row-center-wrapper"
></view>
<view class="iconfont icon-jiazai loading acea-row row-center-wrapper"></view>
正在加载中
</template>
<template v-else>
<template v-if="!loading">
上拉加载更多
</template>
</view>
</template>
<script>
export default {
name: "Loading",
props: {
loaded: Boolean,
loading: Boolean
}
};
export default {
name: "Loading",
props: {
loaded: Boolean,
loading: Boolean
}
};
</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>
<view class="promotionGood" v-if="benefit.length > 0">
<view class="item acea-row row-between-wrapper" v-for="(item, promotionGoodIndex) in benefit" :key="promotionGoodIndex" @click="routerGo(item)">
<view class="pictrue"><image :src="item.image" class="image" /></view>
<view class="text">
<view class="name line1">{{ item.storeName }}</view>
<view class="sp-money acea-row">
<view class="moneyCon">
促销价:
<text class="num">{{ item.price }}</text>
<view>
<view class="sh-title-card mb10">
<view class="title-box">
<image class="title-bg" src="@/static/images/title1.png" mode="aspectFill"></image>
<view class="title-text">为你推荐</view>
<!-- <view class="title-text" :style="{ color: detail.color }">为你推荐</view> -->
</view>
</view>
<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 class="acea-row row-between-wrapper">
<view class="money">日常价{{ item.otPrice }}</view>
<view>仅剩{{ item.stock }}{{ item.unitName }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'PromotionGood',
props: ['benefit'],
data: function() {
return {};
},
methods: {
routerGo(item) {
this.$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: item.id } });
export default {
name: 'PromotionGood',
props: ['benefit'],
data: function () {
return {};
},
methods: {
routerGo(item) {
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>-->
<view class="poster-pop" v-show="canvasStatus">
<img
src="@/static/images/poster-close.png"
class="close"
@click="posterImageClose"
mode="widthFix"
/>
<image
:src="posterImage"
alt="tp"
class="poster-image"
show-menu-by-longpress
mode="widthFix"
/>
<img src="@/static/images/poster-close.png" 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>
<view class="mask"></view>
@ -49,163 +38,187 @@
</template>
<script>
// import html2canvas from "html2canvas";
import { PosterCanvas } from "@/utils";
import { getProductPoster } from "@/api/store";
export default {
name: "StorePoster",
props: {
posterImageStatus: Boolean,
posterData: Object,
goodId: String
},
data: function() {
return {
canvasStatus: false,
posterImage: ""
};
},
watch: {
posterImageStatus: function() {
var that = this;
if (that.posterImageStatus === true) {
that.$nextTick(function() {
that.savePosterPath();
});
// import html2canvas from "html2canvas";
import {
PosterCanvas
} from "@/utils";
import {
getProductPoster
} from "@/api/store";
export default {
name: "StorePoster",
props: {
posterImageStatus: Boolean,
posterData: Object,
goodId: String
},
data: function () {
return {
canvasStatus: false,
posterImage: ""
};
},
watch: {
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() {
const that = this;
uni.showLoading({ title: "海报生成中", mask: true });
getProductPoster(this.goodId)
.then(res => {
this.canvasStatus = true;
this.posterImage = res.data;
})
.finally(() => {
uni.hideLoading();
mounted: function () {},
methods: {
posterImageClose: function () {
this.posterImageStatus = false;
this.canvasStatus = false;
this.$emit("setPosterImageStatus");
},
savePosterPath: function () {
const that = this;
uni.showLoading({
title: "海报生成中",
mask: true
});
// return;
// //
// that.posterImage = "";
// uni.showLoading({ title: "", mask: true });
// console.log(this);
// var prodId = that.$yrouter.currentRoute.query.id;
// uni.downloadFile({
// url:
// 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();
// }
// });
getProductPoster(this.goodId, {
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
})
.then(res => {
this.canvasStatus = true;
this.posterImage = res.data;
})
.finally(() => {
uni.hideLoading();
});
// return;
// //
// that.posterImage = "";
// uni.showLoading({ title: "", mask: true });
// console.log(this);
// var prodId = that.$yrouter.currentRoute.query.id;
// uni.downloadFile({
// url:
// 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>
<style scoped lang="less" lang="less">
.poster-first {
overscroll-behavior: contain;
}
.poster-pop {
width: 4.5 * 100rpx;
height: 8 * 100rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
z-index: 99;
top: 50%;
margin-top: -4.6 * 100rpx;
}
.poster-pop .canvas {
background-color: #ffffff;
height: 8 * 100rpx;
}
.poster-pop .poster-image {
width: 100%;
height: auto;
}
.poster-pop .canvas .image {
width: 4.5 * 100rpx;
height: 4.5 * 100rpx;
display: block;
}
.poster-pop .canvas .text {
text-align: center;
color: #000000;
margin-top: 0.32 * 100rpx;
}
.poster-pop .canvas .text.black {
height: 0.68 * 100rpx;
}
.poster-pop .canvas .text.rad {
color: #ff0000;
}
.poster-pop .canvas .code {
height: 1.4 * 100rpx;
display: flex;
}
.poster-pop .canvas .code .code-img {
width: 33%;
padding: 0.06 * 100rpx;
}
.poster-pop .canvas .code .code-img image {
width: 100%;
}
.poster-pop .canvas .code .code-text {
width: 60%;
font-size: 0.12 * 100rpx;
line-height: 1.64 * 100rpx;
}
.poster-pop .close {
width: 0.46 * 100rpx;
height: 0.75 * 100rpx;
position: fixed;
right: 0;
top: -0.73 * 100rpx;
display: block;
}
.poster-pop .save-poster {
background-color: #df2d0a;
font-size: 0.22 * 100rpx;
color: #fff;
text-align: center;
height: 0.76 * 100rpx;
line-height: 0.76 * 100rpx;
width: 100%;
margin-top: -0.04 * 100rpx;
}
.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;
}
.poster-first {
overscroll-behavior: contain;
}
.poster-pop {
width: 4.5 * 100rpx;
height: 8 * 100rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
z-index: 99;
top: 50%;
margin-top: -4.6 * 100rpx;
}
.poster-pop .canvas {
background-color: #ffffff;
height: 8 * 100rpx;
}
.poster-pop .poster-image {
width: 100%;
height: auto;
}
.poster-pop .canvas .image {
width: 4.5 * 100rpx;
height: 4.5 * 100rpx;
display: block;
}
.poster-pop .canvas .text {
text-align: center;
color: #000000;
margin-top: 0.32 * 100rpx;
}
.poster-pop .canvas .text.black {
height: 0.68 * 100rpx;
}
.poster-pop .canvas .text.rad {
color: #ff0000;
}
.poster-pop .canvas .code {
height: 1.4 * 100rpx;
display: flex;
}
.poster-pop .canvas .code .code-img {
width: 33%;
padding: 0.06 * 100rpx;
}
.poster-pop .canvas .code .code-img image {
width: 100%;
}
.poster-pop .canvas .code .code-text {
width: 60%;
font-size: 0.12 * 100rpx;
line-height: 1.64 * 100rpx;
}
.poster-pop .close {
width: 0.46 * 100rpx;
height: 0.75 * 100rpx;
position: fixed;
right: 0;
top: -0.73 * 100rpx;
display: block;
}
.poster-pop .save-poster {
background-color: #df2d0a;
font-size: 0.22 * 100rpx;
color: #fff;
text-align: center;
height: 0.76 * 100rpx;
line-height: 0.76 * 100rpx;
width: 100%;
margin-top: -0.04 * 100rpx;
}
.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>

78
components/UserEvaluation.vue

@ -1,50 +1,52 @@
<template>
<view class="evaluateWtapper">
<view
class="evaluateItem"
v-for="(item, evaluateWtapperIndex) in reply"
:key="evaluateWtapperIndex"
>
<view class="pic-text acea-row row-middle">
<view class="pictrue">
<image :src="item.avatar" class="image" />
<view class="evaluateWtapper" v-if="reply&&reply.length>0">
<view v-for="(item, evaluateWtapperIndex) in reply" :key="evaluateWtapperIndex">
<view class="evaluateItem" v-if="item">
<view class="pic-text acea-row row-middle">
<view class="pictrue">
<image :src="item.avatar" class="image" />
</view>
<view class="acea-row row-middle">
<view class="name line1">{{ item.nickname }}</view>
<view class="start" :class="'star' + item.star"></view>
</view>
</view>
<view class="acea-row row-middle">
<view class="name line1">{{ item.nickname }}</view>
<view class="start" :class="'star' + item.star"></view>
<view class="time">{{ item.createTime }} {{ item.sku||'' }}</view>
<view class="evaluate-infor">{{ item.comment }}</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 class="time">{{ item.createTime }} {{ item.sku||'' }}</view>
<view class="evaluate-infor">{{ item.comment }}</view>
<view class="imgList acea-row">
<view class="pictrue" v-for="(itemn, eq) in item.picturesArr" :key="eq">
<image :src="itemn" class="image" />
<view class="reply" v-if="item.merchantReplyContent">
<span class="font-color-red">yshop店员</span>
{{item.merchantReplyContent}}
</view>
</view>
<view class="reply" v-if="item.merchantReplyContent">
<span class="font-color-red">yshop店员</span>
{{item.merchantReplyContent}}
</view>
</view>
</view>
</template>
<script>
import { dataFormat } from "@/utils";
import {
dataFormat
} from "@/utils";
export default {
name: "UserEvaluation",
props: {
reply: {
type: Array,
default: () => []
export default {
name: "UserEvaluation",
props: {
reply: {
type: Array,
default: () => []
}
},
data: function () {
return {};
},
mounted: function () {
console.log(this)
},
methods: {
dataFormat
}
},
data: function() {
return {};
},
mounted: function() {},
methods: {
dataFormat
}
};
};
</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://h5api.dayouqiantu.cn/api';
export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static';
// 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_RESOURCES_URL = 'https://wx.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) => {
// dialog.loading.open("");
uni.showLoading({
title: "支付中",
mask: true
});
payOrder(orderId, type, from)
.then(res => {
handleOrderPayResults(res.data)
.then(async res => {
await handleOrderPayResults(res.data, type)
resolve()
})
.catch(err => {
dialog.loading.close();
dialog.toast({ mes: err.msg || "订单支付失败" });
reject()
uni.hideLoading()
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message || '订单支付失败',
icon: "none",
duration: 2000,
});
});
});
}
// 处理调用支付接口的逻辑
// @type create(创建订单)||pay(支付订单)
export function handleOrderPayResults(data, type) {
switch (data.status) {
// 订单号已存在
case "ORDER_EXIST":
// 取消支付
case "EXTEND_ORDER":
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000,
});
goOrderDetails(data.result.orderId, type)
break;
case "PAY_DEFICIENCY":
break;
// 支付出错
case "PAY_ERROR":
uni.showToast({
title: res.msg,
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(() => {
export function handleOrderPayResults(data, type, payType) {
console.log(data, type, payType)
console.log(data, type)
return new Promise((resolve, reject) => {
uni.hideLoading()
switch (data.status) {
// 订单号已存在
case "ORDER_EXIST":
resolve()
break;
// 取消支付
case "EXTEND_ORDER":
uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
resolve()
goOrderDetails(data.result.orderId, type)
});
break;
// APP支付
case "WECHAT_APP_PAY":
weappPay(data.result.jsConfig).finally(() => {
break;
case "PAY_DEFICIENCY":
break;
// 支付出错
case "PAY_ERROR":
uni.showToast({
title: data.msg,
icon: "none",
duration: 2000,
});
reject()
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 WechatJSSDK from "wechat-jssdk/dist/client.umd";
import { getWechatConfig, wechatAuth } from "@/api/public";
@ -9,7 +10,6 @@ import dayjs from "dayjs";
// 支付模块
export const weappPay = (option) => {
return new Promise((resolve, reject) => {
console.log(option)
if (store.state.$deviceType == 'weixinh5') {
setTimeout(() => {
location.href = option.mweb_url;
@ -59,11 +59,16 @@ export const weappPay = (option) => {
clearTimeout(time)
resolve(success)
}, 3000)
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
},
fail: (error) => {
console.log(error)
if (error.errMsg == 'requestPayment:fail cancel') {
uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 });
} else {
uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 });
}
reject(error)
}
@ -119,6 +124,7 @@ export function clearAuthStatus() {
export function oAuth() {
console.log('处理微信授权')
console.log('处理微信授权cookie',cookie.get("spread"))
console.log(store)
console.log(store.state)
return new Promise((resolve, reject) => {
@ -142,8 +148,7 @@ export function auth(code) {
console.log('获取微信授权')
return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE);
debugger
wechatAuth(code, parseInt(cookie.get("spread")), loginType)
wechatAuth(code, cookie.get("spread"), loginType)
.then(({ data }) => {
console.log(data)
const expires_time = dayjs(data.expires_time);
@ -152,12 +157,10 @@ export function auth(code) {
cookie.set(WX_AUTH, code, expires_time);
cookie.remove(STATE_KEY);
loginType && cookie.remove(LOGINTYPE);
debugger
resolve();
})
.catch(reject);
}).catch(error => {
debugger
console.log(error)
})
}
@ -347,12 +350,20 @@ export function wxShowLocation() {
cancel() {
cookie.remove(LATITUDE);
cookie.remove(LONGITUDE);
this.$dialog.error("取消获取位置");
uni.showToast({
title: "取消获取位置",
icon: "none",
duration: 2000,
});
},
fail() {
cookie.remove(LATITUDE);
cookie.remove(LONGITUDE);
this.$dialog.error("授权失败");
uni.showToast({
title: "授权失败",
icon: "none",
duration: 2000,
});
}
});
}

2
main.js

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

11
manifest.json

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

34
package-lock.json generated

@ -17,6 +17,21 @@
"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": {
"version": "3.7.2",
"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",
"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": {
"version": "3.4.1",
"resolved": "https://registry.npm.taobao.org/mongodb/download/mongodb-3.4.1.tgz",
@ -296,6 +319,11 @@
"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": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/regexp-clone/download/regexp-clone-1.0.0.tgz",
@ -379,6 +407,12 @@
"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": {
"version": "1.2.6",
"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",
"dayjs": "^1.8.22",
"jweixin-module": "^1.6.0",
"miniapp-color-thief": "^1.0.5",
"vue-ydui": "^1.2.6",
"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",
"style": {
"navigationBarTitleText": "yshop商城"
"navigationBarTitleText": "yshop商城",
"navigationBarTextStyle": "white",
// "enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
{
@ -90,6 +93,12 @@
"navigationBarTitleText": "商品收藏"
}
},
{
"path": "pages/shop/GoodsFoot/index",
"style": {
"navigationBarTitleText": "我的足迹"
}
},
{
"path": "pages/shop/news/NewsDetail/index",
"style": {
@ -401,13 +410,20 @@
"style": {
"navigationBarTitleText": "地图"
}
},
{
"path": "pages/shop/Live/LiveList/index",
"style": {
"navigationBarTitleText": "直播列表"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarTitleText": "Yshop",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"backgroundColor": "#F8F8F8",
"navigationStyle": "default"
},
"tabBar": {
"color": "#282828",
@ -415,9 +431,9 @@
"borderStyle": "black",
"backgroundColor": "#ffffff",
"height": "50px",
"fontSize": "10px",
"iconWidth": "24px",
"spacing": "3px",
"fontSize": "8px",
"iconWidth": "16px",
"spacing": "-3px",
"list": [{
"pagePath": "pages/home/index",
"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 dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import { parseQuery, login, handleQrCode } from "@/utils";
import { parseQuery, login, handleQrCode ,getCurrentPageUrl,handleUrlParam} from "@/utils";
export default {
name: "Loading",
@ -26,8 +26,11 @@ export default {
return {};
},
onShow() {
var url = handleQrCode();
if(!url){
url = handleUrlParam(getCurrentPageUrl())
}
//
if (url) {
var spread = cookie.get("spread");
@ -44,7 +47,7 @@ export default {
}
cookie.get("spread");
// this.toLaunch();
if (this.$deviceType == "app") {
if (this.$deviceType == "app"||this.$deviceType == "h5") {
// this.toLaunch();
this.$yrouter.switchTab({
path: "/pages/home/index"
@ -52,9 +55,9 @@ export default {
return;
}
login().finally(() => {
// this.$yrouter.switchTab({
// path: "/pages/home/index"
// });
this.$yrouter.switchTab({
path: "/pages/home/index"
});
});
},
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>
<view class="group-list" ref="container">
<view class="list" v-if="combinationList.length>0">
<view
class="item acea-row row-between-wrapper"
v-for="(item, combinationListIndex) in combinationList"
:key="combinationListIndex"
@click="link(item.id)"
>
<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 class="page_box">
<view class="content_box">
<scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore">
<view class="group-wrap">
<view class="group-head x-bc">
<text class="group-head__title">爆款拼团</text>
<text class="group-head__notice">省钱省心限时拼</text>
</view>
<view class="bottom acea-row row-between-wrapper">
<view class="money">
<text class="num" v-text="item.price"></text>
<text class="y-money" v-text="'¥' + item.productPrice"></text>
</view>
<view class="groupBnt bg-color-red">
去拼团
<text class="iconfont icon-jiantou"></text>
<view class="group-box">
<view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id">
<activity-card :cId="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image"
:price="groupon.price" :productPrice="groupon.productPrice">
<block slot="tag">
<view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
</block>
<block slot="sell">
<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>
<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>
</scroll-view>
</view>
<Loading :loaded="loaded" :loading="loading"></Loading>
</view>
</template>
<script>
import { getCombinationList } from "@/api/activity";
import Loading from "@/components/Loading";
export default {
name: "GoodsGroup",
components: {
Loading
},
props: {},
data: function() {
return {
combinationList: [],
status: false, // false true
loading: false, // false true
page: 1, //
limit: 20, //
loadingList: false
};
},
mounted: function() {
// document.querySelector('body').setAttribute('style', 'background-color:#eb3729');
this.getCombinationList();
},
onReachBottom() {
!this.loadingList && this.getCombinationList();
},
methods: {
getCombinationList: function() {
var that = this;
if (that.loading) return;
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;
});
import activityCard from './children/activity-card.vue';
import Loading from "@/components/Loading";
import {
getCombinationList
} from "@/api/activity";
export default {
components: {
activityCard,
Loading
},
data() {
return {
emptyData: {
img: '/static/imgs/empty/empty_goods.png',
tip: '还没有拼团商品噢,去首页看看吧~',
path: '/pages/index/index',
pathText: '去首页逛逛'
},
loaded: false,
loading: false,
lastPage: 0,
currentPage: 1,
limit: 10,
grouponList: []
};
},
onLoad() {
this.getGrouponList();
},
link: function(id) {
this.$yrouter.push({
path: "/pages/activity/GroupDetails/index",
query: { id }
});
onPullDownRefresh() {},
computed: {},
methods: {
//
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>
<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>
<scroll-view scroll-y="false" scroll-x="true">
<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-if="active==index" class="timeItem active" @click="setTime(index)">
<view class="time">{{ item.time }}</view>
@ -19,26 +22,15 @@
</scroll-view>
<view v-for="(item, index) in timeList" :key="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>
<count-down
:isDay="false"
:tipText="'距结束仅剩 '"
:dayText="false"
:hourText="' : '"
:minuteText="' : '"
:secondText="false"
:datatime="datatime"
v-if="item.status === 1"
></count-down>
<count-down :isDay="false" :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>
</view> -->
<view class="list">
<view
class="item acea-row row-between-wrapper"
v-for="(itemSeckill, indexSeckill) in seckillList"
:key="indexSeckill"
>
<view class="item acea-row row-between-wrapper" v-for="(itemSeckill, indexSeckill) in seckillList"
:key="indexSeckill">
<view class="pictrue">
<image :src="itemSeckill.image" />
</view>
@ -46,28 +38,22 @@
<view class="line1" v-text="itemSeckill.title"></view>
<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 class="progress cart-color">
<view class="bg-red" :style="{ width: loading ? itemSeckill.percent + '%' : '' }"></view>
<view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view>
</view>
</view>
<view
class="grab bg-color-red"
v-if="item.status === 1 && itemSeckill.stock > 0"
@click="goDetail(itemSeckill.id)"
>马上抢</view>
<view class="grab bg-color-red" v-if="item.status === 1 && itemSeckill.stock > 0"
@click="goDetail(itemSeckill.id,item.status)">马上抢</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>
</view>
<view
class="noCommodity"
style="background-color: #fff;"
v-if="seckillList.length === 0 && page > 1"
>
<view class="noCommodity" style="background-color: #f5f5f5;" v-if="seckillList.length === 0 && page > 1">
<view class="noPictrue">
<image src="@/static/images/noGood.png" class="image" />
</view>
@ -77,185 +63,215 @@
</view>
</template>
<script>
import { getSeckillConfig, getSeckillList } from "@/api/activity";
import CountDown from "@/components/CountDown";
// import { Tab, Tabs } from "vant-weapp";
import Loading from "@/components/Loading";
import {
getSeckillConfig,
getSeckillList
} from "@/api/activity";
import CountDown from "@/components/CountDown";
// import { Tab, Tabs } from "vant-weapp";
import Loading from "@/components/Loading";
export default {
name: "GoodsSeckill",
components: {
CountDown
},
props: {},
data: function() {
return {
headerImg: "",
timeList: [],
sticky: false,
loading: false,
datatime: 0,
active: 0,
seckillList: [],
status: false, // false true
loadingList: false, // false true
page: 1, //
limit: 5, //
title: []
};
},
mounted: function() {
this.mountedStart();
},
onReachBottom() {
!this.loadingList && this.getSeckillList();
},
methods: {
changeTime: function(index) {
this.active = index;
this.getSeckillList();
export default {
name: "GoodsSeckill",
components: {
CountDown
},
props: {},
data: function () {
return {
headerImg: "",
timeList: [],
sticky: false,
loading: false,
datatime: 0,
active: 0,
seckillList: [],
status: false, // false true
loadingList: false, // false true
page: 1, //
limit: 5, //
title: []
};
},
mounted: function () {
this.mountedStart();
},
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);
onReachBottom() {
!this.loadingList && this.getSeckillList();
},
methods: {
changeTime: function (index) {
this.active = index;
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 = [];
title = res.data.seckillTime.map((item, index) => {
return {
name: "div",
attrs: {
class: "timeItem"
},
children: [
{
name: "div",
attrs: {
class: "time"
},
children: [
{
let title = [];
title = res.data.seckillTime.map((item, index) => {
return {
name: "div",
attrs: {
class: "timeItem"
},
children: [{
name: "div",
attrs: {
class: "time"
},
children: [{
type: "text",
text: item.time
}
]
},
{
name: "div",
attrs: {
class: "state"
}]
},
children: [
{
{
name: "div",
attrs: {
class: "state"
},
children: [{
type: "text",
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;
this.seckillList = [];
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();
});
});
},
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;
this.seckillList = [];
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
}
});
},
goDetail: function (id, status) {
var that = this;
var time = that.timeList[that.active].stop;
this.$yrouter.push({
path: "/pages/activity/SeckillDetails/index",
query: {
id,
time,
status
}
});
}
}
}
};
};
</script>
<style scoped lang="less">
.timeScroll {
display: flex;
align-items: center;
flex-direction: row;
}
.flash-sale {
background: #f5f5f5 !important;
height: 100%;
}
.timeItem {
font-size: 0.22 * 100rpx;
color: #282828;
width: 150rpx;
text-align: center;
padding: 0.11 * 100rpx 0;
background-color: none;
.timeScroll {
display: flex;
align-items: center;
flex-direction: row;
}
.list {
padding: 0 20rpx;
&.active {
.time {
color: #eb3729;
.item {
padding: .25*100rpx;
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 {
background-color: #eb3729;
color: #fff;
opacity: 1;
border-radius: 30rpx;
padding: 0 0.2 * 100rpx;
font-weight: 800;
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
image {
width: 75rpx;
height: 70rpx;
}
}
}
.timeItem .time {
font-size: 0.32 * 100rpx;
font-weight: bold;
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
}
.timeItem {
font-size: 0.22 * 100rpx;
color: #282828;
width: 150rpx;
text-align: center;
padding: 20rpx 0;
background-color: none;
.timeItem .state {
height: 0.37 * 100rpx;
line-height: 0.37 * 100rpx;
}
&.active {
.time {
color: #eb3729;
}
.activity {
color: #333;
}
.state {
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 {
background-color: #999;
}
.timeItem .time {
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>

657
pages/activity/GroupDetails/index.vue

@ -1,12 +1,15 @@
<template>
<view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus">
<!-- 商品轮播 -->
<product-con-swiper :imgUrls="imgUrls"></product-con-swiper>
<!-- 商品信息描述 -->
<view class="wrapper">
<view class="share acea-row row-between row-bottom">
<view class="money font-color-red">
<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 class="introduce" v-text="storeInfo.title"></view>
@ -16,11 +19,22 @@
<view v-text="'已拼:' + storeInfo.sales + storeInfo.unitName"></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="num font-color-red">
<text class="iconfont icon-laba"></text>
已拼{{ storeInfo.sales
}}{{ storeInfo.unitName }}
已拼{{ storeInfo.sales }}{{ storeInfo.unitName }}
<text class="line">|</text>
</view>
<view class="swiper-no-swiping swiper">
@ -33,6 +47,8 @@
</swiper>
</view>
</view>
<!-- 拼团人数头像 -->
<view class="assemble">
<view v-for="(item, groupListindex) in groupList" :key="groupListindex">
<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>人成团</text>
</view>
<count-down
:isDay="false"
:tipText="'剩余 '"
:dayText="false"
:hourText="':'"
:minuteText="':'"
:secondText="false"
:datatime="item.stopTime/1000"
></count-down>
<count-down :isDay="false" :tipText="'剩余 '" :dayText="false" :hourText="':'" :minuteText="':'"
:secondText="false" :datatime="item.stopTime/1000"></count-down>
</view>
<view class="spellBnt" @click="groupRule(item.id)">
去拼单
@ -71,6 +80,8 @@
<text class="iconfont icon-xiangxia"></text>
</view>
</view>
<!-- 拼团规则 -->
<view class="playWay">
<view class="title acea-row row-between-wrapper">
<view>拼团玩法</view>
@ -91,6 +102,8 @@
</view>
</view>
</view>
<!-- 用户评价 -->
<view class="userEvaluation">
<view class="title acea-row row-between-wrapper">
<view v-text="'用户评价(' + replyCount + ')'"></view>
@ -101,278 +114,408 @@
</view>
<UserEvaluation :reply="reply"></UserEvaluation>
</view>
<!-- 产品介绍 -->
<view class="product-intro">
<view class="title">产品介绍</view>
<view class="conter" v-html="storeInfo.description"></view>
<!-- <view class="conter" v-html=""></view> -->
</view>
<!-- 操作栏 -->
<view style="height:100rpx;"></view>
<view class="footer-group acea-row row-between-wrapper">
<!-- <view class="customerSer acea-row row-center-wrapper row-column">
<view class="iconfont icon-kefu"></view>
<view>客服</view>
</view>-->
<view class="customerSer acea-row row-center-wrapper row-column" @click="setCollect">
<view class="iconfont" :class="userCollect ? 'icon-shoucang1' : 'icon-shoucang'"></view>
<view class="footer acea-row row-between-wrapper">
<!-- #ifdef MP-WEIXIN -->
<view class="item">
<button open-type="contact" class='contacButton'>
<view style="padding-bottom: 8rpx;" class="item">
<view class="iconfont icon-kefu"></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>
</view>
<view class="bnt bg-color-violet" @click="openAlone">单独购买</view>
<view class="bnt bg-color-red" @click="openTeam">立即开团</view>
<view class="bnt acea-row">
<view class="joinCart" @click="openAlone">
<text>单独购买</text>
</view>
<view class="buy" @click="openTeam">
<text>立即开团</text>
</view>
</view>
</view>
<!-- 商品信息弹窗 -->
<ProductWindow v-if="cartNum" v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
<StorePoster
v-on:setPosterImageStatus="setPosterImageStatus"
:posterImageStatus="posterImageStatus"
:posterData="posterData"
></StorePoster>
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData"></StorePoster>
</view>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown";
import UserEvaluation from "@/components/UserEvaluation";
import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster";
import { getCombinationDetail } from "@/api/activity";
import { postCartAdd } from "@/api/store";
import { imageBase64 } from "@/api/public";
import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
const NAME = "GroupDetails";
import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown";
import UserEvaluation from "@/components/UserEvaluation";
import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster";
import {
getCombinationDetail
} from "@/api/activity";
import {
postCartAdd
} from "@/api/store";
import {
imageBase64
} from "@/api/public";
import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
const NAME = "GroupDetails";
export default {
name: "GroupDetails",
components: {
ProductConSwiper,
CountDown,
UserEvaluation,
// swiper,
// swiperSlide,
ProductWindow,
StorePoster
},
props: {},
data: function() {
return {
domStatus: false,
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: {
export default {
name: "GroupDetails",
components: {
ProductConSwiper,
CountDown,
UserEvaluation,
// swiper,
// swiperSlide,
ProductWindow,
StorePoster
},
props: {},
data: function () {
return {
domStatus: false,
posterData: {
image: "",
store_name: "",
title: "",
price: "",
stock: "",
unique: "",
cart_num: 1
code: ""
},
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 });
},
//
setCollect: function() {
let that = this,
id = that.storeInfo.id,
category = "product";
if (that.userCollect) {
getCollectDel(id, category).then(function() {
that.userCollect = !that.userCollect;
onShow: function () {
this.mountedStart();
},
methods: {
onShareAppMessage: function() {
return {
title: this.storeInfo.title,
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 {
getCollectAdd(id, category).then(function() {
that.userCollect = !that.userCollect;
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
//
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();
});
}
},
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, "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.setProductSelect();
that.posterData.image = that.storeInfo.image;
if (that.storeInfo.title.length > 30) {
that.posterData.title = that.storeInfo.title.substring(0, 30) + "...";
},
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]);
}
//sort();:--
let productSelect = this.productValue[value.sort().join(",")];
console.log(productSelect)
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.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", 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 {
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;
console.log(this.storeInfo)
//that.getImageBase64();
});
},
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
});
},
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
},
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>
<style scoped lang="less">
.product-con .wrapper {
padding-bottom: 0.26 * 100rpx;
}
.noscroll {
height: 100%;
overflow: hidden;
}
.product-con .footer-group .bnt {
// flex:1;
width: 43%;
}
.product-con .footer-group .bnt.bg-color-violet {
background-color: #fa8013;
}
.product-con .wrapper {
padding-bottom: 0.26 * 100rpx;
}
.noscroll {
height: 100%;
overflow: hidden;
}
.product-con .footer-group .bnt {
// flex:1;
width: 43%;
}
.footer-group {
button {
border: 0;
background: none;
}
}
.product-con .footer-group .bnt.bg-color-violet {
background-color: #fa8013;
}
</style>

4
pages/activity/GroupRule/index.vue

@ -111,6 +111,7 @@ export default {
pinkT: [], //
storeCombination: [], //
pinkId: 0,
uniqueId: "",
count: 0, //
iShidden: false
};
@ -140,7 +141,7 @@ export default {
var data = {};
data.productId = that.storeCombination.productId;
data.cartNum = that.pinkT.totalNum;
data.uniqueId = "";
data.uniqueId = that.uniqueId;
data.combinationId = that.storeCombination.id;
data.new = 1;
postCartAdd(data)
@ -208,6 +209,7 @@ export default {
that.$set(that, "pinkBool", res.data.pinkBool);
that.$set(that, "isOk", res.data.isOk);
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>
</template>
<script>
import { getBargainPoster, getCombinationPoster } from "@/api/activity";
import {
getBargainPoster,
getCombinationPoster
} from "@/api/activity";
export default {
name: "Poster",
components: {},
props: {},
data: function() {
return {
status: true,
id: 0,
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
});
});
export default {
name: "Poster",
components: {},
props: {},
data: function () {
return {
status: true,
id: 0,
image: ""
};
},
//
getCombinationPoster: function() {
mounted: function () {
var that = this;
getCombinationPoster({ id: 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
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
});
});
},
//
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>
<style scoped lang="less">
page {
background-color: #eb3729;
}
.poster-poster {
height: unset !important;
}
page {
background-color: #eb3729;
}
.poster-poster {
height: unset !important;
}
</style>

536
pages/activity/SeckillDetails/index.vue

@ -10,15 +10,8 @@
<view class="acea-row row-middle">
<view class="times">
<view>距秒杀结束仅剩</view>
<count-down
:isDay="false"
:tipText="false"
:dayText="false"
:hourText="' : '"
:minuteText="' : '"
:secondText="false"
:datatime="datatime"
></count-down>
<count-down :isDay="false" :tipText="false" :dayText="false" :hourText="' : '" :minuteText="' : '"
:secondText="false" :datatime="datatime"></count-down>
</view>
<view class="iconfont icon-jiantou"></view>
</view>
@ -33,203 +26,382 @@
<view v-text="'销量:' + storeInfo.sales + '件'"></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="title">产品介绍</view>
<view class="conter" v-html="storeInfo.description"></view>
</view>
<!-- 操作栏 -->
<view style="height:100rpx;"></view>
<view class="footerRush acea-row row-between-wrapper">
<!-- <view
class="customerSer acea-row row-center-wrapper row-column"
@click="routerGo()"
>
<view class="iconfont icon-kefu"></view>
<view>客服</view>
</view> -->
<view class="bnt bg-color-red" @click="tapBuy">立即购买</view>
<view class="footer acea-row row-between-wrapper">
<!-- #ifdef MP-WEIXIN -->
<view class="item">
<button open-type="contact" class='contacButton'>
<view style="padding-bottom: 8rpx;" class="item">
<view class="iconfont icon-kefu"></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>
</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>
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
<StorePoster
v-on:setPosterImageStatus="setPosterImageStatus"
:posterImageStatus="posterImageStatus"
:posterData="posterData"
></StorePoster>
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
:posterData="posterData"></StorePoster>
</view>
</template>
<style scoped lang="less">
.noscroll {
height: 100%;
overflow: hidden;
}
.noscroll {
height: 100%;
overflow: hidden;
}
</style>
<script>
import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown";
import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster";
import { getSeckillDetail } from "@/api/activity";
import { postCartAdd } from "@/api/store";
import { imageBase64 } from "@/api/public";
const NAME = "SeckillDetails";
import ProductConSwiper from "@/components/ProductConSwiper";
import CountDown from "@/components/CountDown";
import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster";
import {
getSeckillDetail
} from "@/api/activity";
import {
postCartAdd
} from "@/api/store";
import {
imageBase64
} from "@/api/public";
import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
const NAME = "SeckillDetails";
export default {
name: "SeckillDetails",
components: {
ProductConSwiper,
CountDown,
ProductWindow,
StorePoster
},
props: {},
data: function() {
return {
domStatus: false,
posterData: {
image: "",
title: "",
price: "",
code: ""
},
posterImageStatus: false,
action: "",
imgUrls: [],
storeInfo: [],
replyCount: 0,
reply: [],
cartNum: 1,
attr: {
cartAttr: false,
productSelect: {
export default {
name: "SeckillDetails",
components: {
ProductConSwiper,
CountDown,
ProductWindow,
StorePoster
},
props: {},
data: function () {
return {
seckillStatus: '',
domStatus: false,
posterData: {
image: "",
store_name: "",
title: "",
price: "",
stock: "",
unique: "",
cart_num: 1
code: ""
},
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
};
},
watch: {
$yroute: function(n) {
var that = this;
if (n.name === NAME) {
that.mountedStart();
}
}
},
mounted: function() {
this.mountedStart();
},
methods: {
routerGo(item) {
this.$yrouter.push({ path: '/pages/user/CustomerList/index' })
},
mountedStart: function() {
var that = this;
let id = that.$yroute.query.id;
that.datatime = parseInt(that.$yroute.query.time);
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) + "...";
openAlone: function () {
this.$yrouter.push({
path: "/pages/shop/GoodsCon/index",
query: {
id: this.storeInfo.productId
}
});
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
routerGo(item) {
this.$yrouter.push({
path: '/pages/user/CustomerList/index'
})
},
//
setCollect: function () {
let that = this,
id = that.storeInfo.id,
category = "product";
if (that.userCollect) {
getCollectDel(id, category).then(function () {
that.userCollect = !that.userCollect;
});
} 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;
that.setProductSelect();
that.domStatus = true;
});
},
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;
},
//
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;
if (res) {
if (that.attr.productSelect.cart_num < that.storeInfo.stock) {
that.attr.productSelect.cart_num++;
this.cartNum++;
},
mountedStart: function () {
var that = this;
console.log(this)
let id = that.$yroute.query.id;
this.seckillStatus = that.$yroute.query.status;
that.datatime = parseInt(that.$yroute.query.time);
getSeckillDetail(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, "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 {
that.posterData.title = that.storeInfo.title;
}
that.posterData.price = that.storeInfo.price;
that.posterData.code = that.storeInfo.code_base;
// that.setProductSelect();
that.domStatus = true;
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 {
if (that.attr.productSelect.cart_num > 1) {
that.attr.productSelect.cart_num--;
this.cartNum--;
//sort();:--
let productSelect = this.productValue[value.sort().join(",")];
console.log(productSelect)
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() {
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;
that.$set(that, "attr", attr);
},
selecAttrTap: function() {
this.cartAttr = 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
},
//
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;
if (res) {
if (that.attr.productSelect.cart_num < that.storeInfo.seckillStock) {
that.attr.productSelect.cart_num++;
this.cartNum++;
}
} else {
if (that.attr.productSelect.cart_num > 1) {
that.attr.productSelect.cart_num--;
this.cartNum--;
}
}
},
//
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.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", 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>
<style scoped lang="less">
.product-con .nav {
padding: 0 0.2*100rpx;
}
.product-con .nav {
padding: 0 0.2*100rpx;
}
.product-con .footer .bnt .buy.bg-color-hui {
background: #ccc;
}
</style>

339
pages/authorization/index.vue

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

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>
<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">
<text class="iconfont icon-xiazai5"></text>
搜索商品
@ -9,138 +22,38 @@
<image src="@/static/images/qr.png" />
</view>
</view>
<view class="fixed-header-box"></view>
<view class="slider-banner banner">
<swiper indicatorDots="true" v-if="banner.length > 0" autoplay circular>
<block v-for="(item, bannerIndex) in banner" :key="bannerIndex">
<swiper-item>
<view @click="goRoll(item)" class="swiper-item">
<image :src="item.pic" />
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="nav acea-row">
<view @click="goWxappUrl(item)" class="item" v-for="(item, menusIndex) in menus" :key="menusIndex">
<view class="pictrue">
<image :src="item.pic" />
</view>
<view>{{ item.name }}</view>
</view>
</view>
<!-- <view class="news acea-row ">
<view class="pictrue" v-if="$VUE_APP_RESOURCES_URL">
<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>
<Banner :banner="banner" @getbgcolor="getbgcolor"></Banner>
<uni-notice-bar scrollable="true" @click="goRoll(singNew)" single="true" :speed="10" showIcon="true"
:text="singNew.info"></uni-notice-bar>
<view class="content_box home_content_box">
<!-- 菜单 -->
<Menu :list="menus"></Menu>
<!-- 滚动新闻 -->
<!-- 广告 -->
<Adv />
<!-- 热门榜单 -->
<HotCommodity :detail="likeInfo"></HotCommodity>
<!-- 超值拼团 -->
<Groupon :detail="combinationList" />
<!-- 首发新品->秒杀 -->
<!-- <FirstNewProduct :detail="firstList"></FirstNewProduct> -->
<!-- 精品推荐 -->
<!-- <ProductsRecommended :detail="bastList"></ProductsRecommended> -->
<!-- 促销单品
<PromoteProduct :detail="benefit"></PromoteProduct> -->
<!-- 直播 -->
<!-- #ifdef MP-WEIXIN -->
<Live :detail="live"></Live>
<!-- #endif -->
<view class="wrapper" v-if="firstList.length > 0">
<view class="title acea-row row-between-wrapper">
<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>
<!-- 为您推荐 -->
<PromotionGood :benefit="benefit"></PromotionGood>
</view>
<PromotionGood :benefit="benefit"></PromotionGood>
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"></Coupon-window>
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
</Coupon-window>
</view>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import {
mapState,
mapMutations,
@ -149,7 +62,17 @@
import GoodList from '@/components/GoodList';
import PromotionGood from '@/components/PromotionGood';
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 {
getHomeData,
getShare
@ -167,18 +90,36 @@
components: {
// swiper,
// swiperSlide,
uniNoticeBar,
UniNoticeBar,
GoodList,
PromotionGood,
CouponWindow
CouponWindow,
Menu,
Adv,
Groupon,
Banner,
HotCommodity,
FirstNewProduct,
ProductsRecommended,
Live
},
props: {},
data: function() {
data: function () {
return {
CustomBar: this.CustomBar,
StatusBar: this.StatusBar,
formatMenus: [],
categoryCurrent: 0,
menuNum: 4,
bgcolor: '',
bgColor: '',
swiperCurrent: 0, //
webviewId: 0,
showCoupon: false,
logoUrl: '',
banner: [],
menus: [],
combinationList: [],
roll: [],
activity: [],
activityOne: {},
@ -191,6 +132,7 @@
bastList: []
},
likeInfo: [],
live: [],
lovely: [],
benefit: [],
couponList: [],
@ -246,15 +188,26 @@
slidesPerView: 'auto',
observer: true,
observeParents: true
}
},
bgImage: ''
};
},
computed: {
singNew() {
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()
let that = this;
uni.showLoading({
@ -269,15 +222,32 @@
that.$set(that, 'firstList', res.data.firstList);
that.$set(that, 'bastList', res.data.bastList);
that.$set(that, 'likeInfo', res.data.likeInfo);
that.$set(that, 'live', res.data.liveList);
that.$set(that, 'lovely', res.data.lovely);
that.$set(that, 'benefit', res.data.benefit);
that.$set(that, 'couponList', res.data.couponList);
that.$set(that, 'combinationList', res.data.combinationList);
uni.hideLoading();
that.setOpenShare();
// that.doColorThief()
});
},
methods: {
...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) {
if (item.uniapp_url) {
this.$yrouter.push(item.uniapp_url)
@ -309,7 +279,7 @@
goGoodsPromotion() {
this.$yrouter.push('/pages/shop/GoodsPromotion/index');
},
setOpenShare: function() {
setOpenShare: function () {
if (this.$deviceType == 'weixin') {
getShare().then(res => {
var data = res.data.data;
@ -323,15 +293,10 @@
})
}
},
startQr: function() {
startQr: function () {
uni.scanCode({
success: (res) => {
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) {
case 'good':
//
@ -370,15 +335,23 @@
});
break;
}
}
});
}
}
},
getbgcolor(e) {
this.bgcolor = e;
},
},
created: async function () {
// await this.doColorThief();
},
};
</script>
<style scoped lang="less">
.content_box {
background: #f6f6f6;
}
.index {
background-color: #fff;
}
@ -390,7 +363,13 @@
.fixed-header {
position: fixed;
z-index: 99;
// #ifdef H5
top: 88rpx;
// #endif
// #ifndef H5
top: 0;
// #endif
left: 0;
right: 0;
background: #fff;
@ -400,4 +379,65 @@
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>

13
pages/order/OrderDetails/index.vue

@ -126,7 +126,7 @@
<view class="name">
{{ orderInfo.realName }}
<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>{{ orderInfo.userAddress }}</view>
</view>
@ -134,7 +134,7 @@
<div class="name">
{{ system_store.name}}
<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>{{ system_store.address }}</div>
</div>
@ -366,6 +366,15 @@ export default {
},
});
},
//
telPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
fail() {
console.log("取消拨打");
}
});
},
showChang: function (data) {
//
this.$yrouter.push({

735
pages/order/OrderSubmission/index.vue

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

7
pages/orderAdmin/AdminOrder/index.vue

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

3
pages/shop/GoodsCollection/index.vue

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

19
pages/shop/StoreList/index.vue

@ -16,7 +16,7 @@
</view>
<view class="row-right">
<view>
<a class="store-phone" :href="'tel:' + item.phone">
<a class="store-phone" @click="telPhone(item.phone)">
<text class="iconfont icon-dadianhua01"></text>
</a>
</view>
@ -35,7 +35,7 @@
<script>
import Loading from "@/components/Loading";
import { storeListApi } from "@/api/store";
import { isWeixin } from "@/utils/index";
import { isWeixin,tel } from "@/utils/index";
import { wechatEvevt, wxShowLocation } from "@/libs/wechat";
import { mapGetters } from "vuex";
import cookie from "@/utils/store/cookie";
@ -79,6 +79,15 @@ export default {
this.$yrouter.back();
}
},
//
telPhone(phoneNumber) {
uni.makePhoneCall({
phoneNumber: phoneNumber,
fail() {
console.log("取消拨打");
}
});
},
//
getList: function() {
if (this.loading || this.loaded) return;
@ -98,7 +107,11 @@ export default {
this.mapKey = res.data.mapKey;
})
.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>
<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="title acea-row row-center-wrapper">
<view
class="item"
:class="current === index ? 'on' : ''"
v-for="(item, index) in navList"
@click="navTap(index)"
:key="index"
>{{ item }}</view>
<view class="title acea-row row-between-wrapper">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
@click="navTap(index)" :key="index">{{ item }}</view>
</view>
<view class="list" :hidden="current !== 0">
<form @submit.prevent="submit">
@ -50,12 +40,8 @@
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
</view>
@ -67,7 +53,9 @@
</view>
</view>
<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="item">
<view>
@ -83,12 +71,8 @@
<use xlink:href="#icon-code_1" />
</svg>-->
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
@click="code">{{ text }}</button>
</view>
</view>
<view class="item">
@ -99,6 +83,7 @@
<input type="password" placeholder="填写您的登录密码" v-model="password" />
</view>
</view>
<!-- #ifndef H5 -->
<view class="item">
<view>
<!-- <svg class="icon" aria-hidden="true">
@ -107,6 +92,8 @@
<input type="text" placeholder="输入邀请码" v-model="inviteCode" />
</view>
</view>
<!-- #endif -->
</view>
<view class="logon" @click="register">注册</view>
<view class="tip">
@ -114,216 +101,242 @@
<text @click="formItem = 1" class="font-color-red">立即登录</text>
</view>
</view>
<view class="bottom"></view>
</view>
</template>
<script>
import sendVerifyCode from "@/mixins/SendVerifyCode";
import { login, loginMobile, registerVerify, register } from "@/api/user";
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import sendVerifyCode from "@/mixins/SendVerifyCode";
import {
login,
loginMobile,
registerVerify,
register
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import { handleGetUserInfo } from "@/utils";
import {
handleGetUserInfo
} from "@/utils";
const BACK_URL = "login_back_url";
const BACK_URL = "login_back_url";
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function() {
return {
navList: ["账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
inviteCode: "",
formItem: 1,
type: "login"
};
},
methods: {
async loginMobile() {
var that = this;
const { account, captcha } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
export default {
name: "Login",
mixins: [sendVerifyCode],
data: function () {
return {
navList: ["账号登录"],
current: 0,
account: "",
password: "",
captcha: "",
inviteCode: "",
formItem: 1,
type: "login"
};
},
methods: {
async loginMobile() {
var that = this;
const {
account,
captcha
} = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
})
.validate({
account,
captcha
});
} catch (e) {
return validatorDefaultCatch(e);
}
loginMobile({
phone: that.account,
captcha: that.captcha,
spread: cookie.get("spread")
})
.validate({
account,
captcha
.then(res => {
var data = res.data;
that.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
} catch (e) {
return validatorDefaultCatch(e);
}
loginMobile({
phone: that.account,
captcha: that.captcha,
spread: cookie.get("spread")
})
.then(res => {
var data = res.data;
that.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
},
async register() {
var that = this;
const {
account,
captcha,
password
} = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
})
.validate({
account,
captcha,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
register({
account: that.account,
captcha: that.captcha,
password: that.password,
inviteCode: that.inviteCode,
spread: cookie.get("spread")
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.formItem = 1;
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
});
},
async register() {
var that = this;
const { account, captcha, password } = that;
try {
await that
.$validator({
},
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("手机号码")),
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
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({
}).validate({
account,
captcha,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
register({
account: that.account,
captcha: that.captcha,
password: that.password,
inviteCode: that.inviteCode,
spread: cookie.get("spread")
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.formItem = 1;
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
});
},
async code() {
var that = this;
const { account } = that;
try {
await that
.$validator({
account: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
})
.validate({
account
});
} catch (e) {
return validatorDefaultCatch(e);
}
if (that.formItem == 2) that.type = "register";
await registerVerify({
phone: that.account,
type: that.type
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "success",
duration: 2000
});
that.sendCode();
})
.catch(err => {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
});
},
navTap: function(index) {
this.current = index;
},
async submit() {
const { account, password } = this;
try {
await this.$validator({
account: [
required(required.message("账号")),
attrs.range([5, 16], attrs.range.message("账号")),
alpha_num(alpha_num.message("账号"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
}).validate({
account,
password
});
} catch (e) {
return validatorDefaultCatch(e);
}
} catch (e) {
return validatorDefaultCatch(e);
}
login({
username: account,
password,
spread: cookie.get("spread")
})
.then(({ data }) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
login({
username: account,
password,
spread: cookie.get("spread")
})
.then(({
data
}) => {
this.$store.commit("login", data.token, dayjs(data.expires_time));
handleGetUserInfo();
// let replace=this.$yroute.query.replace
// if(replace){
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
// }
// this.$yrouter.replace({
// path: this.$yroute.query.replace || '/pages/home/index'
// });
})
.catch(err => {
console.log(err);
uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
});
});
}
}
}
};
};
</script>

17
pages/user/PersonalData/index.vue

@ -43,20 +43,23 @@
<input type="text" v-else value="未绑定" disabled class="id" />
</view>
</view>
<!-- <view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view>密码</view>
<view class="input acea-row row-between-wrapper">
<text>点击修改密码</text>
<text class="iconfont icon-suozi"></text>
<!--
<view class="item acea-row row-between-wrapper" @click="goChangePassword()">
<view>密码</view>
<view class="input acea-row row-between-wrapper">
<text>点击修改密码</text>
<text class="iconfont icon-suozi"></text>
</view>
</view>
</view>-->
-->
</view>
<view class="modifyBnt bg-color-red" @click="submit">保存修改</view>
<!-- #ifndef MP-WEIXIN -->
<view
class="logOut cart-color acea-row row-center-wrapper"
@click="logout"
v-if="$deviceType!='routine'"
>退出登录</view>
<!-- #endif -->
</view>
</template>
<script>

609
pages/user/Recharge/index.vue

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

520
pages/user/User/index.vue

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

8
pages/user/UserAccount/index.vue

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

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

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

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

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

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

@ -1,17 +1,20 @@
<template>
<view class="cash-withdrawal">
<view class="nav acea-row">
<view
v-for="(item, navListIndex) in navList"
class="item font-color-red"
@click="swichNav(navListIndex, item)"
:key="navListIndex"
>
<!-- <view class="nav acea-row">
<view v-for="(item, navListIndex) in navList" class="item font-color-red" @click="swichNav(navListIndex, item)"
:key="navListIndex">
<view class="line bg-color-red" :class="currentTab === navListIndex ? 'on' : ''"></view>
<view class="iconfont" :class="item.icon + ' ' + (currentTab === navListIndex ? 'on' : '')"></view>
<view>{{ item.name }}</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 :hidden="currentTab !== 0" class="list">
<view class="item acea-row row-between-wrapper">
@ -55,158 +58,198 @@
</view>
</template>
<script>
import { getBank, postCashInfo } from "@/api/user";
import { required } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import {
getBank,
postCashInfo
} from "@/api/user";
import {
required
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
export default {
name: "UserCash",
components: {},
props: {},
data: function() {
return {
navList: [
{ name: "微信", type: "weixin", icon: "icon-weixin2" },
{ name: "支付宝", type: "alipay", icon: "icon-icon34" }
],
post: {
extract_type: "weixin",
alipay_code: "",
money: "",
name: "",
bankname: "",
cardnum: "",
weixin: ""
},
currentTab: 0,
minPrice: 0,
banks: [],
commissionCount: 0
};
},
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;
export default {
name: "UserCash",
components: {},
props: {},
data: function () {
return {
navList: [{
name: "微信",
type: "weixin",
icon: "icon-weixin2"
},
{
name: "支付宝",
type: "alipay",
icon: "icon-icon34"
}
],
post: {
extract_type: "weixin",
alipay_code: "",
money: "",
name: "",
bankname: "",
cardnum: "",
weixin: ""
},
function(err) {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
icon: "none",
duration: 2000
});
}
);
currentTab: 0,
minPrice: 0,
banks: [],
commissionCount: 0
};
},
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
)
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;
}
mounted: function () {
this.getBank();
},
save: function(info) {
postCashInfo(info).then(
res => {
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) {
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({
title: res.msg,
title: "余额不足",
icon: "none",
duration: 2000
});
this.router.push({ path: "/user/audit" });
},
err => {
return
}
if (parseFloat(money) < parseFloat(that.minPrice)) {
uni.showToast({
title: err.msg || err.response.data.msg|| err.response.data.message,
title: "最低提现金额" + that.minPrice,
icon: "none",
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>
<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 class="bnt bg-color-red" @click="toCash">立即提现</view> -->
<view class="list acea-row row-between-wrapper">
<view class="item acea-row row-center-wrapper row-column" @click="goPoster()">
<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);
});
}).catch(() => {
dialog.error("获取信息失败!");
uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
});
}
},
@ -113,7 +117,11 @@ const vuexStore = new Vuex.Store({
});
}).catch((error) => {
console.log(error)
dialog.error("获取信息失败!");
uni.showToast({
title: "获取信息失败!",
icon: "none",
duration: 2000,
});
});
},
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-font-size-subtitle:36upx;
$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
}
}
// 年月日,时分秒
// "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) {
time = +time * 1000;
const d = new Date(time);
@ -62,7 +82,10 @@ export function isType(arg, type) {
}
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() {
@ -182,13 +205,11 @@ export const login = () => {
// } else {
// // wechat().then(() => oAuth().then((code) => {
// // // const { code } = parseQuery()
// // debugger
// // auth(code)
// // .then(() => {
// // // location.replace(
// // // decodeURIComponent(decodeURIComponent(this.$route.params.url))
// // // );
// // debugger
// // location.href = decodeURIComponent(
// // decodeURIComponent(this.$route.params.url)
// // );
@ -250,6 +271,7 @@ export const login = () => {
store.dispatch('userInfo', true)
getUserInfo().then(user => {
console.log('获取用户信息成功')
uni.setStorageSync('uid', user.data.uid);
store.dispatch('setUserInfo', user.data)
resolve(user)
}).catch(error => {
@ -659,13 +681,14 @@ export function handleQrCode() {
export function handleUrlParam(path) {
console.log(path)
var url = path.split("?")[1]; //获取url中"?"符后的字串
console.log(url)
var theRequest = new Object();
let strs = url.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
if(path.includes("?")){
var url = path.split("?")[1]; //获取url中"?"符后的字串
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;
}
@ -700,8 +723,8 @@ const getImageInfo = (images) => {
* @param string store_name 素材文字
* @param string price 价格
* @param function successFn 回调函数
*
*
*
*
*/
export const PosterCanvas = (store, successCallBack) => {
uni.showLoading({
@ -796,16 +819,115 @@ export const handleLoginFailure = () => {
console.log(store.getters)
console.log('————————')
store.commit("updateAuthorizationPage", true);
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('————————')
let url = handleQrCode();
if(!url){
url = handleUrlParam(path);
}
console.log(url)
if (url) {
path = parseUrl({
@ -814,7 +936,7 @@ export const handleLoginFailure = () => {
id: url.pinkId,
}
})
// cookie.set("spread", url.spread || 0);
cookie.set("spread", url.spread || 0);
} else {
console.log('————————')
console.log('是拼团进来的,但是没有获取到参数')
@ -837,7 +959,7 @@ export const handleLoginFailure = () => {
partake: url.uid
}
})
// cookie.set("spread", url.spread || 0);
cookie.set("spread", url.spread || 0);
} else {
handleNoParameters()
console.log('————————')
@ -849,6 +971,7 @@ export const handleLoginFailure = () => {
}
if (getCurrentPageUrl() == 'pages/shop/GoodsCon/index' && handleQrCode()) {
debugger;
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";
// #endif
// #ifdef APP-PLUS
// app端
import Fly from "flyio/dist/npm/wx";
// #endif
// #ifdef MP-WEIXIN
import Fly from "flyio/dist/npm/wx";
// #endif

Loading…
Cancel
Save