<template>
  <view class="ctr">
    <view class="form-group">
      <view class="textarea">
        <view class="title flex-l">备注信息</view>
        <view class="value">
          <textarea maxlength="500" :disable-default-padding="true" class="input-textarea" v-model="submitData.worker_remark"  placeholder-class="placeholder-class" placeholder="您可在此处输入备注信息，该备注信息仅自己可见（500字以内）"/>
        </view>
      </view>
    </view>
    <me-empty-space height="376"></me-empty-space>
    <view class="bottom">
      <me-button @click="submit()" text="保 存" width="686rpx" icon-type="icon-checkbox-circle" margin-top="32rpx"></me-button>
    </view>
  </view>
</template>

<script setup>

import MeEmptySpace from "../../components/me-empty-space/me-empty-space.vue";
import MeButton from "../../components/me-button/me-button.vue";
import {ref, reactive} from 'vue'
import {onLoad} from '@dcloudio/uni-app'
import api from "../../api/api";
import {throttle} from "../../utils/throttle";

//提交
const submit = throttle(() => {
  uni.showLoading({
    title: '保存中'
  });

  submitData.order_dispatch_id = orderDispatchId.value
  api.saveWorkerRemark(submitData).then(() => {
    uni.hideLoading();
    uni.showToast({
      title: '已保存',
      icon: "success"
    })
  }).catch(() => {})
})

const orderDispatchId = ref(null)
onLoad((params) => {
  orderDispatchId.value = params.id
  submitData.worker_remark = params.worker_remark
})

//提交数据
const submitData = reactive({
  worker_remark: '',
})

</script>

<style lang="scss" scoped>
.ctr {
  padding: 0 32rpx;
  box-sizing: border-box;
  height: 100vh;
  .value {
    height: 300rpx !important;
  }
  .bottom {
    width: 100%;
    padding-top: 20rpx;
    padding-bottom: 68rpx;
    background: var(--pageBgColor);
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
  }
}
</style>













