Bladeren bron

会员账户功能发布

kevin_zhangl 3 jaren geleden
bovenliggende
commit
bc0d88e530

+ 18 - 0
src/api/bonus.js

@@ -1,5 +1,23 @@
 import request from '@/utils/request'
 
+// 会员账户
+export function fetchAccount(data) {
+  return request({
+    url: '/v1/bonus/index',
+    method: 'get',
+    params: data
+  })
+}
+
+// 账户流水
+export function fetchAccountFlow(data) {
+  return request({
+    url: '/v1/bonus/wallet-flow',
+    method: 'get',
+    params: data
+  })
+}
+
 // 奖金列表
 export function fetchBonusList() {
   return request({

+ 8 - 0
src/lang/en.js

@@ -320,5 +320,13 @@ export default {
     leftSurplusPerformance: 'Left Surplus Performance',
     rightSurplusPerformance: 'Right Surplus Performance',
     periodBonus: 'Period %s Bonus',
+    viewRecord: 'View Record',
+    bonusFlowTitle: '%s Trading Record',
+    transTime: 'Trans Date',
+    transType: 'Trans Type',
+    preTransactionBalance: 'Pre Trans Balance',
+    transAmount: 'Trans Amount',
+    postTransactionBalance: 'Post Trans Balance',
+    remark: 'Remark',
   },
 }

+ 8 - 0
src/lang/zh.js

@@ -315,5 +315,13 @@ export default {
     leftSurplusPerformance: '左市场结余',
     rightSurplusPerformance: '右市场结余',
     periodBonus: '第 %s 期奖金',
+    viewRecord: '查看流水',
+    bonusFlowTitle: '%s交易记录',
+    transTime: '交易时间',
+    transType: '交易类型',
+    preTransactionBalance: '交易前余额',
+    transAmount: '交易额',
+    postTransactionBalance: '交易后余额',
+    remark: '备注',
   },
 }

+ 7 - 1
src/router/modules/bonus.js

@@ -3,13 +3,19 @@ import Layout from '@/layout'
 const bonusRouter = {
   path: '/bonus',
   component: Layout,
-  redirect: '/bonus/bonus-list',
+  redirect: '/bonus/index',
   name: 'Bonus Management',
   meta: {
     title: 'bonus',
     icon: 'el-icon-coin'
   },
   children: [
+    {
+      path: 'index',  // 会员账户
+      component: () => import('@/views/bonus/account-list'),
+      name: 'AccoutList',
+      meta: { title: 'accountList', icon: 'el-icon-coin' }
+    },
     {
       path: 'other',  // 奖金列表
       component: () => import('@/views/bonus/bonus-list'),

+ 1 - 1
src/views/article/article-list.vue

@@ -56,7 +56,7 @@ export default {
       this.listLoading = true
 			fetchArticleList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
 
         setTimeout(() => {
           this.listLoading = false

+ 1 - 1
src/views/atlas/brand-ambassador-list.vue

@@ -77,7 +77,7 @@ export default {
       this.listLoading = true
 			fetchBrandAmbassadorList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
 
         setTimeout(() => {
           this.listLoading = false

+ 175 - 0
src/views/bonus/account-list.vue

@@ -0,0 +1,175 @@
+<template>
+  <div class="app-container" v-loading="loading">
+		<el-row :gutter="20">
+			<el-col :xs="24" :sm="12" :lg="6" :span="6" v-for="item in walletData" :key="item.walletType">
+				<el-card shadow="hover" style="margin: 10px auto;">
+					<el-result icon="success" :title="item.walletName" :subTitle="item.amount">
+						<template slot="icon">
+							<el-image fit="cover" :src="tool.getArImage(item.walletType + '.png', '/files/')" style="width: 100px; height: 100px; border-radius: 50%;"></el-image>
+						</template>
+						<template slot="extra">
+							<el-button type="primary" size="small" @click="handleBonusFlow(item.walletType, item.walletName)" v-show="dealSwitch">{{ $t('bonus.viewRecord') }}</el-button>
+						</template>
+					</el-result>
+				</el-card>
+			</el-col>
+		</el-row>
+
+		<el-dialog :title="bonusFlowType" :visible.sync="dialog" width="80%">
+			<div class="app-container" style="margin-top: -40px;">
+				<div class="filter-container">
+					<el-row :gutter="40">
+						<el-col :xs="24" :sm="24" :lg="6">
+							<div class="grid-content bg-purple">
+								<el-date-picker
+									size="small"
+									v-model="listQuery.createAt"
+									type="daterange"
+									range-separator="to"
+									start-placeholder="Date from"
+									end-placeholder="Date to"
+									clearable
+								>
+								</el-date-picker>
+							</div>
+						</el-col>
+						<el-col :xs="24" :sm="24" :lg="6">
+							<div class="grid-content bg-purple-light">
+								<el-select size="small" v-model="listQuery.dealType" :placeholder="$t('bonus.transType')" clearable class="filter-item">
+									<el-option v-for="(item, key) in dealTypeList" :label="item" :value="key" :key="key"></el-option>
+								</el-select>
+							</div>
+						</el-col>
+						<el-col :xs="24" :sm="24" :lg="6">
+							<div class="grid-content bg-purple">
+								<el-input size="small" v-model="listQuery.remark" :placeholder="$t('bonus.remark')" clearable></el-input>
+							</div>
+						</el-col>
+						<el-col :xs="24" :sm="24" :lg="6">
+							<div class="grid-content bg-purple">
+								<el-button size="small" type="primary" @click="handleBonusFlow(listQuery.walletType, walletName)">Select</el-button>
+								<el-button size="small" type="warning" @click="handleFilterClear(listQuery.walletType, walletName)">Reset</el-button>
+							</div>
+						</el-col>
+					</el-row>
+				</div>
+
+				<el-table
+					v-loading="loading"
+					:data="bonusData"
+					border
+					fit
+					highlight-current-row
+					style="width: 100%;"
+					:xs="24" :sm="24" :lg="6"
+				>
+					<el-table-column :label="$t('bonus.transTime')" align="center">
+						<template slot-scope="{row}">
+							<span>{{ row.CREATED_AT | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
+						</template>
+					</el-table-column>
+					<el-table-column :label="$t('bonus.transType')" align="center">
+						<template slot-scope="{row}">
+							<span>{{ row.DEAL_TYPE_NAME }}</span>
+						</template>
+					</el-table-column>
+					<el-table-column :label="$t('bonus.preTransactionBalance')" align="center">
+						<template slot-scope="{row}">
+							<span>{{ tool.formatPrice(row.TOTAL - row.AMOUNT) }}</span>
+						</template>
+					</el-table-column>
+					<el-table-column :label="$t('bonus.transAmount')" align="center">
+						<template slot-scope="{row}">
+							<el-tag :type="row.IS_INCR > 0 ? 'danger' : 'info'" size="small" class="no-border">
+								<span class="text-danger">{{ row.IS_INCR > 0 ? '+' : '' }}  {{row.AMOUNT}}</span>
+							</el-tag>
+						</template>
+					</el-table-column>
+					<el-table-column :label="$t('bonus.postTransactionBalance')" align="center">
+						<template slot-scope="{row}">
+							<span>{{ row.AMOUNT }}</span>
+						</template>
+					</el-table-column>
+					<el-table-column :label="$t('bonus.remark')" align="center">
+						<template slot-scope="{row}">
+							<span>{{ row.REMARK }}</span>
+						</template>
+					</el-table-column>
+				</el-table>
+
+				<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="handleBonusFlow(listQuery.walletType, walletName)" />
+			</div>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+import {fetchAccount,fetchAccountFlow} from '@/api/bonus'
+import Pagination from '@/components/Pagination'
+import tool from "@/utils/tool"
+
+export default {
+  name: 'accountList',
+	components: { Pagination },
+  data() {
+    return {
+			tool: tool,
+			loading: true,
+			walletData: [],
+			dealSwitch: 0,
+
+			dialog: false,
+			bonusFlowType: '',
+			walletName: '',
+			dealTypeList: null,
+			bonusData: null,
+			total: 0,
+			listQuery: {
+				page: 1,
+				pageSize: 5,
+				walletType: '',
+				createAt: '',
+				remark: '',
+				dealType: '',
+			},
+    }
+  },
+  created() {
+    this.getList()
+  },
+	methods: {
+    getList() {
+      this.loading = true
+			fetchAccount().then(response => {
+				this.walletData = response.data.wallet
+				this.dealSwitch = parseInt(response.data.dealSwitch) === 1
+				this.loading = false
+      })
+    },
+		handleBonusFlow(walletType, walletName) {
+			this.loading = true
+			this.bonusFlowType = this.$t('bonus.bonusFlowTitle').replace('%s', walletName)
+			this.listQuery.walletType = walletType
+			this.walletName = walletName
+			fetchAccountFlow(this.listQuery).then(response => {
+				this.bonusData = response.data.list
+				this.total = response.data.totalCount
+				this.dealTypeList = response.data.dealTypes
+				this.dialog = true
+				this.loading = false
+			})
+		},
+		handleFilterClear(walletType, walletName){
+			console.log(walletType, walletName)
+			this.walletName = walletName
+			this.listQuery.page = 1
+			this.listQuery.pageSize = 5
+			this.listQuery.walletType = walletType
+			this.listQuery.createAt = ''
+			this.listQuery.remark = ''
+			this.listQuery.dealType = ''
+			this.handleBonusFlow(walletType, walletName)
+		},
+  }
+}
+</script>

+ 1 - 1
src/views/bonus/bonus-list.vue

@@ -50,7 +50,7 @@
 import {fetchBonusList, fetchBonusDetail} from '@/api/bonus'
 
 export default {
-  name: 'myBonusList',
+  name: 'bonusList',
   data() {
     return {
 			tableData: [],

+ 1 - 1
src/views/config/receive-address-list.vue

@@ -186,7 +186,7 @@ export default {
       this.listLoading = true
 			fetchAddressList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
 
         setTimeout(() => {
           this.listLoading = false

+ 1 - 1
src/views/shop/ba-dec-order-list.vue

@@ -145,7 +145,7 @@ export default {
       this.listLoading = true
 			fetchBaDecOrderList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
 
         setTimeout(() => {
           this.listLoading = false

+ 1 - 1
src/views/shop/car-fund-products.vue

@@ -125,7 +125,7 @@ export default {
 			this.listLoading = true
 			fetchProductList(this.listQuery).then(response => {
 				this.list = response.data.list
-				this.total = parseInt(response.data.totalCount)
+				this.total = response.data.totalCount
 
 				setTimeout(() => {
 					this.listLoading = false

+ 1 - 1
src/views/shop/dec-order-list.vue

@@ -148,7 +148,7 @@ export default {
       this.listLoading = true
       fetchDecOrderList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
 
         setTimeout(() => {
           this.listLoading = false

+ 1 - 1
src/views/shop/order-list.vue

@@ -171,7 +171,7 @@ export default {
       this.listLoading = true
       fetchOrderList(this.listQuery).then(response => {
         this.list = response.data.list
-        this.total = parseInt(response.data.totalCount)
+        this.total = response.data.totalCount
         const settingObj = this.list
 				this.tableData = Object.keys(this.list).map(key => {
 					return settingObj[key]

+ 1 - 1
src/views/shop/standard-products.vue

@@ -133,7 +133,7 @@
         this.listLoading = true
 				fetchProductList(this.listQuery).then(response => {
           this.list = response.data.list
-          this.total = parseInt(response.data.totalCount)
+          this.total = response.data.totalCount
 
 					setTimeout(() => {
 						this.listLoading = false

+ 1 - 1
src/views/shop/villa-fund-products.vue

@@ -125,7 +125,7 @@ export default {
 			this.listLoading = true
 			fetchProductList(this.listQuery).then(response => {
 				this.list = response.data.list
-				this.total = parseInt(response.data.totalCount)
+				this.total = response.data.totalCount
 
 				setTimeout(() => {
 					this.listLoading = false