123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <template>
- <view>
- <!-- #ifdef MP-ALIPAY -->
- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="选择盲票天使" leftIconSize="0">
- </u-navbar>
- <!-- #endif -->
- <!-- #ifndef MP-ALIPAY -->
- <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="选择盲票天使"></u-navbar>
- <!-- #endif -->
- <view class="coupon-title">
- <u-search placeholder="请输入名字或工号" v-model="searchValue" @blur="pageList()" :showAction="false"></u-search>
- </view>
- <view class="coupon-list">
- <u-radio-group v-model="radiovalue1" placement="column" @change="changeChechk()">
- <view class="flex coupon-list-item" v-for="(item,index) in list" :key="index">
- <view class="block">
- <view class="title">{{item.name}}</view>
- <text>工号:{{item.workNo}}</text>
- </view>
- <view class="uradio">
- <u-radio :customStyle="{ marginBottom: '8px' }" :name="item.channelId" activeColor="#E96737"
- size="24">
- </u-radio>
- </view>
- </view>
- <u-loadmore :line="true" v-if="list.length>20" :status="status" :loading-text="'努力加载中'"
- :nomore-text="'已经到底了'" />
- </u-radio-group>
- </view>
- <view class="footer-fixed">
- <view class="flex btn">
- <button type="default" @click="exchange">确认</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import env from '../../config/env.js'
- import appId from '@/config/appId.js'
- import $http from '@/utils/request.js'
- export default {
- data() {
- return {
- pageNum: 1,
- total: 0,
- list: [],
- radiovalue1: '', //选中项的下标
- channelId: '', //选中项的id
- id: '', //门店的channelId
- status: 'nomore', //上拉刷新状态
- searchValue: '', //搜索
- };
- },
- onShow() {
- this.pageList()
- },
- onLoad(opthios) {
- if (opthios.channelId) {
- this.id = opthios.channelId
- this.channelId = opthios.index
- this.radiovalue1 = Number(opthios.index)
- }
- },
- methods: {
- pageList() {
- this.list = []
- this.pageNum = 1
- this.getList()
- },
- getList() {
- let _this = this
- $http.post(`/api/v1/mp/channel/promoter/list?pageNum=${_this.pageNum}&pageSize=20`, {
- channelId: this.id,
- searchValue: this.searchValue,
- }).then(
- res => {
- if (res.code == 0) {
- this.total = res.total
- this.list = [...this.list, ...res.rows]
- }
- }).catch(() => {})
- },
- // 点击切换事件
- changeChechk(e) {
- if (this.channelId == e) {
- this.radiovalue1 = -1
- this.channelId = ''
- return
- } else {
- this.channelId = e
- return
- }
- },
- // 点击确认事件
- exchange() {
- let promoters = {}
- for (var i = 0; i < this.list.length; i++) {
- if (this.list[i].channelId == this.channelId) {
- promoters = {
- channelId: this.channelId,
- name: this.list[i].name,
- workNo: this.list[i].workNo,
- }
- }
- }
- uni.$emit('promoters', promoters)
- uni.navigateBack({
- delta: 1
- })
- }
- },
- onReachBottom() {
- // 判断是否有数据
- if (this.total < this.pageNum * 20) return;
- this.status = 'loading';
- ++this.pageNum
- if (this.total < this.pageNum * 20) this.status = 'nomore';
- else this.status = 'loading';
- this.getList()
- },
- }
- </script>
- <style lang="scss" scoped>
- .coupon {
- &-title {
- position: fixed;
- z-index: 10;
- width: 100%;
- padding: 24rpx 32rpx;
- background-color: #FFFFFF;
- }
- &-list {
- margin-top: 110rpx;
- &-item {
- justify-content: space-between;
- padding: 20rpx 50rpx;
- background-color: #FFFFFF;
- margin-bottom: 20rpx;
- background-size: 100%;
- .block {
- color: #333;
- .title {
- line-height: 60rpx;
- font-size: 32rpx;
- }
- text {
- font-size: 26rpx;
- }
- }
- .uradio {
- position: absolute;
- right: 40rpx;
- }
- .circle {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- border: 1px solid;
- }
- .action {
- width: 30rpx;
- height: 30rpx;
- border-radius: 50%;
- background-color: $uni-bg-color;
- }
- }
- }
- }
- .footer-fixed {
- position: fixed;
- bottom: var(--window-bottom);
- left: 0;
- right: 0;
- z-index: 11;
- box-shadow: 0 -4rpx 40rpx 0 rgba(151, 151, 151, 0.24);
- background: #fff;
- // 设置ios刘海屏底部横线安全区域
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- .btn {
- padding: 20rpx 0;
- ::v-deep button {
- width: 441rpx;
- height: 88rpx;
- line-height: 88rpx;
- font-size: 36rpx;
- color: #fff;
- background-color: #F9822C;
- border: none;
- border-radius: 44rpx;
- }
- }
- }
- </style>
|