123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <view :style="viewColor" class="page_container">
- <view class='bargain-list'>
-
- <view v-if='!$wechat.isWeixin()' class="fixed-head">
- <view class="sys-head" :style="{height:statusBarHeight}"></view>
- <view class="tool-bar">
- <view class='iconfont icon-xiangzuo' @tap='goBack'></view>
- </view>
- </view>
-
- <view class='header'>
- <image mode="widthFix" class="assistBg" :src="domain+'assist_bg'+keyColor+'.png'" alt="">
- </view>
- <view class='list'>
- <block v-for="(item,index) in assistList" :key="index">
- <view class='item acea-row row-between-wrapper' @tap="openSubscribe(item.product_assist_id)">
- <view class='pictrue'>
- <image :src='item.product.image'></image>
- </view>
- <view class='text acea-row row-column-around'>
- <view class='name line1'>{{item.store_name}}</view>
- <view class='num'><text class='iconfont icon-pintuan'></text>{{item.user_count}}人正在参与</view>
- <view class='money'>助力价: ¥<text class='price'>{{item.assistSku ? item.assistSku[0].assist_price : ''}}</text></view>
- </view>
- <view class='cutBnt'></text>发起助力</view>
- </view>
- </block>
- </view>
- </view>
- <home></home>
-
- <passwordPopup></passwordPopup>
-
- </view>
- </template>
- <script>
-
-
-
-
-
-
-
-
-
- import { getAssistList, initiateAssistApi } from '../../../api/activity.js';
- import home from '@/components/home/index.vue';
- import { getUserInfo } from '@/api/user.js';
- import { mapGetters } from "vuex";
- import { configMap } from "@/utils";
- import { HTTP_REQUEST_URL } from '@/config/app';
- import { toLogin } from '@/libs/login.js';
-
- import passwordPopup from '@/components/passwordPopup';
-
- export default {
- components: {
- home,
-
- passwordPopup,
-
- },
- data() {
- return {
- domain: HTTP_REQUEST_URL+'/static/diy/',
- topImage: '',
- assistList: [],
- active: 0,
- type: 0,
- scrollLeft: 0,
- interval: 0,
- status: 1,
- page: 1,
- limit: 10,
- loading: false,
- loadend: false,
- pageloading: false,
- userInfo: {},
- }
- },
-
-
- onShareAppMessage: function() {
- wx.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- return {
- title: '助力活动',
- path: 'pages/activity/assist/index',
- }
- },
- onShareTimeline: function() {
- return {
- title: '助力活动',
- query: {
- key: ''
- },
- imageUrl: ''
- }
- },
-
- computed: configMap({statusBarHeight:0},mapGetters(['isLogin','viewColor','keyColor'])),
- watch:{
- isLogin:{
- handler:function(newV,oldV){
- if(newV){
- this.getUserInfo();
- this.getAssistProductList();
- }
- },
- deep:true
- }
- },
- onLoad() {
- this.getAssistProductList();
- if (this.isLogin) {
- this.getUserInfo();
- }
- },
- methods: {
- goBack: function() {
- uni.navigateBack();
- },
- getAssistProductList: function() {
- var that = this;
- var data = {
- page: that.page,
- limit: that.limit,
- };
- if (that.loadend) return;
- if (that.pageloading) return;
- that.pageloading = true
- getAssistList(data).then(res => {
- var assistList = res.data.list;
- var loadend = assistList.length < that.limit;
- that.page++;
- that.assistList = that.assistList.concat(assistList);
- uni.stopPullDownRefresh();
- that.pageloading = false;
- that.loadend = loadend;
- }).catch(err => {
- that.pageloading = false
- });
- },
- openSubscribe: function(id) {
- if(this.isLogin){
- initiateAssistApi(id).then(res => {
- let id = res.data.product_assist_set_id;
- uni.hideLoading();
- uni.navigateTo({
- url: '/pages/activity/assist_detail/index?id='+id
- });
- }).catch((err) => {
- uni.showToast({
- title:err,
- icon:'none'
- })
- });
- }else{
- toLogin()
- }
- },
-
- getUserInfo: function() {
- let that = this;
- getUserInfo().then(res => {
- that.$set(that, 'userInfo', res.data);
- });
- },
- },
- onPullDownRefresh: function(){
- this.page = 1;
- this.pageloading = false;
- this.loadend = false;
- this.assistList = []
- this.getAssistProductList();
- },
-
- onReachBottom: function() {
- this.getAssistProductList();
- }
- }
- </script>
- <style lang="scss">
- .page_container {
- min-height: 100vh;
- background-color: var(--view-theme);
- }
- .bargain-list .header {
- width: 100%;
- position: relative;
- }
- .bargain-list .header .assistBg {
- width: 750rpx;
- box-sizing: border-box;
- }
- .bargain-list .list {
- background-color: #fff;
- border: 6rpx solid #fc8b42;
- border-radius: 30rpx;
- margin: -90rpx 30rpx 66rpx 30rpx;
- padding: 0 24rpx;
- position: relative;
- top: -50rpx;
- }
- .bargain-list .list .item {
- border-bottom: 1px solid #eee;
- position: relative;
- height: 223rpx;
- }
- .bargain-list .list .item .pictrue {
- width: 160rpx;
- height: 160rpx;
- }
- .bargain-list .list .item .pictrue image {
- width: 100%;
- height: 100%;
- border-radius: 6rpx;
- }
- .bargain-list .list .item .text {
- width: 450rpx;
- font-size: 30rpx;
- color: #282828;
- height: 160rpx;
- }
- .bargain-list .list .item .text .name {
- width: 100%;
- }
- .bargain-list .list .item .text .num {
- font-size: 26rpx;
- color: #999;
- }
- .bargain-list .list .item .text .num .iconfont {
- font-size: 35rpx;
- margin-right: 7rpx;
- }
- .bargain-list .list .item .text .money {
- font-size: 24rpx;
- font-weight: bold;
- color: var(--view-priceColor);
- }
- .bargain-list .list .item .text .money .price {
- font-size: 32rpx;
- }
- .bargain-list .list .item .cutBnt {
- position: absolute;
- width: 180rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 50rpx;
- font-size: 26rpx;
- color: #fff;
- height: 56rpx;
- right: 0;
- bottom: 44rpx;
- background-color: var(--view-theme);
- }
- .bargain-list .list .item .cutBnt .iconfont {
- margin-right: 8rpx;
- font-size: 30rpx;
- }
- .bargain-list .list .load {
- font-size: 24rpx;
- height: 85rpx;
- text-align: center;
- line-height: 85rpx;
- }
- .tool-bar{
- display: flex;
- align-items: center;
- height: 40px;
- }
- .fixed-head{
- position: absolute;
- left: 0;
- top: 20px;
- width: 100%;
- z-index: 10;
- .icon-xiangzuo {
- margin-right: 40rpx;
- margin-left: 20rpx;
- font-size: 40rpx;
- color: #fff;
- }
- }
- </style>
|