修复部分bug

This commit is contained in:
唐明明
2021-10-09 17:21:18 +08:00
parent 09c68e4289
commit ce1f3ff02f
22 changed files with 12438 additions and 58615 deletions

View File

@@ -152,7 +152,7 @@
<view class="title">
限时抢购<text>海量商家优惠券</text>
</view>
<navigator class="more" open-type="navigate" url="/pages/coupons/couponList">查看更多</navigator>
<view class="more" @click="onCoupons('more')">查看更多</view>
</view>
<view class="coupons" v-if="coupons.length > 0">
<view class="coupons-item" v-for="(item, index) in coupons" :key="index">
@@ -173,7 +173,7 @@
<view class="logo">
<image class="logo-img" :src="item.cover" mode="aspectFill"></image>
</view>
<view class="btn">立即领取</view>
<button class="btn" :disabled="!item.can.get" @click="onCoupons('get', item.coupon_id, index)">{{item.can.get ? '立即领取' : '已领取'}}</button>
</view>
</view>
<!-- 优选商品 -->
@@ -186,9 +186,10 @@
<script>
import { companies, companiesList } from '@/apis/interfaces/company'
import { mall, list } from '@/apis/interfaces/goods'
import { mall, list, managesCoupons } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
import industryList from '@/components/industry-list/industry-list'
import userAuth from '@/public/userAuth'
export default{
comments:{
goodsList,
@@ -251,6 +252,34 @@
break
}
},
// 领取,更多优惠券
onCoupons(type, id, index){
let token = this.$store.getters.getToken
if(token == ''){
let userLogin = new userAuth()
userLogin.Login()
return
}
if(type === 'more'){
this.$Router.push({name: 'CouponsList'})
return
}
if(type === 'get'){
managesCoupons(id).then(res=>{
this.$set(this.coupons, index, res)
uni.showToast({
title: '领取成功',
type: 'primary',
duration: 3000
})
}).catch(err => {
uni.showToast({
icon : 'none',
title: err.message
})
})
}
},
// 企业广场
getCompanies(){
companies().then(res=>{
@@ -323,7 +352,6 @@
},
// 打开微信小程序
onOpenWechat(e){
console.log(e)
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
@@ -568,7 +596,14 @@
text-align: center;
line-height: 64rpx;
font-size: 28rpx;
font-weight: 600;
font-weight: 600;
&[disabled]{
background: rgba($color: #faf2dd, $alpha: .8);
color: rgba($color: #fd5f3c, $alpha: .5);
}
&::after{
border: none;
}
}
}
}

View File

@@ -19,10 +19,10 @@
</view>
<view class="lists">
<!-- 优选商品 -->
<goods-list :list="searchArr" priceType="CNY" v-if="searchType == 0" />
<goods-list :list="searchArr" priceType="CNY" v-if="searchType == 0" @on-goods="onGoods" />
<!-- 商家 -->
<industry-list :list="searchArr" v-if="searchType == 1"/>
<industry-list :list="searchArr" v-if="searchType == 1" @on-industry="onOpenWechat"/>
</view>
<!-- 分页 -->
@@ -77,6 +77,37 @@
}
},
methods: {
// 商品详情
onGoods(e){
this.$Router.push({name: 'goodsDetails', params: {id: e.goods_id}})
},
// 打开微信小程序
onOpenWechat(e){
plus.share.getServices(res => {
let sweixin = null;
for(let val of res){
if(val.id === 'weixin'){
sweixin = val
}
}
/** 以此为例子 显示跳转引导页
* 'index_4'
* index 跳小程序企业首页
* 4 企业id
**/
if(sweixin != null){
sweixin.launchMiniProgram({
id : e.original_id,
path: 'pages/login/guide?scene=index_' + e.company_id,
})
}else{
uni.showToast({
title: '当前环境不支持打开微信小程序',
icon : 'none'
})
}
})
},
// 列表数据
getList() {
// type=0为商品列表; type=1为企业列表