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

账单增加时间显示,金额分转换元。设置增加退出登录

tanbin 8 месяцев назад
Родитель
Сommit
9fc366fac7
3 измененных файлов с 233 добавлено и 172 удалено
  1. 16 0
      .hbuilderx/launch.json
  2. 6 6
      src/pages/home.vue
  3. 211 166
      src/pages/setting.vue

+ 16 - 0
.hbuilderx/launch.json

@@ -0,0 +1,16 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"mp-weixin" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 6 - 6
src/pages/home.vue

@@ -23,11 +23,11 @@
 				<block v-for="(item,index) in list" :key="item.id">
 					<view class="list-item flex justify-between" v-if="current==0">
 						<view class="time">
-							{{item.updateTime}}
+							{{item.createTime}}
 						</view>
 						<view class="val">
-							{{item.balance}}
-						</view>
+              {{$xy.delMoney(item.balance)||'0'}}
+ 						</view>
 					</view>
 
 					<view class="list-item flex justify-between align-center" v-else>
@@ -36,11 +36,11 @@
 								{{item.status}}
 							</view>
 							<view class="time">
-								{{item.updateTime}}
+								{{item.createTime}}
 							</view>
 						</view>
 						<view class="val">
-							{{item.balance}}
+              {{$xy.delMoney(item.balance)||'0'}}
 						</view>
 					</view>
 				</block>
@@ -352,4 +352,4 @@
 			}
 		}
 	}
-</style>
+</style>

+ 211 - 166
src/pages/setting.vue

@@ -1,173 +1,218 @@
 <template>
-	<view class="container">
-		<view class="top">
-		<!-- 	<view class="item flex justify-between align-center">
-				<view class="key">
-					合作商家:
-				</view>
-				<view class="value">
-					--
-				</view>
-			</view> -->
-			<view class="item flex justify-between align-center">
-				<view class="key">
-					收款支付宝
-				</view>
-				<view class="value">
-					{{aliNo}}
-				</view>
-			</view>
-			<view class="item flex justify-between align-center" style="border-bottom: none;" @click="open">
-				<view class="key">
-					修改密码
-				</view>
-				<up-icon name="arrow-right"></up-icon>
-			</view>
-		</view>
-
-		<up-popup :show="show" @close="close" @open="open" mode="center" :round="10">
-			<view class="pop-content">
-				<view class="pop-title">
-					修改密码
-				</view>
-				<view class="pop-input">
-					<up-input placeholder="请输入新密码" border="surround" type="password" v-model="password"></up-input>
-				</view>
-				<view class="pop-btn flex justify-end">
-					<view class="pop-btns close" @click="close">
-						取消
-					</view>
-					<view class="pop-btns submit" @click="submit">
-						确定
-					</view>
-				</view>
-			</view>
-		</up-popup>
-	</view>
+  <view class="container">
+    <view class="top">
+      <view class="item flex justify-between align-center">
+        <view class="key">
+          收款支付宝
+        </view>
+        <view class="value">
+          {{aliNo}}
+        </view>
+      </view>
+      <view class="item flex justify-between align-center" style="border-bottom: none;" @click="open">
+        <view class="key">
+          修改密码
+        </view>
+        <up-icon name="arrow-right"></up-icon>
+      </view>
+      <view class="item flex justify-between align-center" style="border-bottom: none;" @click="openLogoutConfirm">
+        <view class="key">
+          退出登录
+        </view>
+        <up-icon name="arrow-right"></up-icon>
+      </view>
+    </view>
+
+    <up-popup :show="show" @close="close" @open="open" mode="center" :round="10">
+      <view class="pop-content">
+        <view class="pop-title">
+          修改密码
+        </view>
+        <view class="pop-input">
+          <up-input placeholder="请输入新密码" border="surround" type="password" v-model="password"></up-input>
+        </view>
+        <view class="pop-btn flex justify-end">
+          <view class="pop-btns close" @click="close">
+            取消
+          </view>
+          <view class="pop-btns submit" @click="submit">
+            确定
+          </view>
+        </view>
+      </view>
+    </up-popup>
+
+    <up-popup :show="showLogoutConfirm" @close="closeLogoutConfirm" mode="center" :round="10">
+      <view class="pop-content">
+        <view class="pop-title">
+          确认退出登录?
+        </view>
+        <view class="pop-btn flex justify-end">
+          <view class="pop-btns close" @click="closeLogoutConfirm">
+            取消
+          </view>
+          <view class="pop-btns submit" @click="logout">
+            确定
+          </view>
+        </view>
+      </view>
+    </up-popup>
+  </view>
 </template>
 
 <script setup>
