recordTrade2.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="scoped-box">
  3. <view class="op" v-for="(item, index) in stepFieldList" :key="index" @click="stepHandle(item)">
  4. <view class="p1">{{ item.comment }}</view>
  5. <view class="p2">{{ allData[item.field+'_at_format'] }}</view>
  6. <image mode="widthFix" v-if="allData[item.field]" src="/static/icon_g_check01_old.png" class="i" />
  7. <image mode="widthFix" v-else src="/static/icon_g_check02_old.png" class="i" />
  8. </view>
  9. <u-button type="primary" @click="submitHandle">完成</u-button>
  10. </view>
  11. </template>
  12. <script>
  13. import { arrToObj } from '@/utils'
  14. export default {
  15. data() {
  16. return {
  17. trade_id: null,
  18. stepFieldList: [],
  19. allData: {},
  20. };
  21. },
  22. onLoad(data) {
  23. this.trade_id = data.id
  24. // this.getData()
  25. },
  26. onShow() {
  27. if (this.trade_id) {
  28. this.getData()
  29. }
  30. },
  31. created() {
  32. },
  33. // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
  34. onReady() {
  35. },
  36. methods: {
  37. getData () {
  38. uni.api.cust.apitradestepinfo({trade_id:this.trade_id}).then(res =>{
  39. this.allData = res || {}
  40. this.stepFieldList = res.step_field || []
  41. })
  42. },
  43. stepHandle (item) {
  44. if (this.allData[item.field]) {
  45. return
  46. }
  47. uni.$msgConfirm(`确定勾选${item.comment}吗?`, () => {
  48. uni.api.cust.apitradestepedit({
  49. trade_id: this.trade_id,
  50. field: item.field,
  51. value: 1,
  52. }).then(res =>{
  53. this.getData()
  54. })
  55. })
  56. //
  57. },
  58. submitHandle() {
  59. uni.redirectTo({
  60. url: `/pages/trade/record?id=${this.trade_id}`
  61. })
  62. }
  63. }
  64. };
  65. </script>
  66. <style lang="scss">
  67. .scoped-box {
  68. padding: 20rpx;
  69. background-color: #ffffff;
  70. .op {
  71. border-bottom: 1PX solid #dcdcdc;
  72. padding: 40rpx 10rpx;
  73. position: relative;
  74. .p1 {
  75. font-size: 32rpx;
  76. color: #333;
  77. font-weight: bold;
  78. }
  79. .p2 {
  80. position: absolute;
  81. font-size: 24rpx;
  82. color: #999;
  83. bottom: 10rpx;
  84. left: 10rpx;
  85. }
  86. .i {
  87. position: absolute;
  88. top: 36rpx;
  89. right: 30rpx;
  90. width: 40rpx;
  91. height: 40rpx;
  92. }
  93. }
  94. }
  95. </style>