Parcourir la source

始宁农业管理后台:农户管理-农户管理

panyong il y a 1 an
Parent
commit
e4ae0f359f

+ 7 - 4
htmldev/shiningWxMini/components/wxs/index.wxs

@@ -11,6 +11,10 @@ function datePolyfill(val) {
  * @returns {string}
  */
 function formatTs(ts, type) {
+  if (isNaN(ts) || !ts) {
+    return ''
+  }
+
   var date = getDate(ts)
   var obj = {
     YYYY: date.getFullYear(),
@@ -22,10 +26,6 @@ function formatTs(ts, type) {
     week: WEEK[date.getDay()]
   }
 
-  if (isNaN(ts)) {
-    return ''
-  }
-
   if (type === 'hh:mm:ss') {
     return obj.HH + ':' + obj.mm + ':' + obj.ss
   }
@@ -40,6 +40,9 @@ function formatTs(ts, type) {
   if (type === 'YYYY-MM-DD hh:mm') {
     return obj.YYYY + '-' + obj.MM + '-' + obj.DD + ' ' + obj.HH + ':' + obj.mm
   }
+  if (type === 'YYYY-MM-DD') {
+    return obj.YYYY + '-' + obj.MM + '-' + obj.DD
+  }
 
   if (type === 'hh:mm zh') {
     return obj.HH + '小时' + obj.mm + '分'

+ 0 - 28
htmldev/shiningWxMini/pages/businessApply/api/index.js

@@ -1,33 +1,5 @@
 const { request } = require('../../../api/request')
 
-export const mockData = {
-  'user_name': '潘勇测试', // 用户姓名
-  'shop_name': '潘勇的店铺', // 店铺名称
-  'user_card': '4203221111222223333', // 身份证
-  'shop_phone': '13429176706', // 手机号码
-  'country_msg': '乡村信息用在哪里的', // 乡村信息
-  'user_code_url': [
-    {
-      formkey: 'user_code_url',
-      url: 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi63266e3610822.jpg'
-    }
-  ], // 微信二维码
-  'user_wechat_code': 'wxid_aabbccddee', // 微信号
-  'shop_img_url': [
-    {
-      formkey: 'shop_img_url',
-      url: 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi63266e68d77f0.png'
-    }
-  ], // 店铺图片地址
-  'shop_address': {
-    'longitude': 120.1689, // 经度
-    'latitude': 30.24, // 纬度
-    'address_name': '浙江省杭州市上城区高银街121号', // 起点位置名称
-    'name': '河坊街步行街'
-  }, // 店铺地址 {"address_name":"","name":"","latitude":30.24,"longitude":120.1689}
-  'shop_remark': '这个一个测试的备注信息' // 备注
-}
-
 /**
  * 申请商户
  * @returns {Promise<*>}

+ 0 - 48
htmldev/shiningWxMini/pages/businessGoodsEdit/api/index.js

@@ -1,53 +1,5 @@
 const { request } = require('../../../api/request')
 
-export const mockData = {
-  'product_img_url': [
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe57fa.jpg',
-      'formkey': 'product_rotation_img_list'
-    }
-  ], // 商品主图
-  'product_rotation_img_list': [
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe57fa.jpg',
-      'formkey': 'product_rotation_img_list'
-    },
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe51c4.jpg',
-      'formkey': 'product_rotation_img_list'
-    },
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffefa54.jpg',
-      'formkey': 'product_rotation_img_list'
-    },
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi6323230067e26.png',
-      'formkey': 'product_rotation_img_list'
-    }
-  ], // 商品轮播图
-  'product_detail_img_list': [
-    {
-      'url': 'https://tuotuoyinfu-oss.oss-cn-beijing.aliyuncs.com/images/user/bashi632322ffe57fa.jpg',
-      'formkey': 'product_rotation_img_list'
-    }
-  ], // 详情图
-  'product_title': '商品标题', // 商品标题
-  'product_desc': '商品简介', // 商品简介
-  'product_category_id': {
-    'category_name': '',
-    'id': '1'
-  }, // 分类ID
-  'product_brand_id': {
-    'brand_name': '',
-    'id': '1'
-  }, // 品牌ID
-  'product_spec': '10个没件', // 规格
-  'product_unit': '个', // 单位
-  'product_all_price': '100', // 批发价
-  'product_price': '88', // 零售价
-  'product_count': '100', // 库存
-  'product_sale_at': '预售' // 预售时间(0代表预售)
-}
 /**
  * 商品添加
  * @param obj

+ 12 - 0
htmldev/shiningWxMini/pages/businessInfo/api/index.js

@@ -0,0 +1,12 @@
+const { request } = require('../../../api/request')
+
+/**
+ * 商户信息编辑
+ * @returns {Promise<*>}
+ */
+export const modifyShopInfo = (obj) => request({
+  url: '/api/shop/info/modify',
+  method: 'POST',
+  data: obj,
+  showLoading: true
+})

+ 393 - 16
htmldev/shiningWxMini/pages/businessInfo/businessInfo.js

@@ -1,15 +1,64 @@
+const uploadJS = require('../../mixin/upload.js')
+const { isMobile } = require('../../utils/validate')
+const { formatTs, getTs } = require('../../utils/util')
+const { getShopInfo } = require('../businessHome/api/index')
+const { modifyShopInfo } = require('./api/index')
+const { YYYY, MM, DD } = formatTs((new Date()).getTime())
+const app = getApp()
+
 Page({
 
   /**
    * 页面的初始数据
    */
-  data: {},
-
+  data: {
+    form: {
+      'shop_name': '', // 店铺名称
+      'shop_img_url': [], // 店铺图片地址
+      'shop_address': {
+        'longitude': 0, // 经度
+        'latitude': 0, // 纬度
+        'address_name': '', // 起点位置名称
+        'name': ''
+      }, // 店铺地址
+      'user_name': '', // 必填 用户姓名
+      'user_card': '', // 必填 身份证
+      'shop_phone': '', // 必填 手机号码
+      'country_msg': '', // 必填 乡村信息
+      'user_wechat_code': '', // 微信号
+      'user_code_url': [], // 微信二维码
+      'company_name': '', // 企业名称
+      'company_created_at': '', // 企业成立日期
+      'company_hangye': '', // 所属行业
+      'company_jingying_fanwei': '', // 经营范围
+      'shop_jidi_guimo': '', // 基地规模
+      'shop_product_time': '', // 商品上架时间
+      'shop_shangbiao': [], // 注册商标
+      'shop_remark': '' // 备注
+    },
+    booLock: false,
+    userInfo: {},
+    booCountryMsg: false,
+    countryMsgList: [],
+    countryMsgInDefaultIndex: 0,
+    booCompanyCreatedAt: false,
+    minDate: new Date(1900, 0, 1).getTime(),
+    maxDate: new Date(YYYY, MM * 1 - 1, DD * 1).getTime(),
+    currentDate: new Date().getTime()
+  },
+  tempFormKey: '',
+  tempPostData: {},
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    this.bindCallBack()
+    app.fetchUserDataCallback = () => {
+      this.bindCallBack()
+    }
+    app.fetchSystemConfigCallback = () => {
+      this.setCountryMsgList()
+    }
   },
 
   /**
@@ -23,7 +72,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    this.setCountryMsgList()
   },
 
   /**
@@ -39,25 +88,353 @@ Page({
   onUnload() {
 
   },
+  bindCallBack() {
+    this.setData({
+      userInfo: app.globalData.userInfo
+    }, () => {
+      this.fetchShopDetail()
+    })
+  },
+  async fetchShopDetail() {
+    let temp = {}
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
+    try {
+      const { status, data, msg } = await getShopInfo()
+      if (status) {
+        const { shop_info } = data
+        console.log(shop_info)
+        for (let key in shop_info) {
+          let value = shop_info[key]
+          if ((Array.isArray(value) && value.length >= 1) || (Object.prototype.toString.call(value) === '[object Object]') || (typeof value === 'string' && value) || typeof value === 'number') {
+
+            if (key === 'user_code_url' || key === 'shop_img_url' || key === 'shop_shangbiao') {
+              value = [
+                {
+                  'formkey': key,
+                  'url': value
+                }
+              ]
+            }
+
+            if (key === 'country_msg') {
+              const index = this.data.countryMsgList.findIndex(item => item === value)
+              if (index > -1) {
+                temp['countryMsgInDefaultIndex'] = index
+              }
+            }
+
+            if (key === 'shop_address') {
+              value = JSON.parse(value)
+            }
+
+            if (key === 'company_created_at') {
+              value = getTs(value, 'YYYY-MM-DD')
+              temp['currentDate'] = value
+            }
 
+            if (this.data.form.hasOwnProperty(key)) {
+              temp[`form.${key}`] = value
+            }
+          }
+        }
+
+        this.setData(temp)
+      } else {
+        wx.showToast({
+          title: msg,
+          icon: 'none'
+        })
+      }
+    } catch (err) {}
   },
+  ...uploadJS,
+  uploadCallBack(res) {
+    const temp = res.map(item => {
+      return {
+        'url': item.url,
+        'formkey': item.formkey
+      }
+    })
+    let tempForm = {}
+    let formkey = ''
+    if (temp.length > 0) {
+      formkey = temp[0].formkey
+    }
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
+    switch (formkey) {
+      case 'user_code_url':
+      case 'shop_img_url':
+      case 'shop_shangbiao':
+        tempForm[`form.${formkey}[0]`] = temp[0]
+        break
+      default:
+    }
 
+    if (Object.keys(tempForm).length > 0) {
+      this.setData(tempForm)
+    }
   },
+  setFormValue(event) {
+    const { value } = event.detail
+    const { formkey } = event.target.dataset
+    let tempForm = {}
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
+    switch (formkey) {
+      case 'user_name':
+      case 'shop_name':
+      case 'user_card':
+      case 'user_wechat_code':
+      case 'company_name':
+      case 'company_hangye':
+      case 'company_jingying_fanwei':
+      case 'shop_jidi_guimo':
+      case 'shop_product_time':
+      case 'shop_remark':
+        tempForm[`form.${formkey}`] = value
+        break
+      case 'shop_phone':
+        tempForm[`form.${formkey}`] = value.replace(/[^\d]$/, '').replace(/^0/, '').replace(/(\d{11}(.*))/, '$1')
+        break
+      default:
+    }
+
+    this.setData(tempForm)
+  },
+  // 获取定位权限、定位权限授权
+  async handleGetSetting() {
+    const that = this
+
+    try {
+      const { errMsg, authSetting } = await wx.getSetting()
+      if (errMsg === 'getSetting:ok') {
+        // 有定位授权
+        if (authSetting['scope.userLocation']) {
+          if (that.tempFormKey === '') {
+
+          } else {
+            await that.chooseLocationBridge()
+          }
+          return
+        }
+      }
+    } catch (err) {}
+
+    try {
+      await wx.authorize({ scope: 'scope.userLocation' })
+      if (that.tempFormKey === '') {
+
+      } else {
+        await that.chooseLocationBridge()
+      }
+    } catch (err) {
+      wx.showModal({
+        title: '提示',
+        content: '未开启获取地理位置权限,去设置中打开',
+        success(res) {
+          if (res.confirm) {
+            that.openSetting()
+          }
+        }
+      })
+    }
+  },
+  // 去小程序自带设置页:返回
+  async openSetting() {
+    try {
+      const openSettingData = await wx.openSetting()
+      // 开启了定位权限
+      if (openSettingData.authSetting['scope.userLocation']) {
+        if (this.tempFormKey === '') {
+
+        } else {
+          await this.chooseLocationBridge()
+        }
+      }
+    } catch (err) {}
+  },
+  async handleChooseLocation(e) {
+    const { lat, lon, formkey } = e.currentTarget.dataset
+    this.tempPostData = lat && lon ? {
+      latitude: lat,
+      longitude: lon
+    } : {}
+    this.tempFormKey = 'form.' + formkey
+    await this.handleGetSetting()
+  },
+  async chooseLocationBridge() {
+    if (!this.tempFormKey) {
+      return
+    }
+    try {
+      const { errMsg, address, latitude, longitude, name } = await wx.chooseLocation(this.tempPostData)
+      if (errMsg === 'chooseLocation:ok' && address && name) {
+        const pointInfo = {
+          address_name: address,
+          name,
+          latitude,
+          longitude
+        }
+
+        this.setData({
+          [this.tempFormKey]: pointInfo
+        })
+      }
+    } catch (err) {
+      // 点击了取消按钮
+      if (err.errMsg === 'chooseLocation:fail cancel') {
+      }
+      // 未开启授权
+      if (err.errMsg === 'chooseLocation:fail auth deny') {
+      }
+    }
+  },
+  getForm() {
+    const {
+      shop_name,
+      shop_img_url,
+      shop_address,
+      user_name,
+      user_card,
+      shop_phone,
+      country_msg,
+      user_wechat_code,
+      user_code_url,
+      company_name,
+      company_created_at,
+      company_hangye,
+      company_jingying_fanwei,
+      shop_jidi_guimo,
+      shop_product_time,
+      shop_shangbiao,
+      shop_remark
+    } = this.data.form
 
+    return {
+      user_name,
+      shop_name,
+      user_card,
+      shop_phone,
+      country_msg,
+      user_code_url: user_code_url.map(item => item.url).join(''),
+      user_wechat_code,
+      shop_img_url: shop_img_url.map(item => item.url).join(''),
+      shop_address,
+      shop_remark,
+      company_name,
+      company_created_at,
+      company_hangye,
+      company_jingying_fanwei,
+      shop_jidi_guimo,
+      shop_product_time,
+      shop_shangbiao: shop_shangbiao.map(item => item.url).join('')
+    }
+  },
+  verify() {
+    let errorList = []
+    const {
+      user_name,
+      user_card,
+      shop_phone,
+      country_msg
+    } = this.getForm()
+
+    if (!user_name) {
+      errorList.push('请输入姓名')
+    }
+    if (!user_card) {
+      errorList.push('请输入身份证号码')
+    }
+    if (!isMobile(shop_phone)) {
+      errorList.push('请输入手机号')
+    }
+    if (!country_msg) {
+      errorList.push('请选择村信息')
+    }
+
+    return errorList
+  },
+  async onSubmit() {
+    const temp = this.getForm()
+    const verifyList = this.verify()
+
+    if (verifyList.length) {
+      wx.showToast({
+        title: verifyList[0],
+        icon: 'none'
+      })
+      return
+    }
+    this.setData({
+      booLock: true
+    })
+    try {
+      const { status, msg } = await modifyShopInfo(temp)
+      if (status) {
+        wx.redirectTo({
+          url: '/pages/businessHome/businessHome'
+        })
+      } else {
+        console.log(msg)
+        // wx.showToast({
+        //   title: msg,
+        //   icon: 'none'
+        // })
+      }
+    } catch (err) {}
+    this.setData({
+      booLock: false
+    })
+  },
+  setCountryMsgList() {
+    const { country_msg_list } = app.globalData.objSystemConfig
+
+    this.setData({
+      countryMsgList: Array.isArray(country_msg_list) && country_msg_list.length > 0 ? country_msg_list : []
+    })
+  },
+  showCountryMsg() {
+    this.setData({
+      booCountryMsg: true
+    })
+  },
+  hideCountryMsg() {
+    if (this.data.countryMsgList.length > 0) {
+      this.selectComponent('#picker-country-msg').setIndexes([this.data.countryMsgInDefaultIndex])
+    }
+
+    this.setData({
+      booCountryMsg: false
+    })
+  },
+  confirmCountryMsg(event) {
+    const { value, index } = event.detail
+
+    this.setData({
+      'form.country_msg': value,
+      countryMsgInDefaultIndex: index
+    })
+
+    this.hideCountryMsg()
+  },
+  showCompanyCreatedAt() {
+    this.setData({
+      booCompanyCreatedAt: true
+    })
+  },
+  hideCompanyCreatedAt() {
+    this.setData({
+      booCompanyCreatedAt: false
+    })
+  },
+  inputCompanyCreatedAt(event) {
+    this.setData({
+      currentDate: event.detail
+    })
+  },
+  confirmCompanyCreatedAt() {
+    this.setData({
+      'form.company_created_at': this.data.currentDate
+    })
+    this.hideCompanyCreatedAt()
   }
 })

+ 7 - 2
htmldev/shiningWxMini/pages/businessInfo/businessInfo.json

@@ -1,3 +1,8 @@
 {
-  "usingComponents": {}
-}
+  "usingComponents": {
+    "van-uploader": "@vant/weapp/uploader/index",
+    "van-popup": "@vant/weapp/popup/index",
+    "van-picker": "@vant/weapp/picker/index",
+    "van-datetime-picker": "@vant/weapp/datetime-picker/index"
+  }
+}

+ 113 - 0
htmldev/shiningWxMini/pages/businessInfo/businessInfo.scss

@@ -0,0 +1,113 @@
+.van-uploader__wrapper {
+  .van-uploader__preview {
+    &:nth-of-type(4n) {
+      margin: 0;
+    }
+  }
+}
+
+.wrapper {
+  padding: 10rpx 0 100rpx;
+}
+
+.height {
+  height: 144rpx;
+}
+
+.form-item {
+  display: flex;
+  flex-direction: column;
+  width: 674rpx;
+  padding-top: 40rpx;
+  padding-left: 10rpx;
+  margin: 0 auto;
+  border-bottom: 2rpx solid rgba(153, 153, 153, 0.2);
+}
+
+label {
+  display: flex;
+  align-items: center;
+
+  text {
+    line-height: 36rpx;
+    font-size: 28rpx;
+    color: rgba(68, 68, 68, 1);
+
+    &.require {
+      &:before {
+        content: '*';
+        color: red;
+        margin-right: 6rpx;
+      }
+    }
+  }
+}
+
+.value {
+  position: relative;
+  left: 0;
+  top: 0;
+  display: flex;
+  flex-direction: column;
+  padding: 16rpx 0 10rpx;
+}
+
+input {
+  display: block;
+  width: 100%;
+  height: 42rpx;
+  font-size: 28rpx;
+  color: rgba(68, 68, 68, 1);
+}
+
+.placeholder {
+  color: rgba(198, 202, 219, 1);
+}
+
+textarea {
+  display: block;
+  width: 100%;
+  padding: 17rpx 21rpx;
+  min-height: 186rpx;
+  border-radius: 20rpx;
+  background: rgba(245, 245, 245, 1);
+  line-height: 38rpx;
+  font-size: 28rpx;
+  color: rgba(51, 51, 51, 1);
+}
+
+.words-limit {
+  position: absolute;
+  bottom: 27rpx;
+  right: 21rpx;
+  z-index: 1;
+  line-height: 28rpx;
+  font-size: 24rpx;
+  color: rgba(153, 153, 153, 1);
+}
+
+.explain {
+  width: 674rpx;
+  margin: 10rpx auto 0;
+  font-size: 24rpx;
+  color: rgba(207, 207, 207, 1);
+}
+
+button[type='primary'] {
+  width: 504rpx;
+  height: 76rpx;
+  border-radius: 38rpx;
+  margin: 100rpx auto 0;
+  font-size: 32rpx;
+  font-weight: 500;
+  color: rgba(255, 255, 255, 1);
+  background-color: rgba(145, 179, 121, 1);
+}
+
+.shop-address {
+  line-height: 42rpx;
+  font-size: 28rpx;
+  color: rgba(68, 68, 68, 1);
+  word-break: break-all;
+  word-wrap: break-word;
+}

+ 299 - 0
htmldev/shiningWxMini/pages/businessInfo/businessInfo.wxml

@@ -0,0 +1,299 @@
+<view class="wrapper">
+  <view class="form-item">
+    <label>
+      <text>店铺名称</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.shop_name}}"
+        placeholder="请输入店铺名称"
+        placeholder-class="placeholder"
+        data-formkey="shop_name"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>店铺图片</text>
+    </label>
+    <view class="value">
+      <view
+        class="van-uploader-wrap">
+        <van-uploader
+          file-list="{{ form.shop_img_url }}"
+          max-count="{{1}}"
+          multiple="{{false}}"
+          accept="image"
+          image-fit="widthFix"
+          data-formkey="shop_img_url"
+          bind:after-read="afterRead"
+          bind:delete="delete"/>
+      </view>
+    </view>
+  </view>
+  <view
+    class="form-item"
+    data-formkey="shop_address"
+    data-lat="{{form.shop_address.latitude}}"
+    data-lon="{{form.shop_address.longitude}}"
+    bind:tap="handleChooseLocation">
+    <label>
+      <text>地址</text>
+    </label>
+    <view class="value">
+      <view
+        class="shop-address"
+        wx:if="{{form.shop_address.address_name}}">{{form.shop_address.address_name}}{{form.shop_address.name}}
+      </view>
+      <view
+        class="shop-address"
+        style="color: rgba(198, 202, 219, 1);"
+        wx:else>请输入详细地址
+      </view>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text class="require">姓名</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.user_name}}"
+        placeholder="请输入姓名"
+        placeholder-class="placeholder"
+        data-formkey="user_name"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text class="require">身份证号码</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.user_card}}"
+        placeholder="请输入身份证号码"
+        placeholder-class="placeholder"
+        data-formkey="user_card"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text class="require">手机号</text>
+    </label>
+    <view class="value">
+      <input
+        type="number"
+        maxlength="11"
+        value="{{form.shop_phone}}"
+        placeholder="请输入手机号"
+        placeholder-class="placeholder"
+        data-formkey="shop_phone"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text class="require">村信息</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.country_msg}}"
+        placeholder="请选择村信息"
+        placeholder-class="placeholder"
+        data-formkey="country_msg"
+        disabled="{{true}}"
+        bind:tap="showCountryMsg"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>微信号</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.user_wechat_code}}"
+        placeholder="请输入微信号"
+        placeholder-class="placeholder"
+        data-formkey="user_wechat_code"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>个人二维码</text>
+    </label>
+    <view class="value">
+      <view
+        class="van-uploader-wrap">
+        <van-uploader
+          file-list="{{ form.user_code_url }}"
+          max-count="{{1}}"
+          multiple="{{false}}"
+          accept="image"
+          data-formkey="user_code_url"
+          bind:after-read="afterRead"
+          bind:delete="delete"/>
+      </view>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>企业名称</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.company_name}}"
+        placeholder="请输入企业名称"
+        placeholder-class="placeholder"
+        data-formkey="company_name"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>企业成立日期</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{tools.formatTs(form.company_created_at, 'YYYY-MM-DD')}}"
+        placeholder="请选择企业成立日期"
+        placeholder-class="placeholder"
+        data-formkey="company_created_at"
+        disabled="{{true}}"
+        bind:tap="showCompanyCreatedAt"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>所属行业</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.company_hangye}}"
+        placeholder="请输入所属行业"
+        placeholder-class="placeholder"
+        data-formkey="company_hangye"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view
+    class="form-item"
+    style="padding-left: 0; border-bottom: none;">
+    <label>
+      <text>经营范围</text>
+    </label>
+    <view class="value">
+      <textarea
+        value="{{form.company_jingying_fanwei}}"
+        placeholder="请输入经营范围"
+        placeholder-class="placeholder"
+        auto-height="{{true}}"
+        data-formkey="company_jingying_fanwei"
+        bind:input="setFormValue"></textarea>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>基地规模</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.shop_jidi_guimo}}"
+        placeholder="请输入基地规模"
+        placeholder-class="placeholder"
+        data-formkey="shop_jidi_guimo"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>产品上市时间</text>
+    </label>
+    <view class="value">
+      <input
+        value="{{form.shop_product_time}}"
+        placeholder="请输入产品上市时间"
+        placeholder-class="placeholder"
+        data-formkey="shop_product_time"
+        bind:input="setFormValue"></input>
+    </view>
+  </view>
+  <view class="form-item">
+    <label>
+      <text>注册商标</text>
+    </label>
+    <view class="value">
+      <view
+        class="van-uploader-wrap">
+        <van-uploader
+          file-list="{{ form.shop_shangbiao }}"
+          max-count="{{1}}"
+          multiple="{{false}}"
+          accept="image"
+          image-fit="widthFix"
+          data-formkey="shop_shangbiao"
+          bind:after-read="afterRead"
+          bind:delete="delete"/>
+      </view>
+    </view>
+  </view>
+  <view class="form-item" style="padding-left: 0; border-bottom: none;">
+    <label>
+      <text>备注</text>
+    </label>
+    <view class="value">
+      <textarea
+        value="{{form.shop_remark}}"
+        placeholder="请输入备注"
+        placeholder-class="placeholder"
+        maxlength="{{200}}"
+        auto-height="{{true}}"
+        data-formkey="shop_remark"
+        bind:input="setFormValue"></textarea>
+      <view class="words-limit">{{form.shop_remark.length}}/200</view>
+    </view>
+  </view>
+  <view class="explain">*政府后台会审核村民信息是否真实,通过后就可发布</view>
+  <button
+    type="primary"
+    disabled="{{booLock}}"
+    bind:tap="onSubmit">修改完成
+  </button>
+</view>
+  <!--弹窗:村信息选择-->
+<van-popup
+  show="{{ booCountryMsg }}"
+  close-on-click-overlay="{{false}}"
+  round
+  position="bottom"
+  bind:click-overlay="hideCountryMsg">
+  <van-picker
+    id="picker-country-msg"
+    columns="{{ countryMsgList }}"
+    show-toolbar
+    default-index="{{ countryMsgInDefaultIndex }}"
+    bind:cancel="hideCountryMsg"
+    bind:confirm="confirmCountryMsg"/>
+</van-popup>
+
+  <!--弹窗:企业成立日期选择-->
+<van-popup
+  show="{{ booCompanyCreatedAt }}"
+  close-on-click-overlay="{{false}}"
+  round
+  position="bottom"
+  bind:click-overlay="hideCompanyCreatedAt">
+  <van-datetime-picker
+    type="date"
+    value="{{ currentDate }}"
+    min-date="{{ minDate }}"
+    max-date="{{ maxDate }}"
+    bind:cancel="hideCompanyCreatedAt"
+    bind:confirm="confirmCompanyCreatedAt"
+    bind:input="inputCompanyCreatedAt"
+  />
+</van-popup>
+
+<wxs src="../../components/wxs/index.wxs" module="tools"></wxs>

+ 1 - 1
htmldev/shiningWxMini/utils/util.js

@@ -379,7 +379,7 @@ function getTs(val, polyfill, type = 'ts') {
   if (!val) {
     return 0
   }
-  if (polyfill === 'YYYY年MM月DD日') {
+  if (polyfill === 'YYYY年MM月DD日' || polyfill === 'YYYY-MM-DD') {
     if (ios) {
       val = val.replace('年', '/').replace('月', '/').replace('日', '')
     } else {