浏览代码

首页关键指数bug处理,公告列表添加上拉加载,下拉刷新,删除公告,公告编辑静态及接口

ltx529596 4 年之前
父节点
当前提交
896048f97e

+ 2 - 2
src/config/index.config.js

@@ -2,8 +2,8 @@ const CONFIG = {
     //开发环境配置
     development: {
         assetsPath: '/static', // 静态资源路径
-        baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
-        // baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
+        // baseUrl: 'http://tyou.xiudo.cn/merch',  // 后台接口请求地址
+        baseUrl: 'http://192.168.100.135:83/merch',  // 后台接口请求地址
         hostUrl: 'http://localhost:8080',        // H5地址(前端运行地址)
         websocketUrl: '',        // websocket服务端地址
         weixinAppId: '' // 微信公众号appid

+ 8 - 0
src/pages.json

@@ -46,6 +46,14 @@
       "path":"pages/index/setting/notice",
       "style":{
         "navigationBarTitleText": "公告管理",
+        "navigationBarBackgroundColor":"#ffffff",
+        "enablePullDownRefresh": true
+      }
+    },
+    {
+      "path":"pages/index/setting/editnotice",
+      "style":{
+        "navigationBarTitleText": "公告管理",
         "navigationBarBackgroundColor":"#ffffff"
       }
     },

+ 6 - 1
src/pages/index/index.vue

@@ -52,7 +52,6 @@
 						</view>
 						<view class="time">
 							数据截至:{{ this_day }}
-               <!-- <text class="hour">10:10</text> -->
 						</view>
 					</view>
 					<view class="exponent-list">
@@ -470,6 +469,7 @@ export default {
           shopId: this.shopID,
         })
         .then(async (res) => {
+          console.log(res);
           if (res.code === 200 && res.data) {
             // 销售总额
             this.dataDo(res.data.xsze, this.sellSun);
@@ -522,6 +522,7 @@ export default {
         }
       });
 
+      console.log((todaynum - yesnum));
       itemEle.percent = (((todaynum - yesnum) / yesnum) * 100).toFixed(2);
       if (yesnum === todaynum) {
         itemEle.percent = 0;
@@ -529,6 +530,10 @@ export default {
       } else {
         itemEle.status = false;
       }
+
+      if (yesnum === 0) {
+        itemEle.percent = 100
+      }
       return itemEle;
     },
 

+ 292 - 0
src/pages/index/setting/editnotice.vue

@@ -0,0 +1,292 @@
+<!-- editniotice -->
+<template>
+  <view class="editniotice">
+    <Header :title="title" />
+    <view style="height: 94upx;"></view>
+    <view class="content">
+      <view class="content-warp">
+        <view class="uni-list-cell">
+          <view class="name">选择店铺:</view>
+          <view class="uni-list-cell-db">
+            <picker
+              @change="bindPickerChange"
+              :value="storeIndex"
+              :range="storeList"
+              :disabled="storeDisabled"
+              range-key="name"
+              class="uni-upd"
+            >
+              <view class="uni-input">{{ storeList[storeIndex].name }}</view>
+            </picker>
+            <view class="icon-warp">
+              <image
+                src="../../../static/images/moreicon.png"
+                class="iconRight"
+              ></image>
+            </view>
+          </view>
+        </view>
+        <view class="inputnamt">
+          <view class="title">新闻标题:</view>
+          <input
+            class="txt"
+            v-model="noticeMessage.title"
+            type="text"
+            placeholder="请输入新闻标题"
+            placeholder-style="color:#8f8f8f;"
+          />
+        </view>
+        <view class="icon-warp">
+          <view class="title">上传图标:</view>
+          <image
+            class="icon"
+            :src="noticeMessage.icon"
+            v-if="noticeMessage.icon"
+          ></image>
+          <view class="upload">点击上传</view>
+        </view>
+        <view class="noticeContent">
+          <view class="container">
+            <editor
+              id="editor"
+              class="ql-container"
+              :placeholder="placeholder"
+              @input="saveTxt"
+              @ready="onEditorReady"
+            ></editor>
+          </view>
+        </view>
+        <view class="btn-warp">
+          <view class="btn" @tap="saveNotice">提交发布</view>
+        </view>
+      </view>
+    </view>
+    <rf-loading v-if="loading"></rf-loading>
+  </view>
+</template>
+
+<script>
+import Header from '../../components/header';
+export default {
+  name: 'editniotice',
+  components: {
+    Header,
+  },
+  data() {
+    //这里存放数据
+    return {
+      loading: true,
+      scenicId: '',
+      title: '公告编辑',
+      storeList: [{ name: '请选择公告所属店铺', id: '' }],
+      storeIndex: 0,
+      storeId: '',
+      storeDisabled: true,
+      newid: '',
+
+      icon: '1',
+      placeholder: '请输入公告内容',
+      mastknow: '',
+
+      noticeMessage: {
+        content: '',
+        icon: '',
+        title: '',
+        sid: '',
+        id: '',
+      },
+    };
+  },
+  onLoad(option) {
+    this.newid = option.id;
+    this.getShopMessage();
+    this.getNoticeBuyId();
+  },
+
+  //方法集合
+  methods: {
+    // 选择店铺
+    bindPickerChange(e) {
+      this.storeIndex = e.detail.value;
+      this.storeId = this.storeList[this.storeIndex].id;
+      console.log(this.storeId);
+    },
+    // 商家信息
+    async getShopMessage() {
+      await this.$http.get('/getUserInfo').then(async (res) => {
+        if (res.data) {
+          this.scenicId = res.data.id;
+          this.getShopList();
+        }
+      });
+    },
+    async getShopList() {
+      this.storeList = [{ name: '请选择公告所属店铺', id: '' }];
+      await this.$http
+        .get('/shop/getList', {
+          mid: this.scenicId,
+        })
+        .then(async (res) => {
+          if (res.data) {
+            let arr = [];
+            res.data.forEach((element) => {
+              arr.push({ name: element.name, id: element.id });
+            });
+            this.storeList = this.storeList.concat(arr);
+            this.storeDisabled = false;
+
+            if (this.noticeMessage) {
+              // 店铺回显
+              this.storeId = this.noticeMessage.sid;
+              this.storeList.forEach((item, index) => {
+                if (this.storeId === item.id) {
+                  this.storeIndex = index;
+                }
+              });
+            }
+          }
+        });
+    },
+    // 获取单个公告的信息
+    async getNoticeBuyId() {
+      await this.$http.get('/news/getById/' + this.newid).then(async (res) => {
+        console.log(res);
+        if (res.code === 200) {
+          this.noticeMessage =res.data
+          this.loading = false;
+        }
+      });
+    },
+    // 富文本
+    onEditorReady() {
+      uni
+        .createSelectorQuery()
+        .select('#editor')
+        .context((res) => {
+          this.editorCtx = res.context;
+          this.editorCtx.setContents({
+            html: this.noticeMessage.content,
+          });
+        })
+        .exec();
+    },
+    saveTxt(e) {
+      this.noticeMessage.content = e.detail.html;
+    },
+
+    // 保存编辑
+    saveNotice() {
+      console.log(this.noticeMessage);
+      this.$http.put('/news/updata', this.noticeMessage).then((res) => {
+        if (res.code === 200 && res.msg === 'OK') {
+          this.$mHelper.toast('保存成功!')
+          setTimeout(() => {
+            this.$mRouter.back()
+          }, 800);
+        }
+      });
+    },
+  },
+};
+</script>
+<style lang='scss' scoped>
+.editniotice {
+  .content {
+    padding: 25upx 0;
+  }
+  .content-warp {
+    padding: 0 33upx 100upx;
+    background-color: #fff;
+    box-sizing: border-box;
+  }
+  .uni-list-cell {
+    border-bottom: 2px solid #f4f4f4;
+    .name {
+      color: #2f2f2f;
+      font-size: 28upx;
+    }
+    .uni-list-cell-db {
+      height: 80upx;
+      font-size: 28upx;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      background-color: #fff;
+      color: #8f8f8f;
+      font-size: 30upx;
+      .uni-upd {
+        width: 100%;
+      }
+    }
+    .uni-input {
+      height: 100%;
+      line-height: 80upx;
+    }
+    .icon-warp {
+      width: 19upx;
+      .iconRight {
+        width: 19upx;
+        height: 27upx;
+      }
+    }
+  }
+  .inputnamt {
+    height: 80upx;
+    display: flex;
+    align-items: center;
+    border-bottom: 2px solid #f4f4f4;
+    .title {
+      color: #2f2f2f;
+    }
+    .txt {
+      flex: 1;
+    }
+  }
+  .icon-warp {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 20upx 0;
+    border-bottom: 2px solid #f4f4f4;
+    .title {
+      color: #2f2f2f;
+    }
+    .icon {
+      width: 185upx;
+      height: 185upx;
+      background-color: pink;
+      border-radius: 20upx;
+    }
+    .upload {
+      width: 185upx;
+      height: 185upx;
+      border: 2px dashed #ccc;
+      text-align: center;
+      line-height: 185upx;
+      border-radius: 20upx;
+    }
+  }
+  .noticeContent {
+    padding: 40upx;
+    border: 2px solid #f4f4f4;
+    margin-top: 20upx;
+  }
+  .btn-warp {
+    margin-top: 80upx;
+    display: flex;
+    justify-content: center;
+    .btn {
+      width: 600upx;
+      height: 90upx;
+      border-radius: 20upx;
+      text-align: center;
+      line-height: 90upx;
+      color: #fff;
+      font-size: 30upx;
+      font-weight: 700;
+      letter-spacing: 2upx;
+      background-color: #169bd5;
+    }
+  }
+}
+</style>

+ 109 - 17
src/pages/index/setting/notice.vue

@@ -3,53 +3,91 @@
   <view class="notice">
     <Header :title="title"></Header>
     <view class="btn-add">
-      <image src="../../../static/images/addicon.png" class="addicon" @tap="add"></image>
+      <image
+        src="../../../static/images/addicon.png"
+        class="addicon"
+        @tap="add"
+      ></image>
     </view>
     <view style="height: 94upx;"></view>
     <view class="notice-content">
       <view class="item" v-for="item in noticeList" :key="item.id">
         <view class="notice-top">
+          <view class="title">{{ item.shopName }}</view>
           <image :src="item.icon" class="picture"></image>
           <view class="detail">
-            <text class="txt">{{item.title}}</text>
-            <text class="time">{{item.time.substring(0,10)}}</text>
+            <text class="txt">{{ item.title }}</text>
+            <text class="time">{{ item.time.substring(0, 10) }}</text>
           </view>
         </view>
         <view class="notice-btns">
-          <view class="edit btn">编辑</view>
-          <view class="delete btn">删除</view>
+          <view class="up btn">置顶</view>
+          <view class="edit btn" @tap="topage(item.id)">编辑</view>
+          <view class="delete btn" @tap="deleteNotice(item.id)">删除</view>
         </view>
       </view>
     </view>
+    <uni-load-more :status="more"> </uni-load-more>
+    <mask
+      :txt="masktxt"
+      :iconShow="iconShow"
+      v-if="isShowMask"
+      @isSureConver="isSureConver"
+    ></mask>
   </view>
 </template>
 
 <script>
 import Header from '../../components/header';
+import mask from '../../components/mask';
+
 export default {
   name: 'notice',
   components: {
     Header,
+    mask,
   },
   data() {
     //这里存放数据
     return {
       title: '公告管理',
+      more: 'loading',
+
+      isShowMask: false,
+      iconShow: false,
+      masktxt: '',
+
       params: {
         mid: 53,
         pageNo: 1,
-        pageSize: 10,
+        pageSize: 3,
         type: '2',
       },
-      noticeList: []
+      noticeList: [],
+      newId: ''
     };
   },
-  onLoad () {
-    this.getShopMessage()
-    this.getNoticeList()
+  // 下拉刷新
+  onPullDownRefresh() {
+    this.params.pageNo = 1;
+    this.getNoticeList();
+  },
+  // 上拉加载
+  onReachBottom() {
+    if (this.more != 'noMore') {
+      this.getNoticeListMoare();
+    }
+  },
+  onLoad() {
+    this.getShopMessage();
+    this.getNoticeList();
   },
   //方法集合
   methods: {
+    // 编辑
+    topage(id) {
+      this.$mRouter.push({route: '/pages/index/setting/editnotice?id='+id});
+    },
     // 商家信息
     async getShopMessage() {
       await this.$http.get('/getUserInfo').then(async (res) => {
@@ -60,17 +98,62 @@ export default {
     },
     // 公告列表
     async getNoticeList() {
-      await this.$http.post('/news/list', this.params).then(async (res)=>{
-        if (res.code === 200) {
-          this.noticeList = res.data.list
-          console.log(this.noticeList);
+      await this.$http.post('/news/list', this.params).then(async (res) => {
+        console.log(res);
+        if (res.data.list.length > 0) {
+          this.noticeList = res.data.list;
+          if (res.data.nextPage === 0) {
+            this.more = 'noMore';
+          }
+        } else {
+          this.mor = 'noMore';
+        }
+        uni.stopPullDownRefresh();
+      });
+    },
+    // 加载更多
+    async getNoticeListMoare() {
+      this.params.pageNo++;
+      let arr = [];
+      await this.$http.post('/news/list', this.params).then(async (res) => {
+        console.log(res);
+        if (res.data.list.length > 0) {
+          arr = res.data.list;
+          this.noticeList = this.noticeList.concat(arr);
+          if (res.data.nextPage === 0) {
+            this.more = 'noMore';
+          }
+        } else {
+          this.more = 'noMore';
+          return;
         }
       });
     },
     // 新增列表
     add() {
       console.log(1);
-    }
+    },
+    // 删除
+    deleteNotice(id) {
+      this.newId = id
+      this.isShowMask = true;
+      this.masktxt = '是否删除该公告?';
+    },
+    // 监听遮罩层
+    isSureConver(e) {
+      if (e) {
+        this.$http.delete('/news/del/' + this.newId).then(async (res) => {
+          if (res.code === 200 && res.msg === 'OK') {
+            this.$mHelper.toast('删除成功');
+            this.params.pageNo = 1
+            this.getNoticeList()
+          }
+        });
+      } else {
+        this.$mHelper.toast('取消删除');
+      }
+      this.isShowMask = false
+    },
   },
 };
 </script>
@@ -88,12 +171,18 @@ export default {
 .notice-content {
   background-color: #f4f4f4;
   padding: 15upx 33upx;
- 
+
   .item {
     background-color: #fff;
     border-radius: 10upx;
     padding: 20upx;
+    margin-bottom: 25upx;
     .notice-top {
+      .title {
+        padding: 20upx;
+        color: #2f2f2f;
+        font-size: 28upx;
+      }
       .picture {
         width: 100%;
         height: 350upx;
@@ -131,12 +220,15 @@ export default {
         border-radius: 10upx;
         text-align: center;
         line-height: 70upx;
+        margin-left: 60upx;
+        &:first-child {
+          margin-left: 0;
+        }
       }
       .edit {
         background-color: #fff;
       }
       .delete {
-        margin-left: 60upx;
         background-color: #ff6a5e;
         color: #fff;
       }

+ 1 - 2
src/pages/order/order.vue

@@ -317,7 +317,6 @@ export default {
     async getOrderList() {
       this.soleStatus = 1;
       this.orderList = [];
-      // this.loading = true;
       await this.$http
         .post('/orders/proList', this.params)
         .then(async (res) => {
@@ -331,7 +330,7 @@ export default {
             this.more = 'noMore';
           }
         });
-         uni.stopPullDownRefresh();
+        uni.stopPullDownRefresh();
     },
     // 上拉加载
     async loadMoreList() {

+ 1 - 1
src/pages/order/orderdetail.vue

@@ -11,7 +11,7 @@
 				<view class="waternum titlebar" v-if="orderMessage.outOrderNo">流水号:<text class="txt">{{orderMessage.outOrderNo}}</text></view>
 				<view class="ordernum titlebar">订单号:<text class="txt">{{orderMessage.ordersNo}}</text></view>
 				<view class="phonenum titlebar">手机号:<text class="txt">{{orderMessage.buyPhone}}</text></view>
-				<view class="goindate titlebar">入园日期:<text class="txt">{{orderMessage.timePart ? orderMessage.timePart : orderMessage.palyTime}}</text></view>
+				<!-- <view class="goindate titlebar">入园日期:<text class="txt">{{orderMessage.timePart ? orderMessage.timePart : orderMessage.palyTime}}</text></view> -->
 				<view class="price titlebar">产品价格:<text class="txt">{{orderMessage.ordersPrice | doMoney}}</text></view>
 				<view class="buynum titlebar">购买数量:<text class="txt">{{orderMessage.playManList.length}}</text></view>
 				<view class="palytime titlebar">游玩时间:<text class="txt">{{orderMessage.timePart ? orderMessage.timePart : orderMessage.palyTime}}</text></view>

+ 6 - 2
src/pages/shop/shop.vue

@@ -242,7 +242,11 @@ export default {
       }
     },
     dounit (val) {
-      return (val/100)
+      if (val) {
+        return (val/100)
+      } else {
+        return '0.00'
+      }
     }
   },
   // 下拉刷新
@@ -370,7 +374,6 @@ export default {
         }
       });
     },
-
     // 商品列表(待审核状态)
     async getTicketShopList() {
       this.soleStatus = 1;
@@ -383,6 +386,7 @@ export default {
         delete this.params.upDown;
       }
       await this.$http.get('/goods/list', this.params).then((res) => {
+        console.log(res);
         if (res.data.list.length > 0) {
           this.shoplist = res.data.list;
           if (res.data.nextPage === 0) {

+ 4 - 13
src/pages/shop/shopdetail.vue

@@ -278,7 +278,6 @@ export default {
 
             // 图标回显
             if (this.shopData.icon) {
-              console.log('有图标');
               this.iconurl = this.shopData.icon;
             } else {
               this.iconurl = ''
@@ -286,7 +285,6 @@ export default {
           }
         });
     },
-    // 所属店铺怎么回显???
 
     // 初始化编辑器
     onEditorReady() {
@@ -355,7 +353,6 @@ export default {
               arr.push({ name: element.name, id: element.id });
             });
             this.storeList = this.storeList.concat(arr);
-            console.log(this.storeList);
              // 所属店铺回显
             if (this.shopData.shopId) {
               this.storeList.forEach((item, index) => {
@@ -592,16 +589,8 @@ export default {
         return;
       }
 
-      console.log(this.shopData.id);
-      console.log(this.scenicId);
-      console.log(this.storeId);
-      console.log(this.typeId);
-      console.log(name);
-      console.log(this.lineId);
-      console.log(this.showoperat);
-      console.log( JSON.stringify(astrictDate));
-      console.log(this.mastKnow);
-      console.log(this.Icon);
+      console.log(this.shopData.del);
+      console.log(this.shopData.upDown);
       this.$http
         .post('/goods/add', {
           id: this.shopData.id || '',
@@ -614,6 +603,8 @@ export default {
           saleRuleJson: JSON.stringify(astrictDate),
           describ: this.mastKnow,
           icon: this.Icon || '',
+          del: this.shopData.del  || '',
+          upDown: this.shopData.upDown || ''
         })
         .then((res) => {
           if (res.code === 200 && res.msg === 'OK') {