123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <template>
- <view class="scoped-box">
- <view class="op" v-for="(item, index) in stepFieldList" :key="index" @click="stepHandle(item)">
- <view class="p1">{{ item.comment }}</view>
- <view class="p2">{{ allData[item.field+'_at_format'] }}</view>
- <image mode="widthFix" v-if="allData[item.field]" src="/static/icon_g_check01_old.png" class="i" />
- <image mode="widthFix" v-else src="/static/icon_g_check02_old.png" class="i" />
- </view>
- <u-button type="primary" @click="submitHandle">完成</u-button>
- </view>
- </template>
- <script>
- import { arrToObj } from '@/utils'
- export default {
- data() {
- return {
- trade_id: null,
- stepFieldList: [],
- allData: {},
- };
- },
- onLoad(data) {
- this.trade_id = data.id
- // this.getData()
- },
- onShow() {
- if (this.trade_id) {
- this.getData()
- }
- },
- created() {
- },
- // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
- onReady() {
-
- },
- methods: {
- getData () {
- uni.api.cust.apitradestepinfo({trade_id:this.trade_id}).then(res =>{
- this.allData = res || {}
- this.stepFieldList = res.step_field || []
- })
- },
- stepHandle (item) {
- if (this.allData[item.field]) {
- return
- }
- uni.$msgConfirm(`确定勾选${item.comment}吗?`, () => {
- uni.api.cust.apitradestepedit({
- trade_id: this.trade_id,
- field: item.field,
- value: 1,
- }).then(res =>{
- this.getData()
- })
- })
- //
- },
- submitHandle() {
- uni.redirectTo({
- url: `/pages/trade/record?id=${this.trade_id}`
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .scoped-box {
- padding: 20rpx;
- background-color: #ffffff;
- .op {
- border-bottom: 1PX solid #dcdcdc;
- padding: 40rpx 10rpx;
- position: relative;
- .p1 {
- font-size: 32rpx;
- color: #333;
- font-weight: bold;
- }
- .p2 {
- position: absolute;
- font-size: 24rpx;
- color: #999;
- bottom: 10rpx;
- left: 10rpx;
- }
- .i {
- position: absolute;
- top: 36rpx;
- right: 30rpx;
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- </style>
|