-	const {
-		proxy
-	} = getCurrentInstance();
-
-	onBeforeMount(() => {
-		//获取初始数据
-		getAli()
-	})
-
-	//-----------------------------------------支付宝提现号
-	let aliNo = ref(null)
-	
-	/**
-	 * 统计数据
-	 */
-	function getAli() {
-		proxy.request({
-			url: '/merc/merc-account-ratio-info/queryInfo'
-		}).then((res) => {
-			aliNo.value = res.accountAliDrawId
-		})
-	}
-
-	//-----------------------------------------修改密码
-	let show = ref(false)
-	let password = ref(null)
-
-	function open() {
-		show.value = true
-	}
-
-	function close() {
-		show.value = false
-		password.value = ''
-	}
-	/**
-	 * 修改密码
-	 */
-	function submit() {
-		if (!password.value) {
-			password.$modal.msg('请输入新密码')
-			return
-		}
-		proxy.request({
-			url: '/merc/merc-account-ratio-info/editPassword',
-			data: {
-				"password": password.value,
-			}
-		}).then((res) => {
-			close()
-			proxy.$modal.msg('修改成功')
-		})
-	}
+import useUserStore from '@/stores/user.js'
+
+const {
+  proxy
+} = getCurrentInstance();
+
+onBeforeMount(() => {
+  //获取初始数据
+  getAli()
+})
+
+//-----------------------------------------支付宝提现号
+let aliNo = ref(null)
+
+/**
+ * 统计数据
+ */
+function getAli() {
+  proxy.request({
+    url: '/merc/merc-account-ratio-info/queryInfo'
+  }).then((res) => {
+    aliNo.value = res.accountAliDrawId
+  })
+}
+
+//-----------------------------------------修改密码
+let show = ref(false)
+let password = ref(null)
+
+function open() {
+  show.value = true
+}
+
+function close() {
+  show.value = false
+  password.value = ''
+}
+/**
+ * 修改密码
+ */
+function submit() {
+  if (!password.value) {
+    password.$modal.msg('请输入新密码')
+    return
+  }
+  proxy.request({
+    url: '/merc/merc-account-ratio-info/editPassword',
+    data: {
+      "password": password.value,
+    }
+  }).then((res) => {
+    close()
+    proxy.$modal.msg('修改成功')
+  })
+}
+
+//-----------------------------------------退出登录
+let showLogoutConfirm = ref(false)
+
+function openLogoutConfirm() {
+  showLogoutConfirm.value = true
+}
+
+function closeLogoutConfirm() {
+  showLogoutConfirm.value = false
+}
+
+function logout() {
+  // proxy.request({
+  //   url: '/merc/logout'
+  // }).then((res) => {
+  //   closeLogoutConfirm()
+  //   proxy.$modal.msg('退出成功')
+  //   // 这里可以添加跳转到登录页面的逻辑
+  //
+  // })
+  useUserStore()
+      .LogOut()
+      .then((res) => {
+        uni.reLaunch({
+          url: '/pages/login',
+        })
+      })
+}
 </script>
 
 <style lang="scss">
-	.container {
-		.top {
-			position: relative;
-			width: 702rpx;
-			padding: 24rpx;
-			margin-left: 24rpx;
-			box-shadow: rgb(229, 229, 229) 0px 5px 20px -5px;
-			margin-top: 20rpx;
-
-			.item {
-				border-bottom: 1rpx solid #eee;
-				line-height: 100rpx;
-
-				.key {
-					font-size: 28rpx;
-					font-weight: bold;
-				}
-
-				.value {
-					font-size: 28rpx;
-				}
-			}
-		}
-
-		.pop-content {
-			width: 690rpx;
-			height: 600rpx;
-			padding: 24rpx;
-
-			.pop-title {
-				text-align: center;
-				line-height: 80rpx;
-				font-size: 34rpx;
-				font-weight: bold;
-			}
-
-			.pop-input {
-				margin-top: 40rpx;
-
-				.max {
-					line-height: 90rpx;
-					color: red;
-				}
-			}
-
-			.pop-btn {
-				position: absolute;
-				right: 20rpx;
-				bottom: 24rpx;
-
-				.pop-btns {
-					width: 120rpx;
-					line-height: 60rpx;
-					border: 1rpx solid #2C6FF3;
-					text-align: center;
-					border-radius: 60rpx;
-					color: #2C6FF3;
-					margin-left: 20rpx;
-
-					&.submit {
-						background-color: #2C6FF3;
-						color: #fff;
-					}
-				}
-			}
-		}
-	}
-</style>
+.container {
+  .top {
+    position: relative;
+    width: 702rpx;
+    padding: 24rpx;
+    margin-left: 24rpx;
+    box-shadow: rgb(229, 229, 229) 0px 5px 20px -5px;
+    margin-top: 20rpx;
+
+    .item {
+      border-bottom: 1rpx solid #eee;
+      line-height: 100rpx;
+
+      .key {
+        font-size: 28rpx;
+        font-weight: bold;
+      }
+
+      .value {
+        font-size: 28rpx;
+      }
+    }
+  }
+
+  .pop-content {
+    width: 690rpx;
+    height: 600rpx;
+    padding: 24rpx;
+
+    .pop-title {
+      text-align: center;
+      line-height: 80rpx;
+      font-size: 34rpx;
+      font-weight: bold;
+    }
+
+    .pop-input {
+      margin-top: 40rpx;
+
+      .max {
+        line-height: 90rpx;
+        color: red;
+      }
+    }
+
+    .pop-btn {
+      position: absolute;
+      right: 20rpx;
+      bottom: 24rpx;
+
+      .pop-btns {
+        width: 120rpx;
+        line-height: 60rpx;
+        border: 1rpx solid #2C6FF3;
+        text-align: center;
+        border-radius: 60rpx;
+        color: #2C6FF3;
+        margin-left: 20rpx;
+
+        &.submit {
+          background-color: #2C6FF3;
+          color: #fff;
+        }
+      }
+    }
+  }
+}
+</style>