1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import { httpInfo } from "../../../api/serverOrder";
- import {
- statusType,
- status_options
- } from "../../../utils/statusTypeOptions";
- import { convertTime } from "../../../utils/util"
- import {
- createStoreBindings
- } from 'mobx-miniprogram-bindings'
- import {
- store
- } from "../../../store/index";
- Page({
- data: {
- loading: true,
- id: "",
- status_options,
- statusType,
- items: null,
- },
- onLoad(options: object) {
- this.storeBindings = createStoreBindings(this, {
- store,
- fields: ["token"],
- actions: ["setStore"],
- });
- const {
- id
- } = options
- this.setData({
- id
- })
- this.getResourceDetails()
- },
- onUnload() {
- this.storeBindings.destroyStoreBindings();
- },
- phoneOpen() {
- wx.makePhoneCall({
- phoneNumber: '400-9121-211' //仅为示例,并非真实的电话号码
- })
- },
- async getResourceDetails() {
- const {
- id,
- status_options
- } = this.data
- const {
- code,
- data
- } = await httpInfo({
- reqCode: id
- })
- if (code === 1) {
- let str = ""
- const {
- req_demand_name
- } = data
- req_demand_name.forEach((s, i) => {
- str += i === 0 ? s.name : '+' + s.name
- })
- this.setData({
- items: {
- ...data,
- status_name: (status_options.find((item) => item.value == String(data.status)) || {}).label ||
- '--',
- act_time_day: convertTime(data.act_time, 'MM.DD'),
- act_time_end_day: convertTime(data.req_endtime, 'MM.DD'),
- req_demand_name_label: str,
- },
- loading: false
- })
- } else {
- await this.setStore("", "")
- this.setData({
- loading: false,
- })
- }
- },
- })
|