소스 검색

feat: 店铺收藏更新

Basil 2 년 전
부모
커밋
d7f89fd947

+ 4 - 0
src/App.vue

@@ -1,10 +1,14 @@
1 1
 <script setup lang="ts">
2 2
 import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
3
+import {useAddressStore} from "~/stores/addressStore";
4
+const addressStore = useAddressStore()
5
+
3 6
 onLaunch(() => {
4 7
   console.log("App Launch");
5 8
 });
6 9
 onShow(() => {
7 10
   console.log("App Show");
11
+  addressStore.getCurrentAddress()
8 12
 });
9 13
 onHide(() => {
10 14
   console.log("App Hide");

+ 6 - 2
src/apis/merchant.ts

@@ -1,5 +1,5 @@
1 1
 import { defHttp } from '~/utils/http'
2
-import type {MerchantCategoryModel, StoreParams, StoreResult} from "~/apis/model/storeModel";
2
+import type {MerchantCategoryModel, MerchantDetailModel, StoreParams, StoreResult} from "~/apis/model/storeModel";
3 3
 import type {PageModel} from "~/apis/model/pageModel";
4 4
 import type {ZibubaojianResult} from "~/apis/model/zibubaojian.model";
5 5
 import type {VipAreaResult} from "~/apis/model/vip-area.model";
@@ -37,7 +37,11 @@ export function getSelectMerchantSort() {
37 37
     })
38 38
 }
39 39
 
