浏览代码

feat uni 修改了首页的逻辑

GaoRunQi 9 月之前
父节点
当前提交
6900209870

+ 1 - 1
yudao-ui-admin-uniapp/pages/activity/groupon/detail.vue

@@ -295,7 +295,7 @@
       state.remainNumber = remainNumber > 0 ? remainNumber : 0;
 
       // 获取活动信息
-      const { data: activity } = await CombinationApi.getCombinationActivity(data.headRecord.activityId);
+      // const { data: activity } = await CombinationApi.getCombinationActivity(data.headRecord.activityId);
       state.activity = activity;
     } else {
       state.data = null;

+ 1 - 1
yudao-ui-admin-uniapp/pages/goods/groupon.vue

@@ -256,7 +256,7 @@
     }
     state.grouponId = options.id;
     // 加载活动信息
-    const { code, data: activity } = await CombinationApi.getCombinationActivity(state.grouponId);
+    // const { code, data: activity } = await CombinationApi.getCombinationActivity(state.grouponId);
     state.activity = activity;
     // 加载商品信息
     const { data: spu } = await SpuApi.getSpuDetail(activity.spuId);

+ 6 - 32
yudao-ui-admin-uniapp/pages/public/setting.vue

@@ -9,8 +9,8 @@
       <view class="name ss-m-b-24">{{ appInfo.name }}</view>
     </view>
 
-    <view class="container-list">
-      <uni-list :border="false">
+    <!-- <view class="container-list"> -->
+      <!-- <uni-list :border="false">
         <uni-list-item
           title="当前版本"
           :rightText="appInfo.version"
@@ -39,7 +39,7 @@
             })
           "
         />
-        <!-- 为了过审 只有 iOS-App 有注销账号功能 -->
+        为了过审 只有 iOS-App 有注销账号功能
         <uni-list-item
           v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
           title="注销账号"
@@ -50,36 +50,10 @@
           class="list-border"
           @click="onLogoff"
         />
-      </uni-list>
-    </view>
+      </uni-list> -->
+    <!-- </view> -->
     <view class="set-footer ss-flex-col ss-row-center ss-col-center">
-      <view class="agreement-box ss-flex ss-col-center ss-m-b-40">
-        <view class="ss-flex ss-col-center ss-m-b-10">
-          <view
-            class="tcp-text"
-            @tap="
-              sheep.$router.go('/pages/public/richtext', {
-                title: '用户协议'
-              })
-            "
-          >
-            《用户协议》
-          </view>
-          <view class="agreement-text">与</view>
-          <view
-            class="tcp-text"
-            @tap="
-              sheep.$router.go('/pages/public/richtext', {
-                title: '隐私协议'
-              })
-            "
-          >
-            《隐私协议》
-          </view>
-        </view>
-      </view>
-      <view class="copyright-text ss-m-b-10">{{ appInfo.copyright }}</view>
-      <view class="copyright-text">{{ appInfo.copytime }}</view>
+
     </view>
     <su-fixed bottom placeholder>
       <view class="ss-p-x-20 ss-p-b-40">

+ 16 - 16
yudao-ui-admin-uniapp/pages/user/address/edit.vue

@@ -10,11 +10,11 @@
 				</uni-forms-item>
 
 				<uni-forms-item name="mobile" label="手机号" class="form-item">
-					<uni-easyinput v-model="state.model.mobile" type="number" placeholder="请输入手机号" :inputBorder="false"
+					<uni-easyinput v-model="state.model.phone" type="number" placeholder="请输入手机号" :inputBorder="false"
 						placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal">
 					</uni-easyinput>
 				</uni-forms-item>
-				<uni-forms-item name="areaName" label="省市区" @tap="state.showRegion = true" class="form-item">
+				<!-- <uni-forms-item name="areaName" label="省市区" @tap="state.showRegion = true" class="form-item">
 					<uni-easyinput v-model="state.model.areaName" disabled :inputBorder="false"
 						:styles="{ disableColor: '#fff', color: '#333' }"
 						placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
@@ -23,27 +23,27 @@
 							<uni-icons type="right" />
 						</template>
 					</uni-easyinput>
-				</uni-forms-item>
-				<uni-forms-item name="detailAddress" label="详细地址" :formItemStyle="{ alignItems: 'flex-start' }"
+				</uni-forms-item> -->
+				<uni-forms-item name="address" label="详细地址" :formItemStyle="{ alignItems: 'flex-start' }"
 					:labelStyle="{ lineHeight: '5em' }" class="textarea-item">
