#
whycq
2023-11-20 362e2b6ce29bfa2e493112d133003029e788bf79
pages/business/pricing/contract.vue
@@ -14,7 +14,24 @@
               <uni-icons type="arrowdown" color="#333333" size="20" />
            </view>
         </block>
       </uni-nav-bar>
      </uni-nav-bar>
      <view class="main-box">
         <view class="box" v-for="item in list" @click="goDetl(item)">
            <view style="display: flex;">
               <view class="box-title" style="flex: 1;">{{item.name}}</view>
               <view class="box-time">{{item.createTime$}}</view>
            </view>
            <view class="box-item">客户:{{item.customer}}</view>
            <!-- <view class="box-item">状态:{{item.businessTripDays$}}</view> -->
            <view style="display: flex;">
            <view class="box-item" style="flex: 1;">状态:{{item.status$}}</view>
               <!-- <view class="box-item" style="flex: 1;">同行人:{{item.businessPeers}}</view> -->
               <view class="box-settle" :style="item.bgcolor">{{item.settle$}}</view>
            </view>
         </view>
      </view>
   </view>
</template>
@@ -28,13 +45,13 @@
               id: 0,
               type: ''
            },
            falg: true
            falg: true,
            list: []
         }
      },
      onShow() {
         let that = this
         uni.$on('isRefresh',function(data){
            console.log(data);
            that.user.username = data.title
            that.user.id = data.id
            that.user.type = data.key
@@ -46,8 +63,52 @@
         if (this.falg) {
            this.getDetail()
         }
         this.getContractList()
      },
      methods: {
         getContractList() {
            let _this = this
            let param = {curr:1,limit:16,dept_id: 0,user_id: 67}
            if (_this.user.type == 'user_id') {
               param = {curr:1,limit:16,user_id: _this.user.id}
            } else if(_this.user.type == 'dept_id') {
               param = {curr:1,limit:16,dept_id: _this.user.id}
            } else {
               param = {curr:1,limit:16}
            }
            uni.request({
               url: `${_this.baseUrl}/contract/list/auth`,
               header: { 'token': uni.getStorageSync('token') },
               data: param,
               success(res) {
                  res = res.data
                  console.log(res);
                  // return
                  if (res.code === 200) {
                     for (let k of res.data.records) {
                        if (k.settle >= 2) {
                           k['bgcolor'] = 'color: #12d489'
                        } else if (k.settle == 1) {
                           k['bgcolor'] = 'color: #ffbd67'
                        } else if (k.settle == 0) {
                           k['bgcolor'] = 'color: #1e9cf0'
                        }
                     }
                     _this.list = res.data.records
                  }
               }
            })
         },
         goDetl(e) {
            uni.navigateTo({
               url: '/pages/business/pricing/contractDetl',
               success: function(res) {
                  res.eventChannel.emit('contractDetl', {
                     data: e
                  })
               }
            })
         },
         async getDetail() {
            let res = await user.getDetail()
            console.log(res);
@@ -80,6 +141,58 @@
</script>
<style>
   .flex-row {
      display: flex;
   }
   .flex-col {
      display: flex;
      flex-direction: column;
   }
   .main-box {
      /* margin: 16rpx; */
      /* background-color: #FFF; */
      border-radius: 20rpx;
      padding: 8rpx;
   }
   .box {
      margin: 16rpx 8rpx;
      /* height: 200px; */
      box-shadow: 0 0 5px #dddddd;
      background-color: #FFF;
      padding: 16rpx 32rpx;
      position: relative;
      border-radius: 20rpx;
      font-size: 24rpx;
      color: #bdbdbd;
   }
   .box-flag {
      position: absolute;
      right: 0;
      top: 10rpx;
      background-color: #74B9E9;
      padding: 6rpx;
      font-size: 10rpx;
      color: #FFF;
   }
   .box-time {
      color: #bdbdbd;
   }
   .box-settle {
      font-size: 26rpx;
      /* font-weight: bold; */
   }
   .box-title {
      font-size: 28rpx;
      font-weight: bold;
      color: #000;
   }
   .box-single-row {}
</style>