Pārlūkot izejas kodu

始宁农业小程序:农事天地

panyong 2 gadi atpakaļ
vecāks
revīzija
6023b1e7bd

+ 12 - 1
htmldev/shiningManage/src/store/modules/common.js

@@ -149,7 +149,8 @@ const state = {
       name: '家庭农场',
       value: 2
     }
-  ]
+  ],
+  objSystemConfig: {}
 }
 
 const mutations = {
@@ -173,6 +174,9 @@ const mutations = {
   },
   SET_ARRVIDEOTYPE(state, val) {
     state.arrVideoType = val
+  },
+  SET_OBJSYSTEMCONFIG(state, val) {
+    state.objSystemConfig = val
   }
 }
 
@@ -237,6 +241,13 @@ const actions = {
       })
       commit('SET_ARRVIDEOTYPE', temp)
     }
+  },
+  // 系统配置
+  async fetchSystemConfig({ commit }) {
+    const data = await fetch('/api/system/config', {})
+    if (data.code === 200) {
+      commit('SET_OBJSYSTEMCONFIG', data.data)
+    }
   }
 }
 

+ 16 - 0
htmldev/shiningManage/src/utils/index.js

@@ -199,3 +199,19 @@ export function refreshFaviconIco() {
   const ele = document.querySelector('link[rel="icon"]')
   ele.setAttribute('href', '/ico1/favicon.ico')
 }
+
+export function getTs(val, polyfill, type = 'ts') {
+  if (!val) {
+    return 0
+  }
+  if (polyfill === 'YYYY-MM-DD') {
+    if (platform.ios) {
+      val = val.replace(/-/g, '/')
+    }
+    if (type === 's') {
+      return Math.round(new Date(`${val} 00:00:00`).getTime() / 1000)
+    }
+    return new Date(`${val} 00:00:00`).getTime()
+  }
+  return 0
+}

+ 11 - 6
htmldev/shiningManage/src/views/productManage/products/details.vue

@@ -184,17 +184,17 @@
           :rules="formRules.required">
           <el-radio
             v-model="form.product_sale_at"
-            label="0">预售
+            label="0">现货
           </el-radio>
           <el-radio
             v-model="form.product_sale_at"
-            label="1">
+            label="1">
           </el-radio>
           <el-date-picker
             :disabled="form.product_sale_at === '0'"
             v-model="product_sale_at"
-            type="datetime"
-            format="yyyy-MM-dd HH:mm"
+            type="date"
+            format="yyyy-MM-dd"
             :picker-options="myPickerOptions"
             placeholder="选择预售日期时间">
           </el-date-picker>
@@ -230,7 +230,7 @@
 </template>
 
 <script>
-import { fen2Yuan, yuan2Fen } from '@/utils'
+import { fen2Yuan, yuan2Fen, getTs } from '@/utils'
 
 export default {
   props: {
@@ -363,7 +363,12 @@ export default {
             product_category_name: productCategoryNameIndex > -1 ? this.arrCategoryList[productCategoryNameIndex].name : '',
             product_brand_name: productBrandNamedIndex > -1 ? this.arrBrandList[productBrandNamedIndex].name : '',
             product_all_price: yuan2Fen(formData.product_all_price),
-            product_price: yuan2Fen(formData.product_price)
+            product_price: yuan2Fen(formData.product_price),
+            product_sale_at: formData.product_sale_at === '0' ? formData.product_sale_at : getTs(this.product_sale_at, 'YYYY-MM-DD', 's')
+          }
+          if (formData.product_sale_at === '1' && !this.product_sale_at) {
+            this.$message.warning('选择预售日期时间')
+            return
           }
           this.booLock = true
           const data = await this.$fetch(url, postData)

+ 2 - 2
htmldev/shiningManage/src/views/productManage/products/index.vue

@@ -72,12 +72,12 @@
       </el-table-column>
       <el-table-column label="库存" prop="product_count"></el-table-column>
       <el-table-column label="类型" prop="product_sale_at">
-        <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? '现货' : '预售' }}</template>
+        <template slot-scope="scope">{{ scope.row.product_sale_at === 0 ? '现货' : '预售' }}</template>
       </el-table-column>
       <el-table-column label="发售时间" prop="product_sale_at" min-width="160">
         <template slot-scope="scope">
           <template v-if="scope.row.product_sale_at > 0">
-            {{ scope.row.product_sale_at * 1000 | parseTime('{y}-{m}-{d} {h}:{i}') }}
+            {{ scope.row.product_sale_at * 1000 | parseTime('{y}-{m}-{d}') }}
           </template>
           <template v-else>/</template>
         </template>

