| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- <template>
- <view ref="container">
- <view class="top-fixed">
- <view class="search-cont">
- <view class="inner">
- <image class="icon-search" src="https://kntobs.jnmyunl.com/shop/images/search.png" mode=""></image>
- <input type="text" v-model="searchValue" placeholder="输入关键字搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
- </view>
- </view>
- </view>
- <mescroll-body top="100rpx" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
- <view class="tui-coupon-list">
- <view class="tui-coupon-item tui-top20" v-for="(item, index) in couponsList" :key="index">
- <image src="https://kntobs.jnmyunl.com/shop/images/bg_coupon_3x.png" class="tui-coupon-bg" mode="widthFix"></image>
- <view class="tui-coupon-item-left">
- <view class="tui-coupon-price-box" :class="{ 'tui-color-grey': item.receiveCount>0 }">
- <view class="tui-coupon-price-sign">¥</view>
- <view class="tui-coupon-price" :class="{ 'tui-price-small': false }">{{ item.couponPrice }}</view>
- </view>
- <view class="tui-coupon-intro">满{{ item.useMinPrice }}元可用</view>
- </view>
- <view class="tui-coupon-item-right">
- <view class="tui-coupon-content">
- <view class="tui-coupon-title-box">
- <view class="tui-coupon-title">{{ item.couponName }}</view>
- </view>
- <view class="tui-coupon-rule">
- <view class="tui-rule-box tui-padding-btm">
- <view class="tui-coupon-circle"></view>
- <view class="tui-coupon-text">不可叠加使用</view>
- </view>
- <view class="tui-rule-box">
- <view class="tui-coupon-circle"></view>
- <view class="tui-coupon-text">{{ item.limitTime }} 到期</view>
-
- </view>
- </view>
- </view>
- </view>
- <view class="tui-btn-box">
- <view class="btn cancel" @click="showpop(item)">发送</view>
- <view class="btn receive" @click="show(item)">查看</view>
- </view>
- </view>
- </view>
- </mescroll-body>
- <view>
- <u-popup :show="popshow" @close="close" :closeOnClickOverlay='true'>
- <view class="popbox">
- <view class="pop-tit">
- <view class="poptitle">选择用户</view>
- <u-icon name="close" size="24" @click="close"></u-icon>
- </view>
- <view class="popsh">
- <u-search :showAction="true" actionText="搜索" placeholder="输入手机号搜索"
- :animation="true" v-model="keyword" @search='searchkey(value)' @custom='searchkey(value)'></u-search>
- </view>
- <view class="poplist">
- <view class="list-box" v-for="(item,index) in phoneUser" :key="index">
- <view class="tit">{{item.name}}</view>
- <view class="send" @click="sendpop(item.id)">发送</view>
- </view>
- </view>
- </view>
- </u-popup>
- </view>
- <!-- <Loading :loaded="loadend" :loading="loading"></Loading> -->
- <!--暂无优惠券-->
- <view v-if="couponsList.length == 0 && page > 1" class="no-data-box" >
- <image src="https://kntobs.jnmyunl.com/shop/images/no_data.png" mode="aspectFit"></image>
- <view class="empty-title">暂无数据</view>
- </view>
- </view>
- </template>
- <script>
- import { getCompanyCouponIssueList, receive,sendCoupon,searchUser} from '@/api/coupon'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import Loading from '@/components/Loading'
- export default {
- name: 'getCoupon',
- components: {
- Loading,
- },
- props: {},
- mixins: [MescrollMixin],
- data: function() {
- return {
- limit: 10,
- couponsList: [],
- loading: false,
- loadend: false,
- page: 1,
- limit: 10,
- popshow:false,
- keyword:'',
- detailsid:{},
- CompanyUserInfo:{},
- user:{},
- phoneUser:{},
- upOption: {
- onScroll:true,
- use: true, // 是否启用上拉加载; 默认true
- page: {
- num:0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 7 // 每页数据的数量,默认10
- },
- noMoreSize: 7, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- icon:'https://kntobs.jnmyunl.com/shop/images/no_data.png',
- tip: '暂无数据'
- },
- textNoMore:'已经到底了'
- },
- mescroll:null,
- downOption:{
-
- },
- searchValue:'',
- }
- },
- onLoad(options) {
- },
- mounted: function() {
-
- },
- onShow() {
- this.CompanyUserInfo=uni.getStorageSync('CompanyUserInfo');
- this.user=uni.getStorageSync('userInfo');
- },
- // onReachBottom() {
- // !this.loading && this.getCompanyCouponIssueList()
- // },
- methods: {
- doSearch(){
- console.log(this.searchValue)
- this.mescroll.resetUpScroll()
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll()
- },
- searchkey(value){
- console.log(this.keyword);
- searchUser({value:this.keyword}).then(res=>{
- if(res.code==200){
- this.phoneUser=res.rows
- console.log(res)
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- },
- close(){
- this.popshow=false
- },
- show(item){
- uni.navigateTo({
- url: '../couponDetails?id=' +item.id
- })
- },
- sendpop(id){
- this.sendCoupon(id)
- },
- sendCoupon(id){
- const data={
- id:this.detailsid.id,
- companyUserId:this.CompanyUserInfo.userId,
- companyId:this.CompanyUserInfo.companyId,
- setSendUserId:this.user.userId,
- userId:id,
- companyUserToken:uni.getStorageSync('CompanyUserToken')
- }
- sendCoupon(data).then(res=>{
- if(res.code==200){
- uni.showToast({
- icon:'none',
- title: '发送成功!',
- });
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- })
- },
- showpop(item){
- this.popshow=true
- this.detailsid=item
- console.log(item)
- },
- upCallback(page) {
- if (this.loading) return //阻止下次请求(false可以进行请求);
- if (this.loadend) return //阻止结束当前请求(false可以进行请求);
- this.loading = true
- var that = this;
- let q = {page: page.num, pageSize: page.size,couponName:this.searchValue,couponType:2 }
- getCompanyCouponIssueList(q).then(res => {
- if(res.code==200){
- //设置列表数据
- this.loading = false
- if ( page.num == 1) {
- that.couponsList = res.data.list;
-
- } else {
- that.couponsList = that.couponsList.concat(res.data.list);
-
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.couponsList = null;
- that.mescroll.endErr();
- }
- // this.loading = false
- // this.couponsList.push.apply(this.couponsList, res.data.list)
- // this.loadend = res.data.list.length < this.limit //判断所有数据是否加载完成;
- // this.page = this.page + 1
- })
- },
- },
- }
- </script>
- <style lang="less" scoped>
- .search-cont{
- padding: 16upx 30upx;
- background-color: #FFFFFF;
- .inner{
- box-sizing: border-box;
- width: 100%;
- height: 72upx;
- background: #F7F7F7;
- border-radius: 36upx;
- display: flex;
- align-items: center;
- padding: 0 30upx;
- .icon-search{
- width: 28upx;
- height: 28upx;
- margin-right: 20upx;
- }
- input{
- height: 60upx;
- line-height: 60upx;
- flex: 1;
- }
- }
- }
- .popbox{
- padding: 20rpx;
- height: 400rpx;
- .poplist{
- margin-top: 20rpx;
- .list-box{
- display: flex;
- justify-content: space-between;
- align-items: center;
- .tit{
- font-size:24rpx;
- color: #666;
- }
- .send{
- width: 122rpx;
- height: 50rpx;
- line-height: 50rpx;
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- text-align: center;
- border-radius: 32upx;
- margin-left: 15upx;
- border: 1px solid #2BC7B9;
- color: #2BC7B9;
- }
- }
- }
- }
- .pop-tit{
- display: flex;
- padding: 20rpx;
- .poptitle{
- flex: 1;
- text-align: center;
- }
- }
- page {
- background-color: #f5f5f5;
- }
- .container {
- padding-bottom: env(safe-area-inset-bottom);
- }
- .top-fixed{
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 99999;
- }
- .tui-coupon-list {
- width: 100%;
- padding: 0 25rpx;
- box-sizing: border-box;
- }
- .tui-coupon-banner {
- width: 100%;
- }
- .tui-coupon-item {
- width: 100%;
- height: 210rpx;
- position: relative;
- display: flex;
- align-items: center;
- padding-right: 30rpx;
- box-sizing: border-box;
- overflow: hidden;
-
- }
- .tui-coupon-bg {
- width: 100%;
- height: 210rpx;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- }
- .tui-coupon-sign {
- height: 110rpx;
- width: 110rpx;
- position: absolute;
- z-index: 9;
- top: -30rpx;
- right: 40rpx;
- }
- .tui-coupon-item-left {
- width: 218rpx;
- height: 210rpx;
- position: relative;
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- flex-shrink: 0;
- }
- .tui-coupon-price-box {
- display: flex;
- color: #e41f19;
- align-items: flex-end;
- }
- .tui-coupon-price-sign {
- font-size: 30rpx;
- }
- .tui-coupon-price {
- font-size: 70rpx;
- line-height: 68rpx;
- font-weight: bold;
- }
- .tui-price-small {
- font-size: 58rpx !important;
- line-height: 56rpx !important;
- }
- .tui-coupon-intro {
- background: #f7f7f7;
- padding: 8rpx 10rpx;
- font-size: 26rpx;
- line-height: 26rpx;
- font-weight: 400;
- color: #666;
- margin-top: 18rpx;
- }
- .tui-coupon-item-right {
- flex: 1;
- height: 210rpx;
- position: relative;
- z-index: 2;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-left: 24rpx;
- box-sizing: border-box;
- overflow: hidden;
- }
- .tui-coupon-content {
- width: 82%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .tui-coupon-title-box {
- display: flex;
- align-items: center;
- }
- .tui-coupon-btn {
- padding: 6rpx;
- background: #ffebeb;
- color: #e41f19;
- font-size: 25rpx;
- line-height: 25rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- transform: scale(0.9);
- transform-origin: 0 center;
- border-radius: 4rpx;
- flex-shrink: 0;
- }
- .tui-color-grey {
- color: #888 !important;
- }
- .tui-bg-grey {
- background: #f0f0f0 !important;
- color: #888 !important;
- }
- .tui-coupon-title {
- width: 100%;
- font-size: 26rpx;
- color: #333;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .tui-coupon-rule {
- padding-top: 52rpx;
- }
- .tui-rule-box {
- display: flex;
- align-items: center;
- transform: scale(0.8);
- transform-origin: 0 100%;
- }
- .tui-padding-btm {
- padding-bottom: 6rpx;
- }
- .tui-coupon-circle {
- width: 8rpx;
- height: 8rpx;
- background: rgb(160, 160, 160);
- border-radius: 50%;
- }
- .tui-coupon-text {
- font-size: 28rpx;
- line-height: 28rpx;
- font-weight: 400;
- color: #666;
- padding-left: 8rpx;
- white-space: nowrap;
- }
- .tui-top20 {
- margin-top: 20rpx;
- }
- .tui-coupon-title {
- font-size: 28rpx;
- line-height: 28rpx;
- }
- .tui-coupon-radio {
- transform: scale(0.7);
- transform-origin: 100% center;
- }
- .tui-btn-box {
- position: absolute;
- right: 20rpx;
- bottom: 40rpx;
- z-index: 10;
- .btn{
- width: 155upx;
- height: 64upx;
- line-height: 64upx;
- font-size: 26upx;
- font-family: PingFang SC;
- font-weight: 500;
- text-align: center;
- border-radius: 32upx;
- margin-left: 15upx;
- &.cancel{
- border: 1px solid #2BC7B9;
- color: #2BC7B9;
- margin-bottom: 8rpx;
- }
- &.receive{
- background: #2BC7B9;
- color: #FFFFFF;
- }
- }
- }
- </style>
|