40
-export function getMerchantDetail(id: string) {
40
+/**
41
+ * 获取商铺详情 getShopInfo
42
+ * @param id
43
+ */
44
+export function getMerchantDetail(id: string): Promise<MerchantDetailModel> {
41 45
     return defHttp.get({
42 46
         url: API.GET_DETAIL + `/${id}`
43 47
     }, {

+ 6 - 0
src/apis/model/relation.model.ts

@@ -0,0 +1,6 @@
1
+export interface RelationRequest {
2
+    // 1 商品,10 店铺
3
+    type: string
4
+    // 商品ID,店铺ID
5
+    type_id: string
6
+}

+ 1 - 1
src/apis/model/shopping.model.ts

@@ -44,4 +44,4 @@ export interface ProductAttrDataModel {
44 44
     unique: string
45 45
     sku: string
46 46
     image: string
47
-}
47
+}

+ 82 - 0
src/apis/model/storeModel.ts

@@ -1,3 +1,85 @@
1
+export interface MerchantDetailModel {
2
+    mer_id: string//商户id
3
+    uid: string//商户用户id
4
+    merch_no: string
5
+    trade_type: string
6
+    category_id: string//分类id
7
+    mer_name: string//店铺名称
8
+    haike_settle_status: string
9
+    name: string
10
+    distance: string//距离
11
+    mer_address: string//店铺地址
12
+    mer_keyword: string
13
+    mer_avatar: string//店铺头像
14
+    mer_banner: string//店铺轮播图
15
+    sales: string//销量
16
+    product_score: string//商品描述评分
17
+    service_score: string//服务评分
18
+    postage_score: string//物流评分
19
+    mark: string
20
+    status: string//商户是否禁用0锁定,1正常
21
+    commission_rate: string
22
+    is_bro_room: string
23
+    is_bro_goods: string
24
+    mer_info: string//店铺简介
25
+    service_phone: string//店铺电话
26
+    create_time: string//创建时间
27
+    care_count: string//关注总数
28
+    copy_product_num: string
29
+    lat: string//纬度
30
+    lng: string//经度
31
+    doorhead: string//门头照
32
+    addr: string
33
+    house_number: string
34
+    business_license: string//营业执照
35
+    recommender: string//推广员
36
+    content_pic: string
37
+    card_positive_person: string
38
+    card_back_person: string
39
+    email: string//邮箱
40
+    bank_account: string
41
+    bank_location: string
42
+    bank_deposit: string
43
+    bank_branch: string
44
+    open_account: string//开户许可证
45
+    logo: string//logo
46
+    business_addr: string
47
+    district_addr: string
48
+    type: string
49
+    province_id: string
50
+    city_id: string
51
+    area_id: string
52
+    street_id: string
53
+    branch: string
54
+    business_id: string
55
+    request_id: string
56
+    renqizhi: string
57
+    withdrawal_setting: string
58
+    haike_mp: string
59
+    member_no: string
60
+    sxy_submerchant_id: string
61
+    buy_time: string
62
+    tz_money: string
63
+    tz_integral: string
64
+    hf_status: string
65
+    hf_member_id: string
66
+    hf_member_id_wx: string
67
+    hf_msg: string
68
+    merchant_type: string
69
+    hf_type: string
70
+    expire_time: string
71
+    hf_dimension_id_wx: string
72
+    hf_dimension_id_al: string
73
+    hf_pingtai_id_al: string
74
+    hf_pingtai_id_wx: string
75
+    dc_id: string
76
+    care: boolean
77
+    like: boolean
78
+    topping: boolean
79
+    // private boolean care: string//关注
80
+    // private boolean like: string
81
+    // private boolean topping
82
+}
1 83
 export interface StoreParams {
2 84
     // 分页
3 85
     pageNum: number

+ 12 - 0
src/apis/order.api.ts

@@ -66,6 +66,18 @@ enum API {
66 66
     CHECK_GROUP_ORDER = '/api/order/check_group_order'
67 67
 }
68 68
 
69
+/**
70
+ * 三方订单
71
+ * @param params
72
+ */
73
+export function getThirdOrder(params: { type: string, page: number, limit: 10 | number}) {
74
+    return defHttp.get({
75
+        url: API.USER_THIRD_ORDER,
76
+        data: {
77
+            ...params
78
+        }
79
+    })
80
+}
69 81
 
70 82
 // 检查大仓会员
71 83
 export function checkGroupOrder(id: string) {

+ 27 - 2
src/apis/user.ts

@@ -27,6 +27,7 @@ import type {ShoppingResult} from "~/apis/model/shopping.model";
27 27
 import type {AddressResult, OneAddressModel} from "~/apis/model/address.model";
28 28
 import type {UserVipInfoModel} from "~/apis/model/user-vip-info.model";
29 29
 import type {CertificationRequest} from "~/apis/model/certification.model";
30
+import type {RelationRequest} from "~/apis/model/relation.model";
30 31
 
31 32
 // 会员中心的提现
32 33
 // export function entropy(data) {
@@ -131,11 +132,35 @@ enum API {
131 132
     CREATE_USER_ADDRESS = '/api/user/address/new_create',
132 133
     USER_ADDRESS_DETAIL = '/api/user/address/detail',
133 134
     USER_VIP_INFO = '/api/warehouse/UserVipInfo',
135
+    DELETE_USER_ADDRESS = '/api/user/address/delete',
134 136
 
135
-    USER_ADD_CERTIFICATION = '/api/user/add_certification'
137
+    USER_ADD_CERTIFICATION = '/api/user/add_certification',
138
+
139
+   // 关注商铺
140
+    USER_RELATION_CREATE = '/api/user/relation/create',
136 141
     // getCertification
137 142
 }
138 143
 
144
+/* 关注/收藏
145
+ */
146
+export function relation(params: RelationRequest) {
147
+    return defHttp.post({
148
+        url: API.USER_RELATION_CREATE,
149
+        data: {
150
+            ...params
151
+        }
152
+    })
153
+}
154
+/**
155
+ * 删除地址
156
+ * @param id
157
+ */
158
+export function deleteAddress(id: string) {
159
+    return defHttp.post({
160
+        url: API.DELETE_USER_ADDRESS + `/${id}`
161
+    })
162
+}
163
+
139 164
 /**
140 165
  * 五级联动地址
141 166
  * @param pid
@@ -180,7 +205,7 @@ export function submitCertification(params: CertificationRequest) {
180 205
  */
181 206
 export function getUserAddressDetail(id: string) {
182 207
     return defHttp.get({
183
-        url: API.USER_ADDRESS_DETAIL + `/?id=${id}`
208
+        url: API.USER_ADDRESS_DETAIL + `/${id}`
184 209
     })
185 210
 }
186 211
 export function addressNewCreate(params: {

+ 4 - 0
src/auto-imports.d.ts

@@ -86,6 +86,7 @@ declare global {
86 86
   const toValue: typeof import('vue')['toValue']
87 87
   const triggerRef: typeof import('vue')['triggerRef']
88 88
   const unref: typeof import('vue')['unref']
89
+  const useAddressStore: typeof import('./stores/addressStore')['useAddressStore']
89 90
   const useAppStore: typeof import('./stores/app')['useAppStore']
90 91
   const useAppStoreWidthOut: typeof import('./stores/app')['useAppStoreWidthOut']
91 92
   const useAttrs: typeof import('vue')['useAttrs']
@@ -95,6 +96,7 @@ declare global {
95 96
   const useCustomStyleProp: typeof import('./composables/useProps')['useCustomStyleProp']
96 97
   const useDacangStore: typeof import('./stores/dacangStore')['useDacangStore']
97 98
   const useDirectionProp: typeof import('./composables/useProps')['useDirectionProp']
99
+  const useOrderStore: typeof import('./stores/addressStore')['useOrderStore']
98 100
   const usePageStore: typeof import('./stores/page')['usePageStore']
99 101
   const usePageStoreWidthOut: typeof import('./stores/page')['usePageStoreWidthOut']
100 102
   const useSizeProp: typeof import('./composables/useProps')['useSizeProp']
@@ -197,6 +199,7 @@ declare module 'vue' {
197 199
     readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
198 200
     readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
199 201
     readonly unref: UnwrapRef<typeof import('vue')['unref']>
202
+    readonly useAddressStore: UnwrapRef<typeof import('./stores/addressStore')['useAddressStore']>
200 203
     readonly useAppStore: UnwrapRef<typeof import('./stores/app')['useAppStore']>
201 204
     readonly useAppStoreWidthOut: UnwrapRef<typeof import('./stores/app')['useAppStoreWidthOut']>
202 205
     readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>
@@ -302,6 +305,7 @@ declare module '@vue/runtime-core' {
302 305
     readonly toValue: UnwrapRef<typeof import('vue')['toValue']>
303 306
     readonly triggerRef: UnwrapRef<typeof import('vue')['triggerRef']>
304 307
     readonly unref: UnwrapRef<typeof import('vue')['unref']>
308
+    readonly useAddressStore: UnwrapRef<typeof import('./stores/addressStore')['useAddressStore']>
305 309
     readonly useAppStore: UnwrapRef<typeof import('./stores/app')['useAppStore']>
306 310
     readonly useAppStoreWidthOut: UnwrapRef<typeof import('./stores/app')['useAppStoreWidthOut']>
307 311
     readonly useAttrs: UnwrapRef<typeof import('vue')['useAttrs']>

+ 4 - 4
src/components/CXBSkuPopup/CXBSkuPopup.vue

@@ -15,7 +15,8 @@ const props = defineProps({
15 15
     default: false
16 16
   },
17 17
   detail: {
18
-    type: Object
18
+    type: Object,
19
+    required: true
19 20
   },
20 21
   sku: {
21 22
     type: Array,
@@ -105,13 +106,13 @@ function handleCountChange(value) {
105 106
       <div class="flex-1">
106 107
         <div class="p-3 flex flex-col gap-3">
107 108
           <div class="flex flex-row gap-3">
108
-            <image :src="currentSku.image"
109
+            <image :src="detail.image"
109 110
                    v-if="currentSku"
110 111
                    mode="widthFix" class="w-25 h-25 rounded"></image>
111 112
             <div class="flex flex-col w-full">
112 113
 
113 114
               <div class="flex gap-2 justify-between w-full">
114
-                <div class="text-overflow text-xs flex-1">
115
+                <div class="text-overflow text-xs flex-1" v-if="detail && detail.store_name">
115 116
                   {{ detail.store_name }}
116 117
                 </div>
117 118
                 <div
@@ -159,7 +160,6 @@ function handleCountChange(value) {
159 160
         <FButton
160 161
             @click="handleAddCart"
161 162
             size="small"
162
-            type="fill"
163 163
             :exClass="['!bg-primary', 'rounded-full', 'text-white']"
164 164
             block
165 165
         >

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
src/pages.json


+ 13 - 3
src/pages/home/components/navs.vue

@@ -60,12 +60,15 @@ const navList = ref([{
60 60
 }, {
61 61
   image: CDN_URL + '/static/home-nav/vip_img.png',
62 62
   title: '会员专区',
63
-  key: PLATFORM_NAME.DC,
64
-  categoryId: '567',
63
+  key: 'vip',
64
+  // key: PLATFORM_NAME.DC,
65
+  // categoryId: '567',
65 66
 }, {
66 67
   image: CDN_URL + '/static/home-nav/icon_hmyh_221014.png',
67 68
   title: '惠民专区',
68
-  key: PLATFORM_NAME.DC
69
+  key: PLATFORM_NAME.DC,
70
+  categoryId: '567',
71
+
69 72
 }, {
70 73
   image: CDN_URL + '/static/home-nav/home_gengduo.png',
71 74
   title: '更多',
@@ -94,6 +97,13 @@ function handleItemClick(item: any) {
94 97
       })
95 98
       break;
96 99
     }
100
+    // 会员专区
101
+    case 'vip': {
102
+      uni.navigateTo({
103
+        url: '/pages/vip/index'
104
+      })
105
+      break;
106
+    }
97 107
     // 秒杀
98 108
     case 'miaosha': {
99 109
       uni.navigateTo({

+ 5 - 3
src/pages/home/index.vue

@@ -15,6 +15,7 @@ import {CDN_URL} from "~/config/app";
15 15
 // import CXBDialogSIgnIn from "~/components/CXBDialogSignIn/CXBDialogSIgnIn.vue";
16 16
 // import CXBDialogSIgnInSucceed from "~/components/CXBDialogSignInSucceed/CXBDialogSIgnInSucceed.vue";
17 17
 const userStore = useUserStore()
18
+
18 19
 // const list = ref([])
19 20
 const state = reactive({
20 21
   yanglaojine: {},
@@ -47,9 +48,10 @@ onShow(() => {
47 48
 })
48 49
 onLoad(() => {
49 50
   // getLocal()
51
+  // 加载地址数据
52
+  // orderStore.getCurrentAddress()
50 53
   // 1加载首页数据
51
-  getHomeQuickLink().then(res => {
52
-  })
54
+  getHomeQuickLink().then(res => {})
53 55
 
54 56
   getNoticeList().then(res => {
55 57
     state.announcementList = res.list
@@ -146,7 +148,7 @@ page {
146 148
   background-color: #f8f8f8;
147 149
 }
148 150
 </style>
149
-<route lang="yaml" type="home">
151
+<route lang="yaml">
150 152
 style:
151 153
   navigationStyle: custom
152 154
   navigationBarTitleText: 储蓄保

+ 50 - 33
src/pages/order-confirm/index.vue

@@ -6,8 +6,13 @@ import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
6 6
 import FPrice from "~/components/FPrice/FPrice.vue";
7 7
 import CXBYaojinTag from "~/components/CXBYaojinTag/CXBYaojinTag.vue";
8 8
 import FCell from "~/components/FCell/FCell.vue";
9
-
9
+import {encodePhone} from "~/utils";
10
+import {CDN_URL} from "~/config/app";
11
+import {useAddressStore} from "~/stores/addressStore";
12
+import {watchThrottled} from "@vueuse/core";
13
+const addressIcon = CDN_URL + '/static/assets/dingwi_220624.png'
10 14
 // const addressInfo = ref({})
15
+const addressStore = useAddressStore()
11 16
 const data = reactive({
12 17
   cartOrder: [],
13 18
 
@@ -25,41 +30,29 @@ const data = reactive({
25 30
   // proPrice: ''
26 31
 })
27 32
 onLoad((options) => {
28
-  // type
29
-  // product_id
30
-  // seckillId
31
-  // couponId
32
-  // pinkid
33
-  // cartId
34
-  // addressId
35
-  // is_address
36
-  // {cartId: "10149", type: "1", product_id: "5596"}
37
-  // console.log(options)
38
-  // options = {
39
-  //   cartId: '10149',
40
-  //   type: '1',
41
-  //   product_id: '5596'
42
-  // }
43 33
 
44
-  console.log(options.cartId)
34
+  // console.log(options.cartId)
45 35
   if (options && options.cartId) {
46 36
     data.cartId = options.cartId
47 37
   }
48 38
   if (options && options.product_id) {
49 39
     data.productId = options.product_id
50 40
   }
51
-  if (options && options.addressId) {
52
-    getUserAddressDetail(options.addressId).then(res => {
53
-      data.addressInfo = res
54
-      data.addressId = res.address_id || 0
55
-    })
56
-  } else {
57
-    getUserAddressList().then(res => {
58
-      data.addressInfo = res.list.length > 0 ? res.list[0] : {}
59
-      data.addressId = res.list.length > 0 ? res.list[0].address_id : '0'
60
-    })
61
-  }
41
+  // if (options && options.addressId) {
42
+  //   // getUserAddressDetail(options.addressId).then(res => {
43
+  //   //   data.addressInfo = res
44
+  //   //   data.addressId = res.address_id || 0
45
+  //   // })
46
+  // } else {
47
+  //   getUserAddressList().then(res => {
48
+  //     data.addressInfo = res.list.length > 0 ? res.list[0] : {}
49
+  //     data.addressId = res.list.length > 0 ? res.list[0].address_id : '0'
50
+  //   })
51
+  // }
52
+  data.addressInfo = addressStore.address
53
+  data.addressId = addressStore.address.address_id
62 54
 
55
+  // console.log(addressStore.address)
63 56
   /// 查看用户VIP信息
64 57
   getUserVipInfo().then(res => {
65 58
     console.log(res)
@@ -83,6 +76,10 @@ onLoad((options) => {
83 76
   })
84 77
 })
85 78
 
79
+watch(() => addressStore.address, (val) => {
80
+  data.addressInfo = val
81
+  data.addressId = val.address_id
82
+})
86 83
 function handleSubmit() {
87 84
   if (!data.addressId) {
88 85
     return uni.showToast({
@@ -155,23 +152,43 @@ function payment(createOrderData: CreateOrderRequest) {
155 152
     })
156 153
   })
157 154
 }
155
+
156
+function handleAddressSelect() {
157
+  uni.navigateTo({
158
+    url: '/pages/user/address/index?from=order'
159
+  })
160
+}
158 161
 </script>
159 162
 <template>
160 163
   <CXBBasePage>
161 164
     <div class="p-3 flex flex-col gap-3 pb-safe">
162
-      <div class="rounded bg-white p-3">
165
+      <div
166
+          @click="handleAddressSelect"
167
+          class="rounded bg-white p-3 flex">
163 168
         <div class="flex flex-col flex-1 gap-2">
164 169
           <div class="flex items-center gap-2">
165
-            <div class="flex text-sm text-gray-500">
166
-              {{ data.addressInfo.province + ' ' + data.addressInfo.city + ' ' + data.addressInfo.district }}
170
+            <div class="flex text-sm text-gray-500 justify-between items-center w-full">
171
+              <div class="flex-1 flex items-center gap-2">
172
+                <div class="w-fit flex">
173
+                  <image :src="addressIcon" mode="widthFix" class="w-4 h-4"></image>
174
+                </div>
175
+                <div class="flex-1 flex">
176
+                  {{ data.addressInfo.province + ' ' + data.addressInfo.city + ' ' + data.addressInfo.district }}
177
+                </div>
178
+              </div>
179
+
180
+              <div class="w-4 flex i-tabler-chevron-right text-gray"></div>
181
+
167 182
             </div>
168 183
           </div>
169
-          <div class="flex text-sm font-bold">{{ data.addressInfo.detail }}</div>
184
+<!--          <div class="flex text-sm font-bold">{{ data.addressInfo.detail }}</div>-->
170 185
           <div class="flex gap-2 items-center text-xs text-gray-500">
171 186
             <div>
172 187
               {{ data.addressInfo.real_name }}
173 188
             </div>
174
-            <div>{{ data.addressInfo.phone }}</div>
189
+            <div v-if="data.addressInfo && data.addressInfo.phone">
190
+              {{ encodePhone(data.addressInfo.phone) }}
191
+            </div>
175 192
           </div>
176 193
         </div>
177 194
       </div>

+ 50 - 44
src/pages/order/components/OrderItem.vue

@@ -1,20 +1,53 @@
1 1
 <template>
2
-  <div
3
-      @click="handleHeaderClick"
4
-      class="flex items-center justify-between f-hairline-bottom pb-3">
5
-    <div class="flex items-center font-bold gap-2 text-sm">
6
-      <image :src="orderItem.merchant.mer_avatar" mode="widthFix" class="w-4 h-4"></image>
7
-      {{ orderItem.merchant.mer_name }}
8
-    </div>
9
-    <div class="text-primary text-sm">
10
-      {{ getStatusText(orderItem) }}
2
+  <div class="mb-3 bg-white rounded p-3">
3
+    <div
4
+        @click="handleHeaderClick"
5
+        class="flex items-center justify-between f-hairline-bottom pb-3">
6
+      <div class="flex items-center font-bold gap-2 text-sm">
7
+        <image :src="orderItem.merchant.mer_avatar" mode="widthFix" class="w-4 h-4"></image>
8
+        {{ orderItem.merchant.mer_name }}
9
+      </div>
10
+      <div class="text-primary text-xs">
11
+        {{ getStatusText(orderItem) }}
12
+      </div>
11 13
     </div>
12
-  </div>
13 14
 
14 15
 
15
-  <div v-if="orderItem.orderList">
16
-    <div v-for="(order, index) in orderItem.orderList" :key="index">
17
-      <div v-for="(orderProduct, orderProductIndex) in order.orderProduct" :key="orderProductIndex">
16
+    <div v-if="orderItem.orderList">
17
+      <div v-for="(order, index) in orderItem.orderList" :key="index">
18
+        <div v-for="(orderProduct, orderProductIndex) in order.orderProduct" :key="orderProductIndex">
19
+          <div class="flex py-2 gap-3">
20
+            <div class="flex-1 flex gap-2">
21
+              <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
22
+
23
+              <div class="flex flex-col">
24
+                <div class="line-clamp-2 text-[12px]">
25
+                  {{ orderProduct.cart_info.product.store_name }}
26
+                </div>
27
+                <div class="text-gray-500 text-[10px]">
28
+                  {{ orderProduct.cart_info.productAttr.sku }}
29
+                </div>
30
+              </div>
31
+            </div>
32
+
33
+            <div class="flex flex-col justify-center items-center">
34
+              <FPrice :price="orderProduct.cart_info.product.price" ex-class="font-bold text-[12px] !text-[#000]"></FPrice>
35
+              <div class="text-gray-500 text-[11px]">共{{ orderProduct.product_num }}件</div>
36
+            </div>
37
+
38
+          </div>
39
+          <div class="flex justify-end gap-2">
40
+            <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
41
+            <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
42
+
43
+          </div>
44
+        </div>
45
+      </div>
46
+
47
+    </div>
48
+
49
+    <div v-else>
50
+      <div v-for="(orderProduct, orderProductIndex) in orderItem.orderProduct" :key="orderProductIndex">
18 51
         <div class="flex py-2 gap-3">
19 52
           <div class="flex-1 flex gap-2">
20 53
             <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
@@ -37,41 +70,12 @@
37 70
         </div>
38 71
         <div class="flex justify-end gap-2">
39 72
           <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
40
-          <nut-button size="small" plain type="primary">立即支付</nut-button>
73
+          <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
41 74
         </div>
42 75
       </div>
43 76
     </div>
44
-
45 77
   </div>
46 78
 
47
-  <div v-else>
48
-    <div v-for="(orderProduct, orderProductIndex) in orderItem.orderProduct" :key="orderProductIndex">
49
-      <div class="flex py-2 gap-3">
50
-        <div class="flex-1 flex gap-2">
51
-          <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
52
-
53
-          <div class="flex flex-col">
54
-            <div class="line-clamp-2 text-[12px]">
55
-              {{ orderProduct.cart_info.product.store_name }}
56
-            </div>
57
-            <div class="text-gray-500 text-[10px]">
58
-              {{ orderProduct.cart_info.productAttr.sku }}
59
-            </div>
60
-          </div>
61
-        </div>
62
-
63
-        <div class="flex flex-col justify-center items-center">
64
-          <FPrice :price="orderProduct.cart_info.product.price" ex-class="font-bold text-[12px] !text-[#000]"></FPrice>
65
-          <div class="text-gray-500 text-[11px]">共{{ orderProduct.product_num }}件</div>
66
-        </div>
67
-
68
-      </div>
69
-      <div class="flex justify-end gap-2">
70
-        <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
71
-        <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
72
-      </div>
73
-    </div>
74
-  </div>
75 79
 
76 80
 </template>
77 81
 <script setup lang="ts">
@@ -149,8 +153,10 @@ function handleCancelOrder() {
149 153
 }
150 154
 
151 155
 function handlePayment() {
156
+  const { orderItem } = props
152 157
   uni.navigateTo({
153
-    url: `/pages/payment/index`
158
+    url: '/pages/payment/index?' + `pay_price=${orderItem.pay_price}&order_id=${orderItem.order_id}&OrderList=${JSON.stringify(orderItem)}`
159
+    // url: `/pages/payment/index`
154 160
   })
155 161
 }
156 162
 </script>

+ 47 - 37
src/pages/order/index.vue

@@ -1,49 +1,52 @@
1 1
 <template>
2
-  <nut-tabs v-model="state.tabvalue">
3
-    <nut-tab-pane title="全部">
4
-      <div v-if="state.allOrderList.length > 0">
5
-        <div v-for="(orderItem, index) in state.allOrderList" :key="index">
6
-          <OrderItem :order-item="orderItem" />
2
+  <CXBBasePage>
3
+    <nut-tabs v-model="state.tabvalue">
4
+      <nut-tab-pane title="全部">
5
+        <div v-if="state.allOrderList.length > 0">
6
+          <div v-for="(orderItem, index) in state.allOrderList" :key="index">
7
+            <OrderItem :order-item="orderItem" />
8
+          </div>
7 9
         </div>
8
-      </div>
9
-      <CXBEmpty v-else/>
10
+        <CXBEmpty v-else/>
10 11
 
11
-    </nut-tab-pane>
12
-    <nut-tab-pane title="待付款">
13
-      <div v-if="state.obligationOrderList.length > 0">
14
-        <div v-for="(orderItem, index) in state.obligationOrderList" :key="index">
15
-          <OrderItem :order-item="orderItem" />
12
+      </nut-tab-pane>
13
+      <nut-tab-pane title="待付款">
14
+        <div v-if="state.obligationOrderList.length > 0">
15
+          <div v-for="(orderItem, index) in state.obligationOrderList" :key="index">
16
+            <OrderItem :order-item="orderItem" />
17
+          </div>
16 18
         </div>
17
-      </div>
18
-      <CXBEmpty v-else/>
19
-    </nut-tab-pane>
20
-    <nut-tab-pane title="待发货">
21
-      <div v-if="state.orderList.length > 0">
22
-        <div v-for="(orderItem, index) in state.orderList" :key="index">
23
-          <OrderItem :order-item="orderItem" />
19
+        <CXBEmpty v-else/>
20
+      </nut-tab-pane>
21
+      <nut-tab-pane title="待发货">
22
+        <div v-if="state.orderList.length > 0">
23
+          <div v-for="(orderItem, index) in state.orderList" :key="index">
24
+            <OrderItem :order-item="orderItem" />
25
+          </div>
24 26
         </div>
25
-      </div>
26
-      <CXBEmpty v-else/>
27
+        <CXBEmpty v-else/>
27 28
 
28
-    </nut-tab-pane>
29
-    <nut-tab-pane title="待收货">
30
-      <div v-if="state.orderList.length > 0">
31
-        <div v-for="(orderItem, index) in state.orderList" :key="index">
32
-          <OrderItem :order-item="orderItem" />
29
+      </nut-tab-pane>
30
+      <nut-tab-pane title="待收货">
31
+        <div v-if="state.orderList.length > 0">
32
+          <div v-for="(orderItem, index) in state.orderList" :key="index">
33
+            <OrderItem :order-item="orderItem" />
34
+          </div>
33 35
         </div>
34
-      </div>
35
-      <CXBEmpty v-else/>
36
+        <CXBEmpty v-else/>
36 37
 
37
-    </nut-tab-pane>
38
-    <nut-tab-pane title="待评价">
39
-      <div v-if="state.orderList.length > 0">
40
-        <div v-for="(orderItem, index) in state.orderList" :key="index">
41
-          <OrderItem :order-item="orderItem" />
38
+      </nut-tab-pane>
39
+      <nut-tab-pane title="待评价">
40
+        <div v-if="state.orderList.length > 0">
41
+          <div v-for="(orderItem, index) in state.orderList" :key="index">
42
+            <OrderItem :order-item="orderItem" />
43
+          </div>
42 44
         </div>
43
-      </div>
44
-      <CXBEmpty v-else/>
45
-    </nut-tab-pane>
46
-  </nut-tabs>
45
+        <CXBEmpty v-else/>
46
+      </nut-tab-pane>
47
+    </nut-tabs>
48
+
49
+  </CXBBasePage>
47 50
 </template>
48 51
 <script lang="ts" setup>
49 52
 // import { reactive } from 'vue';
@@ -56,6 +59,7 @@ import FButton from "~/components/FButton/FButton.vue";
56 59
 import OrderItem from "~/pages/order/components/OrderItem.vue";
57 60
 import amapWx from "~/libs/amap-wx";
58 61
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
62
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
59 63
 
60 64
 const state = reactive({
61 65
   tabvalue: '0',
@@ -165,3 +169,9 @@ style:
165 169
   navigationBarTitleText: 我的订单
166 170
   enablePullDownRefresh: true
167 171
 </route>
172
+
173
+<style>
174
+.nut-tab-pane {
175
+  background: #f5f5f5 !important;
176
+}
177
+</style>

+ 47 - 0
src/pages/order/third-order.vue

@@ -23,6 +23,15 @@
23 23
 </template>
24 24
 <script setup lang="ts">
25 25
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
26
+import {getThirdOrder} from "~/apis/order.api";
27
+enum TYPE {
28
+  JD = '6',
29
+  TB = '5',
30
+  PDD = '1',
31
+  DY = '9',
32
+  VIP = '2',
33
+  SU = '3'
34
+}
26 35
 const state = reactive({
27 36
   tabvalue: '0',
28 37
 
@@ -35,7 +44,45 @@ const state = reactive({
35 44
   orderList: [],
36 45
 });
37 46
 
47
+onLoad(() => {
48
+  loadOrderList('6')
49
+})
38 50
 
51
+watch(() => state.tabvalue, (val) => {
52
+  console.log(val)
53
+  switch (val) {
54
+    case '0': {
55
+      loadOrderList(TYPE.JD)
56
+      break
57
+    }
58
+    case '1': {
59
+      loadOrderList(TYPE.VIP)
60
+      break
61
+    }
62
+    case '2': {
63
+      loadOrderList(TYPE.SU)
64
+      break
65
+    }
66
+    case '3': {
67
+      loadOrderList(TYPE.TB)
68
+      break
69
+    }
70
+    case '4': {
71
+      loadOrderList(TYPE.PDD)
72
+      break
73
+    }
74
+    case '5': {
75
+      loadOrderList(TYPE.DY)
76
+      break
77
+    }
78
+  }
79
+})
80
+function loadOrderList(type: string) {
81
+
82
+  getThirdOrder({type, page: 1, limit: 10}).then(res => {
83
+    state.orderList = res
84
+  })
85
+}
39 86
 </script>
40 87
 
41 88
 <route lang="yaml">

+ 49 - 16
src/pages/store/home/components/MerchantHeader.vue

@@ -1,15 +1,3 @@
1
-<script lang="ts" setup>
2
-import type {PropType} from "vue";
3
-import {MerchantModel} from "~/apis/model/storeModel";
4
-import CXBButton from "~/components/CXBButton/CXBButton.vue";
5
-
6
-const props = defineProps({
7
-  model: {
8
-    type: Object as PropType<MerchantModel>,
9
-    required: true
10
-  }
11
-})
12
-</script>
13 1
 <template>
14 2
   <div class="bg-light rounded-lg p-3 text-sm flex flex-col gap-4">
15 3
     <div class="flex flex-row justify-between items-center">
@@ -25,13 +13,22 @@ const props = defineProps({
25 13
         </div>
26 14
 
27 15
       </div>
28
-      <div class="rounded-full text-white bg-gradient-to-r from-[#fe0032] to-[#fe7577] w-12 h-6 text-xs text-white flex justify-center items-center px-2 gap-1">
16
+      <div
17
+          @tap="handleRelation"
18
+          v-if="!isCare"
19
+          class="rounded-full text-white bg-gradient-to-r from-[#fe0032] to-[#fe7577] w-12 h-6 text-xs text-white flex justify-center items-center px-2 gap-1">
29 20
         <div class="i-tabler-heart"></div>
30 21
         关注
31 22
       </div>
32
-<!--      <CXBButton>-->
33
-<!--        关注-->
34
-<!--      </CXBButton>-->
23
+      <div
24
+          v-if="isCare"
25
+          @tap="handleRemoveRelation"
26
+          class="rounded-full text-gray text-[11px] flex justify-center items-center px-2 gap-1 border border-solid border-1px border-gray w-12 h-6 ">
27
+        已关注
28
+      </div>
29
+      <!--      <CXBButton>-->
30
+      <!--        关注-->
31
+      <!--      </CXBButton>-->
35 32
     </div>
36 33
     <div class="flex flex-row items-center">
37 34
       <div class="basis-1/4 text-left">推荐</div>
@@ -42,3 +39,39 @@ const props = defineProps({
42 39
 
43 40
   </div>
44 41
 </template>
42
+
43
+<script lang="ts" setup>
44
+import type {PropType} from "vue";
45
+import {MerchantDetailModel} from "~/apis/model/storeModel";
46
+import CXBButton from "~/components/CXBButton/CXBButton.vue";
47
+import {relation, removeMyRelation} from "~/apis/user";
48
+
49
+const props = defineProps({
50
+  model: {
51
+    type: Object as PropType<MerchantDetailModel>,
52
+    required: true
53
+  }
54
+})
55
+
56
+const isCare = ref(props.model.care)
57
+function handleRelation() {
58
+  relation({
59
+    type: '10',
60
+    type_id: props.model.mer_id
61
+  }).then(res => {
62
+    isCare.value = true
63
+    uni.showToast({
64
+      title: '已关注'
65
+    })
66
+  })
67
+}
68
+
69
+function handleRemoveRelation() {
70
+  removeMyRelation({type: 10, type_id: props.model.mer_id}).then(res => {
71
+    isCare.value = false
72
+    uni.showToast({
73
+      title: '取消关注'
74
+    })
75
+  })
76
+}
77
+</script>

+ 1 - 1
src/pages/store/home/index.vue

@@ -90,7 +90,7 @@ function handleNavItemClick(navItemId: any) {
90 90
     </div>
91 91
   </div>
92 92
 </template>
93
-<route lang="yaml">
93
+<route lang="yaml"  type="home">
94 94
 style:
95 95
   navigationBarTitleText: 储蓄保
96 96
   enablePullDownRefresh: true

+ 23 - 10
src/pages/store/product/detail.vue

@@ -42,8 +42,10 @@ onLoad((option: any) => {
42 42
   getProductDetail(id).then(res => {
43 43
     console.log(res)
44 44
     detail.value = res
45
-    if (res.mer_id === '148') {
46
-      detail.value.price = detail.value.price * 30
45
+    if (res && res.mer_id && res.mer_id === '148') {
46
+      if (detail.value && detail.value.price ) {
47
+        detail.value.price = detail.value.price * 30
48
+      }
47 49
     }
48 50
     // if (detail.value.mer_id === '148') {
49 51
     // }
@@ -91,7 +93,7 @@ function loadCartCount() {
91 93
 //   }
92 94
 // })
93 95
 const is148Merchant = computed(() => {
94
-  return detail.value.mer_id === '148'
96
+  return detail.value && detail.value.mer_id && detail.value.mer_id === '148'
95 97
 })
96 98
 //预览轮播图
97 99
 function previewImage(index: number) {
@@ -149,6 +151,11 @@ function handleCreateShopping() {
149 151
         state.isShowSku = false
150 152
       }
151 153
     }
154
+  }).catch(error => {
155
+    uni.showToast({
156
+      title: error,
157
+      icon: 'none'
158
+    })
152 159
   })
153 160
 }
154 161
 
@@ -166,10 +173,11 @@ function handleCountChange(val) {
166 173
 </script>
167 174
 
168 175
 <template>
169
-  <div class="flex flex-col gap-3 pb-20">
176
+  <div class="flex flex-col gap-3 pb-20" v-if="detail">
170 177
     <div class="bg-white ">
171 178
       <div class="w-screen h-50">
172 179
         <swiper
180
+            v-if="detail && detail.slider_image"
173 181
             :indicator-dots="state.indicatorDots"
174 182
             indicator-active-color="#e93323"
175 183
             :autoplay="state.autoplay"
@@ -184,14 +192,17 @@ function handleCountChange(val) {
184 192
         </swiper>
185 193
       </div>
186 194
 
187
-      <div class="flex flex-col p-3 gap-3">
195
+      <div
196
+          class="flex flex-col p-3 gap-3">
188 197
         <div class="flex flex-row  items-center text-[#FE0032] font-bold text-lg gap-2">
189
-          <div v-if="is148Merchant" class="flex justify-end items-end gap-2">
198
+          <div v-if="is148Merchant && detail.price" class="flex justify-end items-end gap-2">
190 199
             <div class="!text-[24px]">{{ detail.price }} </div>
191 200
             <div class="text-sm">积分</div>
192 201
           </div>
193 202
           <div v-else>
194
-            ¥ {{ detail.price }}
203
+            <div v-if="detail.price">
204
+              ¥ {{ detail.price }}
205
+            </div>
195 206
           </div>
196 207
           <div
197 208
               v-if="!is148Merchant"
@@ -205,7 +216,7 @@ function handleCountChange(val) {
205 216
             class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
206 217
           <image src="https://cdn.bjtdba.com/vod/image/2023-02-21/20230221093033267.png"
207 218
                  mode="widthFix" class="!w-8 "></image>
208
-          <div class="px-2 flex items-center jusitify-center">
219
+          <div class="px-2 flex items-center jusitify-center" v-if="detail.yanglao">
209 220
             <div>
210 221
               养老金 ¥{{ detail.yanglao }}
211 222
             </div>
@@ -213,10 +224,12 @@ function handleCountChange(val) {
213 224
         </div>
214 225
 
215 226
         <div class="flex flex-col gap-2">
216
-          <div class="flex font-bold">
227
+          <div class="flex font-bold" v-if="detail && detail.store_name">
217 228
             {{ detail.store_name }}
218 229
           </div>
219
-          <div class="text-gray-600 text-sm w-fit px-1"
230
+          <div
231
+              v-if="detail.store_info"
232
+              class="text-gray-600 text-sm w-fit px-1"
220 233
                :class="is148Merchant ? 'border border-solid border-gray' : ''"
221 234
           >
222 235
             {{ detail.store_info }}

+ 1 - 5
src/pages/user/address/create.vue

@@ -175,7 +175,7 @@ export default {
175 175
                 title: '保存成功'
176 176
               })
177 177
               setTimeout(() => {
178
-                uni.navigateTo({
178
+                uni.redirectTo({
179 179
                   url: '/pages/user/address/index'
180 180
                 })
181 181
               }, 500)
@@ -227,10 +227,6 @@ export default {
227 227
 
228 228
     const events = {
229 229
       change(arg1, arg2) {
230
-        // console.log(args[0])
231
-        // console.log('change', ...args);
232
-        // formData.address = args
233
-        console.log(arg2)
234 230
         basicData.addressObject = arg2
235 231
       },
236 232
       pathChange(...args: any) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 220 - 9
src/pages/user/address/edit.vue


+ 39 - 24
src/pages/user/address/index.vue

@@ -3,10 +3,11 @@
3 3
     <div class="bg-white ">
4 4
       <div class="p-3 flex flex-col gap-3 pb-safe" v-if="data && data.length > 0">
5 5
         <div v-for="(item, index) in data" :key="index"
6
-             @tap="handleClickItem(item)"
7 6
              class="flex justify-center items-center f-hairline-bottom py-3 bg-white p-3"
8 7
         >
9
-          <div class="flex flex-col flex-1">
8
+          <div
9
+              @tap.stop="handleClickItem(item)"
10
+              class="flex flex-col flex-1">
10 11
             <div class="flex items-center gap-2">
11 12
               <div class="bg-primary h-4 w-7 text-[10px] text-white justify-center items-center text-center"
12 13
                    v-if="item.is_default == '1'"
@@ -23,7 +24,9 @@
23 24
               <div>{{ item.phone }}</div>
24 25
             </div>
25 26
           </div>
26
-          <div class="flex">
27
+          <div
28
+              @tap.stop="handleEditItem(item)"
29
+              class="flex">
27 30
             <div class="i-tabler-edit "></div>
28 31
 
29 32
           </div>
@@ -58,28 +61,23 @@
58 61
 import { ref, reactive } from 'vue';
59 62
 import {getUserAddressList} from "~/apis/user";
60 63
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
64
+import {encodeBase64} from "~/utils/http/helper";
65
+import type {AddressModel} from "~/apis/model/address.model";
66
+import {useAddressStore} from "~/stores/addressStore";
67
+
68
+
61 69
 export default {
62 70
   components: {CXBBasePage},
63 71
   setup() {
64
-    const data = ref([
65
-      // {
66
-      //   testid:3,
67
-      //   testaddressName:'姓名',
68
-      //   phone:'123****4567',
69
-      //   defaultAddress:false,
70
-      //   fullAddress:'北京市通州区测试测试测试测试测试测试测试测试测试'
71
-      // },
72
-      // {
73
-      //   testid:4,
74
-      //   testaddressName:'姓名',
75
-      //   phone:'123****4567',
76
-      //   defaultAddress:true,
77
-      //   fullAddress:'北京市通州区测试测试测试测试测试测试测试测试测试'
78
-      // },
79
-    ]);
80
-    onLoad(() => {
72
+    const data = ref([]);
73
+    const addressStore = useAddressStore()
74
+    const from = ref()
75
+    onLoad((options) => {
76
+      if (options && options.from) {
77
+        from.value = options.from
78
+      }
79
+      // from.value =
81 80
       getUserAddressList().then(res => {
82
-        console.log(res)
83 81
         if (res) {
84 82
           data.value = res.list
85 83
         }
@@ -92,9 +90,25 @@ export default {
92 90
       addressName: 'detail'
93 91
       // addressName:'testaddressName'
94 92
     });
95
-    const handleClickItem = (item)=>{
96
-      console.log('Click To Address');
97
-      console.log(item)
93
+    const handleEditItem = (item: AddressModel)=>{
94
+
95
+      uni.navigateTo({
96
+        url: `/pages/user/address/edit?data=${encodeBase64(item)}`
97
+      })
98
+    }
99
+
100
+    // 选择Item
101
+    const handleClickItem = (item: AddressModel) => {
102
+      // uni.navigateTo()
103
+      addressStore.getCurrentAddress(item.address_id)
104
+      console.log(from.value)
105
+      if (from.value && from.value === 'order') {
106
+        setTimeout(() => {
107
+          uni.navigateBack()
108
+        }, 300)
109
+      }
110
+      // setTimeout(() => {
111
+      // })
98 112
     }
99 113
     const editClick = ()=>{
100 114
       console.log('Click To Edit');
@@ -120,6 +134,7 @@ export default {
120 134
     // }
121 135
     return {
122 136
       data,
137
+      handleEditItem,
123 138
       handleClickItem,
124 139
       delClick,
125 140
       editClick,

+ 130 - 0
src/pages/user/address/order-address.vue

@@ -0,0 +1,130 @@
1
+<template>
2
+  <CXBBasePage>
3
+    <div class="bg-white ">
4
+      <div class="p-3 flex flex-col gap-3 pb-safe" v-if="data && data.length > 0">
5
+        <div v-for="(item, index) in data" :key="index"
6
+             @tap="handleClickItem(item)"
7
+             class="flex justify-center items-center f-hairline-bottom py-3 bg-white p-3"
8
+        >
9
+          <div class="flex flex-col flex-1">
10
+            <div class="flex items-center gap-2">
11
+              <div class="bg-primary h-4 w-7 text-[10px] text-white justify-center items-center text-center"
12
+                   v-if="item.is_default == '1'"
13
+              >
14
+                默认
15
+              </div>
16
+              <div class="flex text-sm text-gray-500">{{ item.province + ' ' + item.city + ' ' + item.district + ' ' + item.village}}</div>
17
+            </div>
18
+            <div class="flex text-sm font-bold">{{ item.detail }}</div>
19
+            <div class="flex gap-2 items-center text-xs text-gray-500">
20
+              <div>
21
+                {{ item.real_name }}
22
+              </div>
23
+              <div>{{ item.phone }}</div>
24
+            </div>
25
+          </div>
26
+          <div class="flex">
27
+            <div class="i-tabler-edit "></div>
28
+
29
+          </div>
30
+
31
+
32
+        </div>
33
+
34
+      </div>
35
+
36
+      <div class="fixed bottom-0 p-safe w-full bg-white ">
37
+        <div class="px-3">
38
+          <nut-button block type="primary" @click="handleCreateAddress">新建收货地址</nut-button>
39
+        </div>
40
+      </div>
41
+    </div>
42
+  </CXBBasePage>
43
+  <!--  <nut-address-list
44
+        v-if="data && data.length > 0"
45
+        :data="data"
46
+        swipe-edition
47
+        show-bottom-button
48
+        @edit-icon="editClick"
49
+        @del-icon="delClick"
50
+        @click-item="clickItem"
51
+        @swipe-del="delClickSwipe"
52
+        @add="addAddress"
53
+        :options="dataOptions"
54
+    >
55
+    </nut-address-list>-->
56
+</template>
57
+<script lang="ts">
58
+import { ref, reactive } from 'vue';
59
+import {getUserAddressList} from "~/apis/user";
60
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
61
+import {encodeBase64} from "~/utils/http/helper";
62
+import type {AddressModel} from "~/apis/model/address.model";
63
+export default {
64
+  components: {CXBBasePage},
65
+  setup() {
66
+    const data = ref([]);
67
+    onLoad((options) => {
68
+      // if (options && options.from) {
69
+      //   from.value = from
70
+      // }
71
+      // from.value =
72
+      getUserAddressList().then(res => {
73
+        if (res) {
74
+          data.value = res.list
75
+        }
76
+      })
77
+    })
78
+    const dataOptions = reactive({
79
+      // id: 'testid',
80
+      id: 'address_id',
81
+      addressDetail:'detail',
82
+      addressName: 'detail'
83
+      // addressName:'testaddressName'
84
+    });
85
+    const handleClickItem = (item: AddressModel)=>{
86
+
87
+      uni.navigateTo({
88
+        url: `/pages/user/address/edit?data=${encodeBase64(item)}`
89
+      })
90
+    }
91
+    const editClick = ()=>{
92
+      console.log('Click To Edit');
93
+    }
94
+    const delClick = ()=>{
95
+      console.log('Click To Delete');
96
+    }
97
+    const delClickSwipe = () => {
98
+      console.log('Click On DelClickSwipe');
99
+    };
100
+    const addAddress = ()=>{
101
+      console.log('Click To Add');
102
+    }
103
+
104
+    function handleCreateAddress() {
105
+      uni.navigateTo({
106
+        url: '/pages/user/address/create'
107
+      })
108
+    }
109
+
110
+    // function handleEdit(addressItem) {
111
+    //   console.log(addressItem)
112
+    // }
113
+    return {
114
+      data,
115
+      handleClickItem,
116
+      delClick,
117
+      editClick,
118
+      delClickSwipe,
119
+      addAddress,
120
+      handleCreateAddress,
121
+      dataOptions,
122
+    };
123
+  }
124
+};
125
+</script>
126
+
127
+<route lang="yaml">
128
+style:
129
+ navigationBarTitleText: 我的地址
130
+</route>

+ 113 - 0
src/pages/vip/index.vue

@@ -0,0 +1,113 @@
1
+<template>
2
+  <CXBBasePage>
3
+    <div class="flex flex-col gap-3 ">
4
+      <image :src="homeBanner" mode="widthFix" class="h-full w-full "></image>
5
+      <div class="flex px-3">
6
+        会员专区
7
+      </div>
8
+      <div  class="px-3" v-if="list && list.length > 0">
9
+        <grid-view type="masonry" cross-axis-count="2" 	cross-axis-gap="10px" main-axis-gap="10px">
10
+          <div v-for="(item, index) in list"
11
+               :key="index"
12
+               @click="handleItemClick(item)"
13
+          >
14
+            <div
15
+                class="bg-white rounded-lg"
16
+            >
17
+              <image :src="item.image" mode="widthFix" 	:fade-in="true" class="rounded-t-lg  !w-full aspect-square"></image>
18
+
19
+              <div class="text-sm p-2 flex flex-col gap-1">
20
+                <div class="line-clamp-2">
21
+                  {{item.store_name}}
22
+                </div>
23
+                <div class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
24
+                  <image src="https://cdn.bjtdba.com/vod/image/2023-02-21/20230221093033267.png"
25
+                         mode="widthFix" class="!w-8 "></image>
26
+                  <div class="px-2 flex items-center jusitify-center">
27
+                    <div>
28
+                      养老金 ¥{{item.yanglao}}
29
+                    </div>
30
+                  </div>
31
+                </div>
32
+                <div class="flex flex-row items-center gap-2">
33
+                  <div class="flex text-[#FE0032] font-bold text-lg">
34
+                    <div>
35
+                      ¥
36
+                    </div>
37
+                    <div>
38
+                      {{ item.price }}
39
+                    </div>
40
+
41
+                  </div>
42
+
43
+                  <div class="bg-[#202020] text-[#FFDD99] rounded-t-lg rounded-br-lg text-10px leading-none px-1 flex items-center justify-center h-4">
44
+
45
+                    <div>
46
+                      大仓
47
+                    </div>
48
+                  </div>
49
+
50
+                </div>
51
+
52
+                <div class="line-through text-xs font-bold flex ">
53
+                  <div>
54
+                    ¥ {{item.ot_price}}
55
+                  </div>
56
+                </div>
57
+              </div>
58
+            </div>
59
+
60
+          </div>
61
+        </grid-view>
62
+
63
+      </div>
64
+    </div>
65
+
66
+  </CXBBasePage>
67
+</template>
68
+
69
+<script setup lang="ts">
70
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
71
+import FSearch from "~/components/FSearch/FSearch.vue";
72
+import {computed} from "vue";
73
+import {getVipAreaList} from "~/apis/merchant";
74
+import {CDN_URL} from "~/config/app";
75
+
76
+const homeBanner = CDN_URL + '/static/assets/home-banner.png'
77
+
78
+const systemInfo = uni.getSystemInfoSync()
79
+const statusBarHeight = systemInfo.statusBarHeight ?? 0
80
+
81
+const navBarStyle = computed(() => {
82
+  return {
83
+    paddingTop: `${statusBarHeight}px`,
84
+  }
85
+})
86
+
87
+const list = ref()
88
+
89
+onLoad(() => {
90
+  getVipAreaList({
91
+    page: 1,
92
+    limit: 20
93
+  }).then(res => {
94
+    // console.log(res.list)
95
+    console.log(res.list)
96
+    if (res) {
97
+      list.value = res.list
98
+    }
99
+  })
100
+})
101
+
102
+function handleItemClick(item) {
103
+  uni.navigateTo({
104
+    url: `/pages/store/product/detail?id=${item.product_id}`
105
+  })
106
+}
107
+</script>
108
+
109
+<route lang="yaml">
110
+style:
111
+  navigationBarTitleText: 储蓄保会员
112
+  enablePullDownRefresh: true
113
+</route>

+ 0 - 71
src/pages/vip/vip.vue

@@ -1,71 +0,0 @@
1
-<script setup lang="ts">
2
-import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
3
-import FSearch from "~/components/FSearch/FSearch.vue";
4
-import {computed} from "vue";
5
-import FNavBar from "~/components/FNavBar/FNavBar.vue";
6
-import {getVipAreaList} from "~/apis/merchant";
7
-import ProductList from "~/components/ProductList/ProductList.vue";
8
-import {CDN_URL} from "~/config/app";
9
-const homeBannerImage = CDN_URL + '/static/home-banner.png'
10
-
11
-const systemInfo = uni.getSystemInfoSync()
12
-const statusBarHeight = systemInfo.statusBarHeight ?? 0
13
-
14
-const navBarStyle = computed(() => {
15
-  return {
16
-    paddingTop: `${statusBarHeight}px`,
17
-  }
18
-})
19
-
20
-const list = ref()
21
-
22
-onLoad(() => {
23
-  getVipAreaList({
24
-    page: 1,
25
-    limit: 20
26
-  }).then(res => {
27
-    // console.log(res.list)
28
-    console.log(res.list)
29
-    if (res) {
30
-      list.value = res.list
31
-    }
32
-  })
33
-})
34
-</script>
35
-<template>
36
-  <CXBBasePage>
37
-    <FNavBar :fixed="true" exClass="pl-2 z-100">
38
-      <div
39
-          class="w-60% bg-white rounded-full flex flex-row justify-between items-center border-solid border-1 border-red">
40
-
41
-        <image src="https://cdn.bjtdba.com/vod/image/2023-02-15/20230215112840149.png"
42
-               mode="widthFix"
43
-               class="w-4 h-4  pl-2 py-1"
44
-        ></image>
45
-        <div class="flex flex-1 items-center w-100%">
46
-          <div class="flex-1 pl-2 text-gray">搜索商品关键词</div>
47
-          <div class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center py-1 my-0.5 mr-0.5 ">
48
-            搜索
49
-          </div>
50
-        </div>
51
-
52
-      </div>
53
-    </FNavBar>
54
-    <div class="fixed w-screen">
55
-      <image :src="homeBannerImage" mode="widthFix" class="h-full w-full "></image>
56
-    </div>
57
-    <div>
58
-      <div class="text-bold">会员专区</div>
59
-      <ProductList
60
-          :list="list"
61
-      />
62
-    </div>
63
-  </CXBBasePage>
64
-</template>
65
-
66
-<route lang="yaml">
67
-style:
68
-  navigationStyle: custom
69
-  navigationBarTitleText: 储蓄保
70
-  enablePullDownRefresh: true
71
-</route>

+ 37 - 0
src/stores/addressStore.ts

@@ -0,0 +1,37 @@
1
+import {defineStore} from "pinia";
2
+import type {AddressModel} from "~/apis/model/address.model";
3
+import {getUserAddressDetail, getUserAddressList} from "~/apis/user";
4
+export const useAddressStore = defineStore('addressStore', {
5
+    state: () => ({
6
+        address: {},
7
+        addressId: ''
8
+        // userInfo: Cache.get(USER_INFO) as UserInfoModel,
9
+        // token: Cache.get(LOGIN_STATUS) || null,
10
+        // isLogin: !!token,
11
+        // uid: Cache.get(UID) || null,
12
+        // mer_id: 0, // 店铺 ID
13
+        // permissionList: null // 权限列表
14
+    }),
15
+    actions: {
16
+        setCurrentAddressId(addressId: string) {
17
+            this.addressId = addressId
18
+        },
19
+        getCurrentAddress(addressId?: string) {
20
+            if (addressId) {
21
+                // this.address = address
22
+                getUserAddressDetail(addressId).then(address => {
23
+                    // data.addressInfo = res
24
+                    // data.addressId = res.address_id || 0
25
+                    this.address = address
26
+                })
27
+            } else {
28
+                getUserAddressList().then(res => {
29
+                    this.address = res.list.length > 0 ? res.list[0] : {}
30
+                    // this.addressId = res.list.length > 0 ? res.list[0].address_id : '0'
31
+                })
32
+            }
33
+            // this.currentAddress = address
34
+        },
35
+
36
+    }
37
+})

+ 5 - 0
src/utils/index.ts

@@ -30,3 +30,8 @@ export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
30 30
 
31 31
     return src
32 32
 }
33
+
34
+export function encodePhone(phone: string) {
35
+    // let tel = '13600136000';
36
+    return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2")
37
+}

+ 1 - 0
src/utils/util.ts

@@ -37,3 +37,4 @@ export function delay(ms: number) {
37 37
 }
38 38
 
39 39
 export function noop() {}
40
+