| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <view>
- <!-- 领取客户 -->
- <u-modal :show="showCollectionModel" :showCancelButton="true" @confirm="confirmCollection()"
- @cancel="closeMoveInModel()" title="领取客户">
- <view class="slot-content" style="width: 100%">
- <view class="flex">
- <text>申请说明:</text>
- <u-textarea v-model="openSeaObj.applyRemark" placeholder="请输入申请说明" height="180" :count="true" maxlength="500">
- </u-textarea>
- </view>
- </view>
- </u-modal>
- <u-notify ref="uNotify"></u-notify>
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- import customerApi from '../../../api/customer'
- import to from 'await-to-js'
- export default {
- props: {
- position: {
- default: () => {},
- required: true,
- }
- },
- data() {
- return {
- showCollectionModel: false,
- openSeaObj: {
- applyRemark: '',
- receive: '1',
- ids: [],
- },
- }
- },
- computed: {
- ...mapGetters(['userId', 'username']),
- },
- methods: {
- open(id) {
- this.openSeaObj.ids = [id]
- this.showCollectionModel = true
- },
- // 领用
- async confirmCollection() {
- // this.openSeaObj.salesId = this.userId
- // this.openSeaObj.salesName = this.username
- if (!this.openSeaObj.applyRemark) {
- this.$refs.uNotify.show({
- top: this.position.height + this.position.paddingTop + 10,
- type: 'warning',
- message: '请输入领用原因',
- duration: 1000 * 3,
- })
- return
- }
- let params = {
- ...this.openSeaObj,
- salesId: this.userId,
- salesName: this.username
- }
- const [err, res] = await to(customerApi.collection(params))
- if (err) return this.closeMoveInModel()
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'loading',
- message: '客户领用成功',
- complete: () => {
- this.showCollectionModel = false
- this.$emit('fetchList')
- },
- })
- } else {
- this.closeMoveInModel()
- }
- },
- // 关闭移入公海模块
- closeMoveInModel() {
- this.openSeaObj.ids = []
- this.openSeaObj.applyRemark = ''
- this.showCollectionModel = false
- },
- },
- }
- </script>
- <style></style>
|