+ 1 - 1
htmldev/shiningManage/src/views/productManage/recommend/index.vue

@@ -72,7 +72,7 @@
       </el-table-column>
       <el-table-column label="库存" prop="product_count"></el-table-column>
       <el-table-column label="类型" prop="product_sale_at">
-        <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? '现货' : '预售' }}</template>
+        <template slot-scope="scope">{{ scope.row.product_sale_at === 0 ? '现货' : '预售' }}</template>
       </el-table-column>
       <el-table-column label="发售时间" prop="product_sale_at" min-width="160">
         <template slot-scope="scope">

+ 2 - 2
htmldev/shiningManage/src/views/productManage/toBeReviewed/index.vue

@@ -104,12 +104,12 @@
       </el-table-column>
       <el-table-column label="库存" prop="product_count"></el-table-column>
       <el-table-column label="类型" prop="product_sale_at">
-        <template slot-scope="scope">{{ scope.row.product_sale_at > 0 ? '现货' : '预售' }}</template>
+        <template slot-scope="scope">{{ scope.row.product_sale_at === 0 ? '现货' : '预售' }}</template>
       </el-table-column>
       <el-table-column label="发售时间" prop="product_sale_at" min-width="160">
         <template slot-scope="scope">
           <template v-if="scope.row.product_sale_at > 0">
-            {{ scope.row.product_sale_at * 1000 | parseTime('{y}-{m}-{d} {h}:{i}') }}
+            {{ scope.row.product_sale_at * 1000 | parseTime('{y}-{m}-{d}') }}
           </template>
           <template v-else>/</template>
         </template>

+ 2 - 1
htmldev/shiningWxMini/app.js

@@ -54,7 +54,8 @@ App({
         'selectedIconPath': 'image/tabBar/news_1@2x.png'
       }
     ],
-    objSystemConfig: {}
+    objSystemConfig: {},
+    messageDetailStorageKey: 'messageDetail'
   },
   async fetchUserData() {
     try {

+ 1 - 1
htmldev/shiningWxMini/pages/businessApply/businessApply.js

@@ -323,7 +323,7 @@ Page({
   },
   async onSubmit() {
     const temp = this.getForm()
-    // const verifyList = this.verify()
+    const verifyList = this.verify()
 
     if (verifyList.length) {
       wx.showToast({

+ 8 - 3
htmldev/shiningWxMini/pages/home/home.js

@@ -45,7 +45,8 @@ Page({
     ],
     categoryList: [],
     leftList: [],
-    rightList: []
+    rightList: [],
+    shop_status: 0
   },
   ...pages.methods,
   /**
@@ -76,6 +77,10 @@ Page({
     if (shop_status === 1 && this.getTabBar().data.list.findIndex(item => item.pagePath === 'pages/news/news') === -1) {
       this.getTabBar().setData({ list: app.globalData.tabBarList })
     }
+
+    this.setData({
+      shop_status: shop_status === 1 ? shop_status : 0
+    })
   },
 
   /**
@@ -239,9 +244,9 @@ Page({
   },
   jumpMessageDetail(e) {
     const { item } = e.currentTarget.dataset
-
+    wx.setStorageSync(app.globalData.messageDetailStorageKey, JSON.stringify(item))
     wx.navigateTo({
-      url: '/pages/messageDetail/messageDetail?item=' + JSON.stringify(item)
+      url: '/pages/messageDetail/messageDetail'
     })
   },
   handleNav(item) {

+ 1 - 1
htmldev/shiningWxMini/pages/home/home.wxml

@@ -40,7 +40,7 @@
   <!-- 消息通知 -->
   <view
     class="news-section"
-    wx:if="{{lunboMsg.length > 0}}">
+    wx:if="{{lunboMsg.length > 0 && shop_status === 1}}">
     <image src="../../image/home/notice.png"></image>
     <swiper
       vertical="{{true}}"

+ 3 - 2
htmldev/shiningWxMini/pages/messageDetail/messageDetail.js

@@ -1,3 +1,4 @@
+const app = getApp()
 Page({
 
   /**
@@ -11,7 +12,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-    const { item } = options
+    const item = wx.getStorageSync(app.globalData.messageDetailStorageKey)
 
     this.setData({
       objDetail: item ? JSON.parse(item) : {}
@@ -43,6 +44,6 @@ Page({
    * 生命周期函数--监听页面卸载
    */
   onUnload() {
-
+    wx.removeStorageSync(app.globalData.messageDetailStorageKey)
   }
 })