Prechádzať zdrojové kódy

新增成长值记录与积分记录变动查询页

shizhongqi 4 mesiacov pred
rodič
commit
2ff385475d

+ 8 - 0
mallApp/src/api/user/index.js

@@ -26,4 +26,12 @@ export const clearLogin = data => {
 
 export const modifyBirthday = data => {
 	return https.get('/user/modify-birthday', data)
+}
+
+export const getGrowthList = data => {
+	return https.get('/user/growth-list', data)
+}
+
+export const getIntegralList = data => {
+	return https.get('/user/integral-list', data)
 }

+ 3 - 1
mallApp/src/pages.json

@@ -20,7 +20,9 @@
                 { "path": "password", "style": { "navigationBarTitleText": "修改密码" } },
                 { "path": "address", "style": { "navigationBarTitleText": "修改地址" } },
                 { "path": "edit", "style": { "navigationBarTitleText": "个人信息" } },
-                { "path": "birthday", "style": { "navigationBarTitleText": "您的生日" } }
+                { "path": "birthday", "style": { "navigationBarTitleText": "您的生日" } },
+                { "path": "growthList", "style": { "navigationBarTitleText": "成长值记录", "enablePullDownRefresh": true } },
+                { "path": "integralList", "style": { "navigationBarTitleText": "积分记录", "enablePullDownRefresh": true } }
             ]
         },
         {

+ 30 - 2
mallApp/src/pages/home/recent.vue

@@ -90,11 +90,17 @@
                 <view class="popup-item" @click="toRechargeClear(item)">
                   <text>充值</text>
                 </view>
+                <view class="popup-item" @click="toPay(item)">
+                  <text>付款</text>
+                </view>
                 <view class="popup-item" @click="getRechargeList(item)">
                   <text>充值记录</text>
                 </view>
-                <view class="popup-item" @click="toPay(item)">
-                  <text>付款</text>
+                <view class="popup-item" @click="toGrowth(item)">
+                  <text>成长值记录</text>
+                </view>
+                <view class="popup-item" @click="toIntegral(item)">
+                  <text>积分记录</text>
                 </view>
                 <view class="popup-item cancel" @click="hideMoreOptions()">
                   <text>取消</text>
@@ -362,6 +368,28 @@ export default {
       this.hideMoreOptions();
       this.recharge(item);
     },
+    toGrowth(item) {
+      this.pageTo({
+        url:
+          "/pages/user/growthList?account=" +
+          item.shopId +
+          "&hdId=" +
+          item.id +
+          "&hdName=" +
+          item.name,
+      });
+    },
+    toIntegral(item) {
+      this.pageTo({
+        url:
+          "/pages/user/integralList?account=" +
+          item.shopId +
+          "&hdId=" +
+          item.id +
+          "&hdName=" +
+          item.name,
+      });
+    },
     goToBirthday() {
       this.pageTo({ url: "/pages/user/birthday" });
     },

+ 167 - 0
mallApp/src/pages/user/growthList.vue

@@ -0,0 +1,167 @@
+<template>
+  <view class="app-content">
+    <block v-if="!$util.isEmpty(list.data)">
+      <view class="record-table">
+        <view class="table-header table-row">
+          <view class="table-cell cell-date">日期</view>
+          <view class="table-cell cell-event">事项</view>
+          <view class="table-cell cell-staff">操作</view>
+          <view class="table-cell cell-change">变动</view>
+          <view class="table-cell cell-balance">成长值</view>
+        </view>
+        <view v-for="(item, index) in list.data" :key="index" class="table-body">
+          <view class="table-row table-row-data">
+            <view class="table-cell cell-date">{{ formatTime(item) }}</view>
+            <view class="table-cell cell-event">{{ getEvent(item) }}</view>
+            <view class="table-cell cell-staff">{{ getStaff(item) }}</view>
+            <view class="table-cell cell-change">{{ formatChange(item) }}</view>
+            <view class="table-cell cell-balance">{{ formatBalance(item) }}</view>
+          </view>
+          <view v-if="!$util.isEmpty(item.remark)" class="table-row table-row-extra">
+            <view class="table-cell cell-extra">{{ item.remark }}</view>
+          </view>
+        </view>
+      </view>
+    </block>
+    <block v-else>
+      <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+    </block>
+  </view>
+</template>
+
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { getGrowthList } from "@/api/user";
+import list from "@/mixins/list";
+
+export default {
+  name: "growthList",
+  components: {
+    AppWrapperEmpty,
+  },
+  mixins: [list],
+  methods: {
+    formatTime(item) {
+      const time = item.createTime;
+      if (!time) {
+        return "-";
+      }
+      return String(time).length > 10 ? String(time).substr(5, 11) : time;
+    },
+    getEvent(item) {
+      return item.event || "-";
+    },
+    getStaff(item) {
+      return Number(item.operatorId) > 0 ? "人工" : "系统";
+    },
+    formatChange(item) {
+      const changeValue = Number(item.num || 0);
+      if (!changeValue) {
+        return "0";
+      }
+      return changeValue > 0 ? "+" + parseFloat(changeValue) : String(parseFloat(changeValue));
+    },
+    formatBalance(item) {
+      const num = Number(item.growth || 0);
+      return Number.isNaN(num) ? 0 : parseFloat(num);
+    },
+    async init() {
+      const params = {
+        page: this.list.page,
+      };
+      if (this.option.hdId) {
+        params.hdId = this.option.hdId;
+      }
+      const res = await getGrowthList(params);
+      this.completes(res);
+    },
+  },
+  async onPullDownRefresh() {
+    this.resetList();
+    await this.init();
+    uni.stopPullDownRefresh();
+  },
+  async onReachBottom() {
+    if (!this.list.finished) {
+      await this.init();
+    }
+    uni.stopPullDownRefresh();
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.record-table {
+  width: 100%;
+  border-radius: 16upx;
+  overflow: hidden;
+  background: #fff;
+  box-shadow: 0 4upx 24upx rgba(0, 0, 0, 0.06);
+  margin: 20upx 0;
+
+  .table-row {
+    display: flex;
+    align-items: center;
+    min-height: 72upx;
+    border-bottom: 1px solid #f0f0f0;
+
+    &.table-header {
+      background: #f5f7fa;
+      font-weight: bold;
+      font-size: 30upx;
+      color: #333;
+    }
+
+    &.table-row-data {
+      font-size: 26upx;
+      color: #222;
+    }
+
+    &.table-row-extra {
+      background: #f8f8f8;
+      color: #989494;
+      font-size: 24upx;
+
+      .cell-extra {
+        padding: 16upx 20upx;
+      }
+    }
+  }
+
+  .table-cell {
+    flex: 1;
+    padding: 18upx 8upx;
+
+    &.cell-date {
+      text-align: center;
+      min-width: 100upx;
+      flex: 1.2;
+    }
+
+    &.cell-event {
+      text-align: left;
+      min-width: 180upx;
+      flex: 2;
+    }
+
+    &.cell-staff {
+      text-align: center;
+      min-width: 90upx;
+      flex: 1;
+    }
+
+    &.cell-change {
+      text-align: right;
+      min-width: 100upx;
+      flex: 1;
+    }
+
+    &.cell-balance {
+      text-align: right;
+      min-width: 110upx;
+      padding-right: 24upx;
+      flex: 1;
+    }
+  }
+}
+</style>

+ 167 - 0
mallApp/src/pages/user/integralList.vue

@@ -0,0 +1,167 @@
+<template>
+  <view class="app-content">
+    <block v-if="!$util.isEmpty(list.data)">
+      <view class="record-table">
+        <view class="table-header table-row">
+          <view class="table-cell cell-date">日期</view>
+          <view class="table-cell cell-event">事项</view>
+          <view class="table-cell cell-staff">操作</view>
+          <view class="table-cell cell-change">变动</view>
+          <view class="table-cell cell-balance">积分</view>
+        </view>
+        <view v-for="(item, index) in list.data" :key="index" class="table-body">
+          <view class="table-row table-row-data">
+            <view class="table-cell cell-date">{{ formatTime(item) }}</view>
+            <view class="table-cell cell-event">{{ getEvent(item) }}</view>
+            <view class="table-cell cell-staff">{{ getStaff(item) }}</view>
+            <view class="table-cell cell-change">{{ formatChange(item) }}</view>
+            <view class="table-cell cell-balance">{{ formatBalance(item) }}</view>
+          </view>
+          <view v-if="!$util.isEmpty(item.remark)" class="table-row table-row-extra">
+            <view class="table-cell cell-extra">{{ item.remark }}</view>
+          </view>
+        </view>
+      </view>
+    </block>
+    <block v-else>
+      <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
+    </block>
+  </view>
+</template>
+
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { getIntegralList } from "@/api/user";
+import list from "@/mixins/list";
+
+export default {
+  name: "integralList",
+  components: {
+    AppWrapperEmpty,
+  },
+  mixins: [list],
+  methods: {
+    formatTime(item) {
+      const time = item.createTime;
+      if (!time) {
+        return "-";
+      }
+      return String(time).length > 10 ? String(time).substr(5, 11) : time;
+    },
+    getEvent(item) {
+      return item.event || "-";
+    },
+    getStaff(item) {
+      return Number(item.operatorId) > 0 ? "人工" : "系统";
+    },
+    formatChange(item) {
+      const changeValue = Number(item.num || 0);
+      if (!changeValue) {
+        return "0";
+      }
+      return changeValue > 0 ? "+" + parseFloat(changeValue) : String(parseFloat(changeValue));
+    },
+    formatBalance(item) {
+      const num = Number(item.integral || 0);
+      return Number.isNaN(num) ? 0 : parseFloat(num);
+    },
+    async init() {
+      const params = {
+        page: this.list.page,
+      };
+      if (this.option.hdId) {
+        params.hdId = this.option.hdId;
+      }
+      const res = await getIntegralList(params);
+      this.completes(res);
+    },
+  },
+  async onPullDownRefresh() {
+    this.resetList();
+    await this.init();
+    uni.stopPullDownRefresh();
+  },
+  async onReachBottom() {
+    if (!this.list.finished) {
+      await this.init();
+    }
+    uni.stopPullDownRefresh();
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.record-table {
+  width: 100%;
+  border-radius: 16upx;
+  overflow: hidden;
+  background: #fff;
+  box-shadow: 0 4upx 24upx rgba(0, 0, 0, 0.06);
+  margin: 20upx 0;
+
+  .table-row {
+    display: flex;
+    align-items: center;
+    min-height: 72upx;
+    border-bottom: 1px solid #f0f0f0;
+
+    &.table-header {
+      background: #f5f7fa;
+      font-weight: bold;
+      font-size: 30upx;
+      color: #333;
+    }
+
+    &.table-row-data {
+      font-size: 26upx;
+      color: #222;
+    }
+
+    &.table-row-extra {
+      background: #f8f8f8;
+      color: #989494;
+      font-size: 24upx;
+
+      .cell-extra {
+        padding: 16upx 20upx;
+      }
+    }
+  }
+
+  .table-cell {
+    flex: 1;
+    padding: 18upx 8upx;
+
+    &.cell-date {
+      text-align: center;
+      min-width: 100upx;
+      flex: 1.2;
+    }
+
+    &.cell-event {
+      text-align: left;
+      min-width: 180upx;
+      flex: 2;
+    }
+
+    &.cell-staff {
+      text-align: center;
+      min-width: 90upx;
+      flex: 1;
+    }
+
+    &.cell-change {
+      text-align: right;
+      min-width: 100upx;
+      flex: 1;
+    }
+
+    &.cell-balance {
+      text-align: right;
+      min-width: 110upx;
+      padding-right: 24upx;
+      flex: 1;
+    }
+  }
+}
+</style>