-					<uni-easyinput :inputBorder="false" type="textarea" v-model="state.model.detailAddress"
+					<uni-easyinput :inputBorder="false" type="textarea" v-model="state.model.address"
 						placeholderStyle="color:#BBBBBB;font-size:30rpx;font-weight:400;line-height:normal"
 						placeholder="请输入详细地址" clearable />
 				</uni-forms-item>
 			</view>
-			<view class="ss-m-y-20 bg-white ss-p-x-30 ss-flex ss-row-between ss-col-center default-box">
+			<!-- <view class="ss-m-y-20 bg-white ss-p-x-30 ss-flex ss-row-between ss-col-center default-box">
 				<view class="default-box-title"> 设为默认地址 </view>
 				<su-switch style="transform: scale(0.8)" v-model="state.model.defaultStatus" />
-			</view>
+			</view> -->
 		</uni-forms>
 		<su-fixed bottom :opacity="false" bg="" placeholder :noFixed="false" :index="10">
 			<view class="footer-box ss-flex-col ss-row-between ss-p-20">
 				<view class="ss-m-b-20">
           <button class="ss-reset-button save-btn ui-Shadow-Main" @tap="onSave">保存</button>
         </view>
-				<button v-if="state.model.id" class="ss-reset-button cancel-btn" @tap="onDelete">
+				<!-- <button v-if="state.model.id" class="ss-reset-button cancel-btn" @tap="onDelete">
 					删除
-				</button>
+				</button> -->
 			</view>
 		</su-fixed>
 
@@ -66,8 +66,8 @@
 		showRegion: false,
 		model: {
 			name: '',
-			mobile: '',
-      detailAddress: '',
+			phone: '',
+     	 address: '',
 			defaultStatus: false,
       areaName: '',
 		},
@@ -84,7 +84,7 @@
       ],
     },
     mobile,
