123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="message-detail-index">
- <view class="message-detail-content">
- <text v-if="detail.id">{{detail.message}}</text>
- </view>
- <view class="hui-button-box" v-if="dataDetail.status === 1">
- <view class="hui-button hui-button-light" @click="btnClick('拒绝',3)">
- 拒绝
- </view>
- <view class="hui-button" @click="btnClick('同意',2)">
- 同意
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getMessageDetailById,
- bindProject,
- getCustomerDetailById,
- updateCustomer,
- getAgentDetailById,
- updateAgent
- } from '@/request/api/message.js'
- export default {
- data() {
- return {
- messageId: '',
- detail: {},
- dataDetail: {}
- }
- },
- onLoad(body) {
- this.messageId = body.id;
- this.init();
- },
- methods: {
- init() {
- getMessageDetailById(this.messageId).then(res => {
- if (res.code == 200) {
- this.detail = res.data;
- this.detail = Object.assign(this.detail, JSON.parse(this.detail.json));
- this.initDetail();
- }
- })
- },
- initDetail() {
- if (this.detail.identityId === 1) { //客户
- getCustomerDetailById(this.detail.dataId).then(res => {
- if (res.code == 200) {
- this.dataDetail = res.data;
- }
- })
- } else if (this.detail.identityId === 2) { //经纪人
- getAgentDetailById(this.detail.dataId).then(res => {
- if (res.code == 200) {
- this.dataDetail = res.data;
- }
- })
- }
- },
- btnClick(msg, type) {
- uni.showModal({
- title: '有极提示',
- content: '是否' + msg + '加入该项目',
- success: (res) => {
- if (res.confirm) {
- if (this.detail.identityId === 1) { //客户
- updateCustomer({
- id: this.dataDetail.id,
- status: type
- }).then(res => {
- if (res.code == 200) {
- if (type === 2) return this.operationProject();
- this.initDetail();
- this.$toast('操作成功');
- }
- })
- } else if (this.detail.identityId === 2) { //经纪人
- updateAgent({
- id: this.dataDetail.id,
- status: type
- }).then(res => {
- if (res.code == 200) {
- if (type === 2) return this.operationProject();
- this.initDetail();
- this.$toast('操作成功');
- }
- })
- }
- }
- }
- });
- },
- operationProject() {
- let postData = {
- organizationId: this.detail.organizationId,
- projectId: this.detail.projectId,
- userId: this.$store.getters.user.userId,
- identityId: this.detail.identityId
- }
- if (this.detail.identityId === 1) { //客户
- postData['clientId'] = this.detail.dataId
- } else if (this.detail.identityId === 2) { //经纪人
- postData['agentId'] = this.detail.dataId
- }
- bindProject(postData).then(res => {
- if (res.code === 200) {
- this.$toast('操作成功');
- this.initDetail();
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .message-detail-index {
- background: $uni-white;
- padding: 20rpx;
- padding-bottom: 0;
- margin: 20rpx 30rpx;
- border-radius: 10rpx;
- .message-detail-content {
- min-height: 200rpx;
- padding-bottom: 40rpx;
- }
- .message-btn-box {
- width: 100%;
- display: flex;
- height: 80rpx;
- align-items: center;
- border-top: 1px solid $uni-border-3;
- .line {
- width: 1px;
- height: 40rpx;
- background: $uni-border-3;
- }
- .message-btn {
- text-align: center;
- flex: 1;
- }
- .red {
- color: $uni-error;
- }
- .primary {
- color: $uni-primary;
- }
- }
- }
- </style>
|