123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <template>
- <view class="content">
- <view class="row1">
- <view class="title">
- 圈子名称
- </view>
- <u--input placeholder="请输入圈子名称" border="none" v-model="formData.circleName" @change="change"
- :customStyle="custom"></u--input>
- </view>
- <view class="flex justify-space-between select-card">
- <view class="title">
- 选择名片
- </view>
- <view style="font-size:12px;padding-right:20rpx;" class='flex align-item-center' @click="cardShow">
- {{formData.cardBusiness}}
- <u-icon name="arrow-right" size="12"></u-icon>
- </view>
- </view>
- <view class="row1">
- <view class="flex flex-between" style="margin-top: 20rpx;">
- <view class="title">圈子标签</view>
- <uni-icons type="plus-filled" @click="add(item)" size="40" color="#112253"></uni-icons>
- </view>
- <view class="">
- <view v-for="(item,index) in labelList":key="index">
- <view>
- <view class="flex">
- <u-input placeholder="请输入圈子标签,2-6个字" border="none" v-model="item.labelName" @change="change"
- :customStyle="custom">
- <template slot="suffix">
- <image src="../../static/imgs/mySet/del.png" mode="widthFix" style="width: 40rpx;height: auto;" @click="subtract(index)"></image>
- </template>
- </u-input>
- </view>
- <!-- <uni-icons type="minus-filled" @click="subtract(index)" size="40"></uni-icons> -->
- </view>
- </view>
- </view>
- </view>
- <view class="">
- <button type="default" @click="submit" class="submit">提交</button>
- </view>
- <u-picker :immediateChange ="true" keyName="cardBusiness" title="选择名片" @close="show=false"
- @cancel="show=false" closeOnClickOverlay @confirm="cardConfirm" :show="show" :columns="cardList"></u-picker>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- var that;
- export default {
- data() {
- return {
- custom: {
- "margin-top":"20rpx",
- "background": "#fff",
- "border-radius": "20rpx",
- "padding":"20rpx"
- },
- value: '',
- show:false,
- cardList:[],
- labelList: [{
- labelName: '',
- },
- {
- labelName: '',
- }
- ],
- list:[],
- formData: {
- circleName: '',
- circleLabel: [],
- commonId: '',
- cardBusiness:''
- },
- currectData:{}
- };
- },
- onLoad() {
- that = this
- this.userInfo = uni.getStorageSync("userInfo")
- this.formData.commonId = this.userInfo.id
- },
- onShow() {
- uni.showLoading({
- title: '数据加载中'
- })
- this.$request.baseRequest('admin.unimall.cardManagementInfo', 'list', {
- commonId: uni.getStorageSync("userInfo").id
- }, failres => {
- uni.showToast({
- icon:"none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- uni.hideLoading()
- this.cardList = [res.data.items]
- this.list = res.data.items
- this.formData.cardBusiness = res.data.items[0].cardBusiness
- this.formData.cardId=res.data.items[0].id
- })
- },
- methods: {
- cardConfirm(e){
- console.log(e)
- this.formData.cardBusiness=e.value[0].cardBusiness
- this.formData.cardId=e.value[0].id
- this.show=false
- console.log(this.labelList)
- },
- cardShow(){
- if(this.list.length>0){
- this.show=true
- }else{
- uni.showToast({
- icon:"none",
- title: '暂无名片',
- duration: 2000
- });
- }
-
- },
- change(e) {
- console.log('change', e);
- },
- submit() {
- this.formData.circleLabel = []
- if (!this.formData.circleName) {
- uni.showToast({
- icon:"none",
- title: '圈子名称不能为空!',
- duration: 2000
- });
- return
- }
- for (let i = 0; i < this.labelList.length; i++) {
- if (!this.labelList[i].labelName) {
- uni.showToast({
- icon:"none",
- title: '标签内容不能为空!',
- duration: 2000
- });
- return
- }
- if (this.labelList[i].labelName.length > 6 || this.labelList[i].labelName.length < 2) {
- uni.showToast({
- icon:"none",
- title: '标签内容2-6个字!',
- duration: 2000
- });
- return
- }
- this.formData.circleLabel.push(this.labelList[i].labelName)
- }
- this.formData.circleLabel = this.formData.circleLabel.toString()
- this.$request.baseRequest('admin.unimall.circleManagementInfo', 'add', {
- circleManagementInfo: JSON.stringify(this.formData)
- }, failres => {
- uni.showToast({
- icon:"none",
- title: failres.errmsg,
- duration: 3000
- });
- uni.hideLoading()
- }).then(res => {
- uni.showToast({
- icon:"none",
- title: '信息审核中,请留意消息通知!',
- duration: 2000
- });
- })
- setTimeout(() => {
- uni.navigateBack()
- }, 3000)
- },
- add() {
- if (this.labelList.length > 5) {
- uni.showToast({
- icon:"none",
- title: '标签数量2-6个!',
- duration: 2000
- });
- return
- }
- this.labelList.push({
- labelName: '',
- })
- },
- subtract(index) {
- if (this.labelList.length < 3) {
- uni.showToast({
- icon:"none",
- title: '标签数量2-6个!',
- duration: 2000
- });
- return
- }
- this.labelList.splice(index, 1)
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- padding: 20rpx;
- .title {
- font-size: 32rpx;
- font-weight: bold;
- color: #1A1A1A;
- }
- }
- .submit{
- position: fixed;
- bottom: 100rpx;
- background-color:#112253 ;
- color: #fff;
- width: calc(100% - 40rpx);
- }
- .select-card{
- background:#fff;padding:20rpx 0 20rpx 20rpx;
- margin:10rpx 0;
- border-radius: 20rpx;
-
- }
- </style>
|