-    detailAddress: {
+    address: {
       rules: [{
         required: true,
         errorMessage: '请输入详细地址',
@@ -160,13 +160,13 @@
     // 获得地区数据
 		getAreaData();
     // 情况一:基于 id 获得收件地址
-		if (options.id) {
+		// if (options.id) {
 			let { code, data} = await AddressApi.getAddress(options.id);
       if (code !== 0) {
         return;
       }
       state.model = data;
-		}
+		// }
      // 情况二:微信导入
     if (options.data) {
       let data = JSON.parse(options.data);
@@ -183,8 +183,8 @@
         areaId,
         areaName: [data.province_name, data.city_name, data.district_name].filter(Boolean).join(" "),
         defaultStatus: false,
-        detailAddress: data.address,
-        mobile: data.mobile,
+        address: data.address,
+        phone: data.phone,
         name: data.consignee,
       };
 		}

+ 5 - 6
yudao-ui-admin-uniapp/sheep/api/member/address.js

@@ -11,7 +11,7 @@ const AddressApi = {
   // 创建用户收件地址
   createAddress: (data) => {
     return request({
-      url: '/member/address/create',
+      url: '/restaurant/address/update',
       method: 'POST',
       data,
       custom: {
@@ -23,8 +23,8 @@ const AddressApi = {
   // 更新用户收件地址
   updateAddress: (data) => {
     return request({
-      url: '/member/address/update',
-      method: 'PUT',
+      url: '/restaurant/address/update',
+      method: 'POST',
       data,
       custom: {
         showSuccess: true,
@@ -35,9 +35,8 @@ const AddressApi = {
   // 获得用户收件地址
   getAddress: (id) => {
     return request({
-      url: '/member/address/get',
-      method: 'GET',
-      params: { id }
+      url: '/restaurant/address/get',
+      method: 'POST',
     });
   },
   // 删除用户收件地址

+ 1 - 1
yudao-ui-admin-uniapp/sheep/components/s-auth-modal/s-auth-modal.vue

@@ -10,7 +10,7 @@
       />
 
       <!-- 2. 短信登录  smsLogin -->
-      <sms-login v-if="authType === 'smsLogin'" :agreeStatus="state.protocol" @onConfirm="onConfirm" />
+      <!-- <sms-login v-if="authType === 'smsLogin'" :agreeStatus="state.protocol" @onConfirm="onConfirm" /> -->
 
       <!-- 3. 忘记密码 resetPassword-->
       <reset-password v-if="authType === 'resetPassword'" />

+ 2 - 2
yudao-ui-admin-uniapp/sheep/components/s-custom-navbar/s-custom-navbar.vue

@@ -18,9 +18,9 @@
               <text class="sicon-home" v-else />
             </view>
             <view class="line"></view>
-            <view class="icon-button icon-button-right ss-flex ss-row-center" @tap="onClickRight">
+            <!-- <view class="icon-button icon-button-right ss-flex ss-row-center" @tap="onClickRight">
               <text class="sicon-more" />
-            </view>
+            </view> -->
           </view>
         </view>
         <view

+ 1 - 1
yudao-ui-admin-uniapp/sheep/components/s-groupon-block/s-groupon-block.vue

@@ -114,7 +114,7 @@
   const productList = ref([]);
   onMounted(async () => {
     // todo:@owen 与Yudao结构不一致,待重构
-    const { data: activity } = await CombinationApi.getCombinationActivity(props.data.activityId);
+    // const { data: activity } = await CombinationApi.getCombinationActivity(props.data.activityId);
     const { data: spu } = await SpuApi.getSpuDetail(activity.spuId)
     productList.value = [spu];
   });

+ 1 - 1
yudao-ui-admin-uniapp/sheep/components/s-layout/s-layout.vue

@@ -37,7 +37,7 @@
         <slot />
 
         <!-- 底部导航 -->
-        <s-tabbar v-if="tabbar !== ''" :path="tabbar" />
+        <!-- <s-tabbar v-if="tabbar !== ''" :path="tabbar" /> -->
       </view>
     </view>
 

+ 30 - 30
yudao-ui-admin-uniapp/sheep/components/s-menu-tools/s-menu-tools.vue

@@ -39,36 +39,36 @@
       icon: '/static/img/shop/tools/home.png',
       title: '首页',
     },
-    {
-      url: '/pages/index/search',
-      icon: '/static/img/shop/tools/search.png',
-      title: '搜索',
-    },
-    {
-      url: '/pages/index/user',
-      icon: '/static/img/shop/tools/user.png',
-      title: '个人中心',
-    },
-    {
-      url: '/pages/index/cart',
-      icon: '/static/img/shop/tools/cart.png',
-      title: '购物车',
-    },
-    {
-      url: '/pages/user/goods-log',
-      icon: '/static/img/shop/tools/browse.png',
-      title: '浏览记录',
-    },
-    {
-      url: '/pages/user/goods-collect',
-      icon: '/static/img/shop/tools/collect.png',
-      title: '我的收藏',
-    },
-    {
-      url: '/pages/chat/index',
-      icon: '/static/img/shop/tools/service.png',
-      title: '客服',
-    },
+    // {
+    //   url: '/pages/index/search',
+    //   icon: '/static/img/shop/tools/search.png',
+    //   title: '搜索',
+    // },
+    // {
+    //   url: '/pages/index/user',
+    //   icon: '/static/img/shop/tools/user.png',
+    //   title: '个人中心',
+    // },
+    // {
+    //   url: '/pages/index/cart',
+    //   icon: '/static/img/shop/tools/cart.png',
+    //   title: '购物车',
+    // },
+    // {
+    //   url: '/pages/user/goods-log',
+    //   icon: '/static/img/shop/tools/browse.png',
+    //   title: '浏览记录',
+    // },
+    // {
+    //   url: '/pages/user/goods-collect',
+    //   icon: '/static/img/shop/tools/collect.png',
+    //   title: '我的收藏',
+    // },
+    // {
+    //   url: '/pages/chat/index',
+    //   icon: '/static/img/shop/tools/service.png',
+    //   title: '客服',
+    // },
   ];
 </script>
 

+ 1 - 1
yudao-ui-admin-uniapp/sheep/components/s-tabbar/s-tabbar.vue

@@ -26,7 +26,7 @@
           <image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.iconUrl)"></image>
         </template>
       </su-tabbar-item>
-    </su-tabbar>
+    </su-tabbar> 
   </view>
 </template>
 

+ 27 - 9
yudao-ui-admin-uniapp/sheep/components/s-user-card/s-user-card.vue

@@ -16,23 +16,32 @@
 					</view>
 				</view>
 			</view>
-			<view class="right-box ss-m-r-52">
-				<button class="ss-reset-button" @tap="showShareModal">
-					<text class="sicon-qrcode"></text>
+			<view class="right-box ss-m-r-52" v-show="isLogin">
+				<button class="ss-reset-button"  @tap="sheep.$router.go('/pages/public/setting')">
+					<!-- <text class="sicon-qrcode"></text> -->
+					 {{'设置 >'}}
 				</button>
 			</view>
 		</view>
 
 		<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
 		<view
-      class="bind-mobile-box ss-flex ss-row-between ss-col-center"
-      v-if="isLogin && !userInfo.mobile"
+      v-if="isLogin "
+	  style="background-color: #fff;"
     >
-      <view class="ss-flex">
+	<view style="font-size: 25px;padding:10px; border-bottom: 1px solid black;width: 100%;" >收货地址</view><br/>
+	<view style="width: 100%;padding:10px;" class="ss-flex" >
+		<view style="width: 40%;font-size: 20px;">{{ addressList.name }}</view>
+		<view style="width: 50%;font-size: 20px;">{{ addressList.phone }}</view>
+	</view>
+	<view style="width: 100%;padding:10px;" >{{ addressList.address }}</view>
+	<button style="margin: 20px;" type="primary" @tap="sheep.$router.go('/pages/user/address/edit')">修改地址</button>
+	<!-- {{ addressList }} -->
+      <!-- <view class="ss-flex">
         <text class="cicon-mobile-o" />
         <view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
-      </view>
-      <button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button>
+      </view> -->
+      <!-- <button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button> -->
     </view>
 	</view>
 </template>
@@ -65,7 +74,16 @@
 	// 用户信息
 	const userInfo = computed(() => sheep.$store('user').userInfo);
 	console.log('用户信息', userInfo)
-
+	const addressList = computed(() => {
+		let addressList = sheep.$store('user').addressList
+		console.log('addressList', addressList)
+		if(addressList){
+			return addressList
+		}else{
+			sheep.$router.go('/pages/user/address/edit')
+		}
+	
+	})
 	// 是否登录
 	const isLogin = computed(() => sheep.$store('user').isLogin);
 	// 接收参数

+ 3 - 3
yudao-ui-admin-uniapp/sheep/store/app.js

@@ -61,11 +61,11 @@ const app = defineStore({
       // TODO 芋艿:未来支持管理后台可配;对应 https://api.shopro.sheepjs.com/shop/api/init
       if (true) {
         this.info = {
-          name: '芋道商城',
+          name: '日顺饭店',
           logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
           version: '1.1.13',
-          copyright: '全部开源,个人与企业可 100% 免费使用',
-          copytime: 'Copyright© 2018-2024',
+          copyright: '',
+          copytime: '',
 
           cdnurl: 'https://file.sheepjs.com', // 云存储域名
           filesystem: 'qcloud', // 云存储平台

+ 12 - 1
yudao-ui-admin-uniapp/sheep/store/user.js

@@ -8,6 +8,7 @@ import UserApi from '@/sheep/api/member/user';
 import PayWalletApi from '@/sheep/api/pay/wallet';
 import OrderApi from '@/sheep/api/trade/order';
 import CouponApi from '@/sheep/api/promotion/coupon';
+import AddressApi from '@/sheep/api/member/address';
 
 // 默认用户信息
 const defaultUserInfo = {
@@ -22,6 +23,8 @@ const defaultUserInfo = {
 const defaultUserWallet = {
   balance: 0, // 余额
 };
+// 默认收货地址
+const defaultAddressList = []
 
 // 默认订单、优惠券等其他资产信息
 const defaultNumData = {
@@ -44,6 +47,7 @@ const user = defineStore({
     isLogin: !!uni.getStorageSync('token'), // 登录状态
     numData: cloneDeep(defaultNumData), // 用户其他数据
     lastUpdateTime: 0, // 上次更新时间
+    addressList:clone(defaultAddressList)
   }),
 
   actions: {
@@ -79,7 +83,13 @@ const user = defineStore({
         }
       });
     },
-
+  getAddress(){
+    AddressApi.getAddress().then(res=>{
+      if(res.code===0){
+        this.addressList=res.data
+      }
+    })
+  },
     // 添加分享记录
     // TODO 芋艿:整理下;
     // async addShareLog(params) {
@@ -121,6 +131,7 @@ const user = defineStore({
       await this.getInfo();
       this.getWallet();
       this.getNumData();
+      this.getAddress()
       return this.userInfo;
     },