Просмотр исходного кода

添加消费变动记录、成长值变动记录、积分变动记录查看页

shizhongqi 4 месяцев назад
Родитель
Сommit
378fe5672f

+ 176 - 0
hdApp/src/admin/member/buyAmountChange.vue

@@ -0,0 +1,176 @@
+<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" @click="goDetail(item)">
+            <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 { getBuyAmountList } from "@/api/user/index";
+import list from "@/mixins/list";
+
+export default {
+  name: "BuyAmountChange",
+  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 || item.amount || 0);
+      if (!changeValue) {
+        return "0";
+      }
+      return changeValue > 0 ? "+" + parseFloat(changeValue) : String(parseFloat(changeValue));
+    },
+    formatBalance(item) {
+      const balance = Number(item.buyAmount || item.totalBuyAmount || item.amount || 0);
+      return Number.isNaN(balance) ? 0 : parseFloat(balance);
+    },
+    async init() {
+      const params = {
+        page: this.list.page,
+      };
+      if (this.option.userId) {
+        params.userId = this.option.userId;
+      }
+      const res = await getBuyAmountList(params);
+      this.completes(res);
+    },
+    goDetail(item) {
+      if (item.relateId != 0 && item.relateType == 1) {
+        this.$util.pageTo({ url: "/admin/order/detail?id=" + item.relateId + "&account=" + item.shopId });
+      }
+    },
+  },
+  async onLoad(option) {
+    this.option = option || {};
+    await this.init();
+  },
+  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>

+ 9 - 0
hdApp/src/admin/member/detail.vue

@@ -182,6 +182,15 @@
         <tui-list-cell @click="pageTo({ url: '/admin/custom/debtChange?customId='+data.id })" class="line-cell" :hover="false" :arrow="true" >
             <view class="tui-title">欠款变动</view>
         </tui-list-cell>
+        <tui-list-cell @click="pageTo({ url: '/admin/member/buyAmountChange?userId='+data.userId })" class="line-cell" :hover="false" :arrow="true" >
+            <view class="tui-title">消费变动记录</view>
+        </tui-list-cell>
+        <tui-list-cell @click="pageTo({ url: '/admin/member/growthChange?userId='+data.userId })" class="line-cell" :hover="false" :arrow="true" >
+            <view class="tui-title">成长值变动记录</view>
+        </tui-list-cell>
+        <tui-list-cell @click="pageTo({ url: '/admin/member/integralChange?userId='+data.userId })" class="line-cell" :hover="false" :arrow="true" >
+            <view class="tui-title">积分变动记录</view>
+        </tui-list-cell>
       </view>
     </view>
 

+ 176 - 0
hdApp/src/admin/member/growthChange.vue

@@ -0,0 +1,176 @@
+<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" @click="goDetail(item)">
+            <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/index";
+import list from "@/mixins/list";
+
+export default {
+  name: "GrowthChange",
+  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.userId) {
+        params.userId = this.option.userId;
+      }
+      const res = await getGrowthList(params);
+      this.completes(res);
+    },
+    goDetail(item) {
+      if (item.relateId != 0 && item.relateType == 1) {
+        this.$util.pageTo({ url: "/admin/order/detail?id=" + item.relateId + "&account=" + item.shopId });
+      }
+    },
+  },
+  async onLoad(option) {
+    this.option = option || {};
+    await this.init();
+  },
+  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>

+ 176 - 0
hdApp/src/admin/member/integralChange.vue

@@ -0,0 +1,176 @@
+<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" @click="goDetail(item)">
+            <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/index";
+import list from "@/mixins/list";
+
+export default {
+  name: "IntegralChange",
+  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.userId) {
+        params.userId = this.option.userId;
+      }
+      const res = await getIntegralList(params);
+      this.completes(res);
+    },
+    goDetail(item) {
+      if (item.relateId != 0 && item.relateType == 1) {
+        this.$util.pageTo({ url: "/admin/order/detail?id=" + item.relateId + "&account=" + item.shopId });
+      }
+    },
+  },
+  async onLoad(option) {
+    this.option = option || {};
+    await this.init();
+  },
+  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>

+ 13 - 0
hdApp/src/api/user/index.js

@@ -0,0 +1,13 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getBuyAmountList = data => {
+	return https.get('/user/buy-amount-list', data)
+}
+
+export const getGrowthList = data => {
+	return https.get('/user/growth-list', data)
+}
+
+export const getIntegralList = data => {
+	return https.get('/user/integral-list', data)
+}

+ 4 - 1
hdApp/src/pages.json

@@ -442,7 +442,10 @@
 			"pages": [
 				{ "path": "detail", "style": { "navigationBarTitleText": "详情" } },
 				{ "path": "modify", "style": { "navigationBarTitleText": "修改地址" } },
-				{"path": "level","style": {"navigationBarTitleText": "会员等级"}}
+				{"path": "level","style": {"navigationBarTitleText": "会员等级"}},
+				{"path": "buyAmountChange","style": {"navigationBarTitleText": "消费变动记录","enablePullDownRefresh": true}},
+				{"path": "growthChange","style": {"navigationBarTitleText": "成长值变动记录","enablePullDownRefresh": true}},
+				{"path": "integralChange","style": {"navigationBarTitleText": "积分变动记录","enablePullDownRefresh": true}}
 			]
 		},
 		{