weixin_52219567 3 недель назад
Родитель
Сommit
d8482e765b

+ 16 - 0
.vscode/settings.json

@@ -0,0 +1,16 @@
+{
+    "i18n-ally.localesPaths": [
+        "src/locale",
+        "src/app/locale",
+        "src/addon/cms/locale",
+        "src/addon/pintuan/locale",
+        "src/addon/recharge/locale",
+        "src/addon/shop/locale",
+        "src/addon/shop_fenxiao/locale",
+        "src/addon/shop_giftcard/locale",
+        "src/addon/shop_impulse_buy/locale",
+        "src/addon/shop_replace_buy/locale",
+        "src/addon/seckill/locale",
+        "src/addon/sow_community/locale"
+    ]
+}

+ 8 - 8
src/addon/shop/api/cart.ts

@@ -3,22 +3,22 @@ import request from '@/utils/request'
 /**
  * 添加购物车
  */
-export function addCart(data: AnyObject) {
-    return request.post(`shop/cart`, data)
+export function addCart(data: any) {
+    return request.post(`product/miniProduct/addProductShoppingCart`, data)
 }
 
 /**
  * 编辑购物车数量
  */
-export function editCart(data: AnyObject) {
-    return request.put(`shop/cart`, data)
+export function editCart(data: any) {
+    return request.post(`product/miniProduct/updateProductShoppingCart`, data)
 }
 
 /**
  * 删除购物车
  */
-export function deleteCart(data: AnyObject) {
-    return request.put(`shop/cart/delete`, data)
+export function deleteCart(ids: any) {
+    return request.delete(`product/miniProduct/deleteProductShoppingCart/${ids}`)
 }
 
 /**
@@ -32,14 +32,14 @@ export function clearCart() {
  * 获取购物车列表
  */
 export function getCartList(params: Record<string, any>) {
-    return request.get(`shop/cart`, params)
+    return request.get(`product/miniProduct/getProductShoppingCartPage`, params)
 }
 
 /**
  * 获取购物车商品列表
  */
 export function getCartGoodsList(params: Record<string, any>) {
-    return request.get(`shop/cart/goods`, params)
+    return request.get(`product/miniProduct/getProductShoppingCartPage`, params)
 }
 
 /**

+ 167 - 299
src/addon/shop/pages/goods/cart.vue

@@ -1,90 +1,98 @@
 <template>
     <view :style="themeColor()">
         <!-- #ifdef MP-WEIXIN -->
-        <top-tabbar :data="topTabbarData" scrollBool="1" :isBack="false"/>
+        <top-tabbar :data="topTabbarData" scrollBool="1" :isBack="false" />
         <!-- #endif -->
         <view class="bg-page min-h-[100vh] overflow-hidden flex flex-col" v-if="!loading">
-            <view v-if="!info" class="pb-[100rpx]">
+            <view v-if="!getToken()" class="pb-[100rpx]">
                 <view class="empty-page">
-                    <image class="img" :src="img('static/resource/images/system/login.png')" model="aspectFit" />
+                    <image class="img" :src="img('https://v6.site.niucloud.com/static/resource/images/system/login.png')" model="aspectFit" />
                     <view class="desc">暂未登录</view>
                     <button shape="circle" plain="true" class="btn" @click="toLogin">去登录</button>
                 </view>
-                <ns-goods-recommend></ns-goods-recommend>
             </view>
-            <view v-else-if="!cartList.length&&!invalidList.length" class="pb-[100rpx]">
+            <view v-else-if="!cartList.length && !invalidList.length" class="pb-[100rpx]">
                 <view class="empty-page">
                     <image class="img" :src="img('addon/shop/cart-empty.png')" model="aspectFit" />
                     <view class="desc">赶紧去逛逛, 购买心仪的商品吧</view>
-                    <button shape="circle" plain="true" class="btn" @click="redirect({ url: '/addon/shop/pages/goods/list' })">去逛逛</button>
+                    <button shape="circle" plain="true" class="btn"
+                        @click="redirect({ url: '/addon/shop/pages/goods/list' })">去逛逛</button>
                 </view>
-                <ns-goods-recommend></ns-goods-recommend>
             </view>
             <template v-else>
                 <view class="flex-1 h-0">
                     <view class="scroll-height ">
                         <view class="py-[var(--top-m)] sidebar-margin">
-                            <view class="bg-[#fff] pb-[10rpx] box-border rounded-[var(--rounded-big)]" v-if="cartList.length">
-                                <view class="flex mx-[var(--rounded-big)] pt-[var(--pad-top-m)] justify-between items-center box-border font-400 text-[24rpx] mb-[24rpx] leading-[30rpx]">
+                            <view class="bg-[#fff] pb-[10rpx] box-border rounded-[var(--rounded-big)]"
+                                v-if="cartList.length">
+                                <view
+                                    class="flex mx-[var(--rounded-big)] pt-[var(--pad-top-m)] justify-between items-center box-border font-400 text-[24rpx] mb-[24rpx] leading-[30rpx]">
                                     <view class="flex items-baseline text-[24rpx] text-[#333]">
                                         <text>共</text>
-                                        <text class="text-[32rpx] mx-[2rpx] text-[var(--price-text-color)]">{{ cartList.length }}</text>
+                                        <text class="text-[32rpx] mx-[2rpx] text-[var(--price-text-color)]">{{
+                                            cartList.length }}</text>
                                         <text>种商品</text>
                                     </view>
-                                    <text @click="isEdit = !isEdit" class="text-[var(--text-color-light6)] text-[24rpx]">{{ isEdit ? '完成' : '管理' }}</text>
+                                    <text @click="isEdit = !isEdit"
+                                        class="text-[var(--text-color-light6)] text-[24rpx]">{{ isEdit ? '完成' : '管理'
+                                        }}</text>
                                 </view>
                                 <u-swipe-action ref="swipeActive">
                                     <template v-for="(item, index) in cartList">
-                                        <view v-if="item.goodsSku" class="py-[20rpx] overflow-hidden w-full">
-                                            <u-swipe-action-item :options="cartOptions" @click="swipeClick(index,item)">
-                                                <view class="flex px-[var(--pad-sidebar-m)]" @click.stop="selectOnlyGoods(item)">
-                                                    <view class="self-center w-[34rpx] mr-[24rpx] h-[60rpx] flex items-center" @click.stop="selectOnlyGoods(item)">
+                                        <view class="py-[20rpx] overflow-hidden w-full">
+                                            <u-swipe-action-item :options="cartOptions"
+                                                @click="swipeClick(index, item)">
+                                                <view class="flex px-[var(--pad-sidebar-m)]"
+                                                    @click.stop="selectOnlyGoods(item)">
+                                                    <view
+                                                        class="self-center w-[34rpx] mr-[24rpx] h-[60rpx] flex items-center"
+                                                        @click.stop="selectOnlyGoods(item)">
                                                         <text
                                                             class=" iconfont text-color text-[34rpx] w-[34rpx] h-[34rpx] rounded-[17rpx] overflow-hidden shrink-0"
-                                                            :class="{ 'iconxuanze1':item.checked,'bg-[#F5F5F5]':!item.checked}">
+                                                            :class="{ 'iconxuanze1': item.checked, 'bg-[#F5F5F5]': !item.checked }">
                                                         </text>
                                                     </view>
-                                                    <view class="w-[200rpx] h-[200rpx] flex items-center justify-center rounded-[var(--goods-rounded-big)] overflow-hidden"
+                                                    <view
+                                                        class="w-[200rpx] h-[200rpx] flex items-center justify-center rounded-[var(--goods-rounded-big)] overflow-hidden"
                                                         @click="toDetail(item)">
-                                                        <u--image radius="var(--goods-rounded-big)" width="200rpx" height="200rpx" :src="img(item.goodsSku.sku_image_thumb_mid||'')" model="aspectFill">
+                                                        <u--image radius="var(--goods-rounded-big)" width="200rpx"
+                                                            height="200rpx" :src="img(item.productImage || '')"
+                                                            model="aspectFill">
                                                             <template #error>
-                                                                <image class="w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden" :src="img('static/resource/images/diy/shop_default.jpg')" mode="aspectFill" />
+                                                                <image
+                                                                    class="w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden"
+                                                                    :src="img('static/resource/images/diy/shop_default.jpg')"
+                                                                    mode="aspectFill" />
                                                             </template>
                                                         </u--image>
                                                     </view>
                                                     <view class="flex flex-1 flex-col justify-between ml-[20rpx]">
                                                         <view class="w-[100%] flex flex-col items-baseline">
-                                                            <view class="text-[#333] text-[28rpx] max-h-[80rpx] leading-[40rpx] multi-hidden font-400">{{ item.goods.goods_name }}</view>
-                                                            <view class="box-border max-w-[376rpx] mt-[10rpx] px-[14rpx] h-[36rpx] leading-[36rpx] truncate text-[var(--text-color-light6)] bg-[#F5F5F5] text-[22rpx] rounded-[20rpx]"
-                                                                v-if="item.goodsSku && item.goodsSku.sku_name">{{ item.goodsSku.sku_name }}</view>
+                                                            <view
+                                                                class="text-[#333] text-[28rpx] max-h-[80rpx] leading-[40rpx] multi-hidden font-400">
+                                                                {{
+                                                                    item.itemName }}</view>
                                                         </view>
-                                                        <view v-if="item.goods && item.goods.goods_label_name && item.goods.goods_label_name.length"
-                                                            class="flex flex-wrap mb-[auto]">
-                                                            <template v-for="(tagItem, tagIndex) in item.goods.goods_label_name">
-                                                                <image class="img-tag" v-if="tagItem.style_type == 'icon' && tagItem.icon" :src="img(tagItem.icon)" mode="heightFix" @error="diyGoods.error(tagItem,'icon')" />
-                                                                <view class="base-tag" v-else-if="tagItem.style_type == 'diy' || !tagItem.icon" :style="diyGoods.baseTagStyle(tagItem)">{{ tagItem.label_name }}</view>
-                                                            </template>
-                                                        </view>
-                                                        <view v-if="item.manjian_info && Object.keys(item.manjian_info).length && item.manjian_info.is_join"
-                                                            class="flex items-center mt-[8rpx] mb-[auto]"
-                                                            @click.stop="manjianOpenFn(item.manjian_info)">
-                                                            <view class="bg-[var(--primary-color-light)] text-[var(--primary-color)] rounded-[6rpx] text-[20rpx] flex items-center justify-center w-[88rpx] h-[36rpx] mr-[6rpx]">满减送</view>
-                                                            <text class="text-[22rpx] text-[#999]">{{ item.manjian_info.manjian_name }}</text>
-                                                        </view>
-                                                        <view class="flex justify-between items-end self-end mt-[10rpx] w-[100%]">
-                                                            <view class="text-[var(--price-text-color)] price-font truncate max-w-[200rpx]">
+                                                        <view
+                                                            class="flex justify-between items-end self-end mt-[10rpx] w-[100%]">
+                                                            <view
+                                                                class="text-[var(--price-text-color)] price-font truncate max-w-[200rpx]">
                                                                 <text class="text-[24rpx] font-500">¥</text>
-                                                                <text class="text-[40rpx] font-500">{{ parseFloat(goodsPrice(item)).toFixed(2).split('.')[0] }}</text>
-                                                                <text class="text-[24rpx] font-500">.{{ parseFloat(goodsPrice(item)).toFixed(2).split('.')[1] }}</text>
+                                                                <text class="text-[40rpx] font-500">{{
+                                                                    parseFloat(goodsPrice(item)).toFixed(2).split('.')[0]
+                                                                    }}</text>
+                                                                <text class="text-[24rpx] font-500">.{{
+                                                                    parseFloat(goodsPrice(item)).toFixed(2).split('.')[1]
+                                                                    }}</text>
                                                             </view>
                                                             <u-number-box v-model="item.num" :min="numLimit(item).min"
-                                                                          :max="numLimit(item).max" integer :step="1"
-                                                                          input-width="68rpx"
-                                                                          input-height="52rpx" button-size="52rpx"
-                                                                          disabledInput
-                                                                          @change="numChange($event, index)">
+                                                                :max="numLimit(item).max" integer :step="1"
+                                                                input-width="68rpx" input-height="52rpx"
+                                                                button-size="52rpx" disabledInput
+                                                                @change="numChange($event, index)">
                                                                 <template #minus>
-                                                                    <view class="relative w-[26rpx] h-[26rpx]" @click="reduceNumChange(item)">
+                                                                    <view class="relative w-[26rpx] h-[26rpx]"
+                                                                        @click="reduceNumChange(item)">
                                                                         <text
                                                                             :class="{ 'text-[var(--text-color-light9)]': item.num === numLimit(item).min, 'text-[#303133]': item.num !== numLimit(item).min }"
                                                                             class="text-[24rpx] absolute flex items-center justify-center -left-[20rpx] -bottom-[20rpx] -right-[20rpx] -top-[20rpx] font-500 nc-iconfont nc-icon-jianV6xx"></text>
@@ -98,8 +106,10 @@
                                                                         @click.stop v-model="item.num" />
                                                                 </template>
                                                                 <template #plus>
-                                                                    <view class="relative w-[26rpx] h-[26rpx]" @click="addNumChange(item)">
-                                                                        <text :class="{ 'text-[var(--text-color-light9)]': item.num === numLimit(item).max, ' text-[#303133]': item.num !== numLimit(item).max }"
+                                                                    <view class="relative w-[26rpx] h-[26rpx]"
+                                                                        @click="addNumChange(item)">
+                                                                        <text
+                                                                            :class="{ 'text-[var(--text-color-light9)]': item.num === numLimit(item).max, ' text-[#303133]': item.num !== numLimit(item).max }"
                                                                             class="text-[24rpx] absolute flex items-center justify-center -left-[20rpx] -bottom-[20rpx] -right-[20rpx] -top-[20rpx] font-500 nc-iconfont nc-icon-jiahaoV6xx"></text>
                                                                     </view>
                                                                 </template>
@@ -113,44 +123,61 @@
 
                                 </u-swipe-action>
                             </view>
-                            <view class="bg-[#fff] pb-[10rpx] box-border rounded-[var(--rounded-big)] mt-[var(--top-m)]" v-if="invalidList.length">
-                                <view class="flex mx-[var(--pad-sidebar-m)] pt-[var(--pad-top-m)] justify-between items-center box-border font-400 text-[#303133] text-[24rpx] mb-[24rpx] leading-[30rpx]">
+                            <view class="bg-[#fff] pb-[10rpx] box-border rounded-[var(--rounded-big)] mt-[var(--top-m)]"
+                                v-if="invalidList.length">
+                                <view
+                                    class="flex mx-[var(--pad-sidebar-m)] pt-[var(--pad-top-m)] justify-between items-center box-border font-400 text-[#303133] text-[24rpx] mb-[24rpx] leading-[30rpx]">
                                     <view class="flex items-center text-[24rpx] text-[#333]">
                                         <text>共</text>
-                                        <text class="text-[28rpx] text-[var(--price-text-color)]">{{ invalidList.length }}</text>
+                                        <text class="text-[28rpx] text-[var(--price-text-color)]">{{ invalidList.length
+                                            }}</text>
                                         <text>件失效商品</text>
                                     </view>
-                                    <text class="text-[var(--text-color-light6)] text-[24rpx]" @click="deleteInvalidList">清空</text>
+                                    <text class="text-[var(--text-color-light6)] text-[24rpx]"
+                                        @click="deleteInvalidList">清空</text>
                                 </view>
                                 <view v-for="(item, index) in invalidList" class="py-[20rpx] overflow-hidden">
                                     <view class="flex px-[var(--pad-sidebar-m)]">
-                                        <text class="self-center iconfont iconxuanze1 text-[34rpx] mr-[32rpx] text-[#F5F5F5] rounded-[50%] overflow-hidden shrink-0"></text>
-                                        <view class="relative w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden">
-                                            <u--image radius="var(--goods-rounded-big)" width="200rpx" height="200rpx" :src="img(item.goodsSku.sku_image_thumb_mid)" model="aspectFill">
+                                        <text
+                                            class="self-center iconfont iconxuanze1 text-[34rpx] mr-[32rpx] text-[#F5F5F5] rounded-[50%] overflow-hidden shrink-0"></text>
+                                        <view
+                                            class="relative w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden">
+                                            <u--image radius="var(--goods-rounded-big)" width="200rpx" height="200rpx"
+                                                :src="img(item.productImage)" model="aspectFill">
                                                 <template #error>
-                                                    <image class="w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden" :src="img('static/resource/images/diy/shop_default.jpg')" mode="aspectFill" />
+                                                    <image
+                                                        class="w-[200rpx] h-[200rpx] rounded-[var(--goods-rounded-big)] overflow-hidden"
+                                                        :src="img('static/resource/images/diy/shop_default.jpg')"
+                                                        mode="aspectFill" />
                                                 </template>
                                             </u--image>
-                                            <view v-if="item.goodsSku.stock == 0 " class="absolute left-0 top-0  w-[200rpx] h-[200rpx]  leading-[200rpx] text-center " style="background-color: rgba(0,0,0,0.3);">
+                                            <view v-if="item.allStock == 0"
+                                                class="absolute left-0 top-0  w-[200rpx] h-[200rpx]  leading-[200rpx] text-center "
+                                                style="background-color: rgba(0,0,0,0.3);">
                                                 <text class="text-[#fff] text-[28rpx]">已售罄</text>
                                             </view>
-                                            <view v-if="item.goodsSku.stock != 0 " class="absolute left-0 top-0  w-[200rpx] h-[200rpx]  leading-[200rpx] text-center " style="background-color: rgba(0,0,0,0.3);">
+                                            <view v-if="item.productStatus == 1"
+                                                class="absolute left-0 top-0  w-[200rpx] h-[200rpx]  leading-[200rpx] text-center "
+                                                style="background-color: rgba(0,0,0,0.3);">
                                                 <text class="text-[#fff] text-[28rpx]">已失效</text>
                                             </view>
                                         </view>
                                         <view class="flex flex-1 flex-wrap ml-[20rpx]">
                                             <view class="w-[100%] flex flex-col items-baseline">
-                                                <view class="text-[#333] text-[28rpx] max-h-[80rpx] leading-[40rpx] font-400 multi-hidden">{{ item.goods.goods_name }}</view>
-                                                <view class="box-border max-w-[376rpx] mt-[10rpx] px-[14rpx] h-[36rpx] leading-[36rpx] truncate text-[var(--text-color-light6)] bg-[#F5F5F5] text-[22rpx] rounded-[20rpx]"
-                                                    v-if="item.goodsSku && item.goodsSku.sku_name">
-                                                    {{ item.goodsSku.sku_name }}
-                                                </view>
+                                                <view
+                                                    class="text-[#333] text-[28rpx] max-h-[80rpx] leading-[40rpx] font-400 multi-hidden">
+                                                    {{
+                                                        item.itemName }}</view>
                                             </view>
                                             <view class="flex justify-between items-end self-end w-[100%]">
                                                 <view class="text-[var(--price-text-color)] price-font">
                                                     <text class="text-[24rpx] font-500">¥</text>
-                                                    <text class="text-[36rpx] font-500">{{ parseFloat(goodsPrice(item)).toFixed(2).split('.')[0] }}</text>
-                                                    <text class="text-[24rpx] font-500">.{{ parseFloat(goodsPrice(item)).toFixed(2).split('.')[1] }}</text>
+                                                    <text class="text-[36rpx] font-500">{{
+                                                        parseFloat(goodsPrice(item)).toFixed(2).split('.')[0]
+                                                        }}</text>
+                                                    <text class="text-[24rpx] font-500">.{{
+                                                        parseFloat(goodsPrice(item)).toFixed(2).split('.')[1]
+                                                        }}</text>
                                                 </view>
                                             </view>
                                         </view>
@@ -158,38 +185,17 @@
                                 </view>
                             </view>
                         </view>
-                        <ns-goods-recommend></ns-goods-recommend>
                     </view>
                 </view>
             </template>
         </view>
 
-        <!-- 优惠明细 -->
-        <view @touchmove.prevent.stop>
-            <u-popup class="popup-type" :show="couponDetailsShow" @close="couponDetailsShow = false">
-                <view class="min-h-[200rpx] popup-common" @touchmove.prevent.stop>
-                    <view class="flex justify-center items-center pt-[36rpx] pb-[56rpx] px-[26rpx] bg-[#fff] relative">
-                        <text class="text-[32rpx]">优惠明细</text>
-                        <text class="nc-iconfont nc-icon-guanbiV6xx text-[var(--text-color-light6)] absolute text-[32rpx] right-[26rpx]" @click="couponDetailsShow = false"></text>
-                    </view>
-                    <scroll-view class="h-[360rpx]" scroll-y="true">
-                        <view class="flex justify-between h-[60rpx] px-[var(--pad-sidebar-m)]">
-                            <text class="text-[28rpx]">商品总额</text>
-                            <text class="text-[28rpx]">¥{{ total.goods_money }}</text>
-                        </view>
-                        <view class="flex justify-between h-[60rpx] px-[var(--pad-sidebar-m)]" v-if="Number(total.promotion_money)">
-                            <text class="text-[28rpx]">满减</text>
-                            <text class="text-[28rpx] text-[red]">-¥{{ total.promotion_money }}</text>
-                        </view>
-                    </scroll-view>
-                </view>
-            </u-popup>
-        </view>
-
         <!--  #ifdef  H5 -->
-        <view v-if="cartList.length" class="flex h-[96rpx] items-center bg-[#fff] fixed z-99999 left-0 right-0 bottom-[50px] pl-[30rpx] pr-[20rpx] box-solid mb-ios justify-between border-0 border-t-[2rpx] border-solid border-[#f6f6f6]">
+        <view v-if="cartList.length"
+            class="flex h-[96rpx] items-center bg-[#fff] fixed z-99999 left-0 right-0 bottom-[50px] pl-[30rpx] pr-[20rpx] box-solid mb-ios justify-between border-0 border-t-[2rpx] border-solid border-[#f6f6f6]">
             <view class="flex items-center" @click="selectAll">
-                <text class="self-center iconfont text-color text-[34rpx] mr-[10rpx] w-[34rpx] h-[34rpx] rounded-[17rpx] overflow-hidden shrink-0"
+                <text
+                    class="self-center iconfont text-color text-[34rpx] mr-[10rpx] w-[34rpx] h-[34rpx] rounded-[17rpx] overflow-hidden shrink-0"
                     :class="cartList.length == checkedNum ? 'iconxuanze1' : 'bg-[#F5F5F5]'"></text>
                 <text class="font-400 text-[#303133] text-[26rpx]">全选</text>
             </view>
@@ -198,26 +204,29 @@
                     <view class="mr-[20rpx]">
                         <view class="flex items-center text-[var(--price-text-color)] leading-[45rpx]">
                             <view class="font-400 text-[#303133] text-[28rpx]">合计:</view>
-                            <text class="text-[var(--price-text-color)] price-font text-[32rpx] font-bold">¥{{ parseFloat(total.order_money).toFixed(2) }}</text>
-                        </view>
-                        <view class="flex items-center justify-end mt-[6rpx]" v-if="Number(total.promotion_money)" @click="couponDetailsShow = true">
-                            <text class="text-[22rpx] text-[#666]">优惠明细</text>
-                            <text class="iconfont iconjiantoushang text-[#666] !text-[22rpx] ml-[4rpx] font-bold"></text>
+                            <text class="text-[var(--price-text-color)] price-font text-[32rpx] font-bold">¥{{
+                                onMoney }}</text>
                         </view>
                     </view>
-                    <button class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border" @click="settlement">结算</button>
+                    <button
+                        class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
+                        @click="settlement">结算</button>
                 </view>
                 <view class="flex-1 flex items-center justify-end" v-else>
-                    <button class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border" @click="deleteCartFn">删除</button>
+                    <button
+                        class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
+                        @click="deleteCartFn">删除</button>
                 </view>
             </view>
         </view>
         <!--  #endif -->
         <!--  #ifndef  H5 -->
-        <view v-if="cartList.length" class="pl-[30rpx] pr-[20rpx] flex h-[96rpx] items-center bg-[#fff] fixed z-99999 left-0 right-0 bottom-[100rpx] box-solid mb-ios justify-between border-0 border-t-[2rpx] border-solid border-[#f6f6f6]">
+        <view v-if="cartList.length"
+            class="pl-[30rpx] pr-[20rpx] flex h-[96rpx] items-center bg-[#fff] fixed z-99999 left-0 right-0 bottom-[100rpx] box-solid mb-ios justify-between border-0 border-t-[2rpx] border-solid border-[#f6f6f6]">
             <view class="flex items-center" @click="selectAll">
-                <text class="self-center iconfont text-color text-[30rpx] mr-[20rpx] w-[34rpx] h-[34rpx] rounded-[17rpx] overflow-hidden shrink-0"
-                    :class="{'iconxuanze1' :cartList.length == checkedNum, 'bg-[#F5F5F5]':cartList.length != checkedNum}"></text>
+                <text
+                    class="self-center iconfont text-color text-[30rpx] mr-[20rpx] w-[34rpx] h-[34rpx] rounded-[17rpx] overflow-hidden shrink-0"
+                    :class="{ 'iconxuanze1': cartList.length == checkedNum, 'bg-[#F5F5F5]': cartList.length != checkedNum }"></text>
                 <text class="font-400 text-[#303133] text-[26rpx]">全选</text>
             </view>
             <view class="flex items-center">
@@ -225,66 +234,56 @@
                     <view class="mr-[20rpx]">
                         <view class="flex items-center text-[var(--price-text-color)] leading-[45rpx]">
                             <view class="font-400 text-[#303133] text-[28rpx]">合计:</view>
-                            <text class="text-[var(--price-text-color)] price-font text-[32rpx] font-bold">¥{{ parseFloat(total.order_money).toFixed(2) }}</text>
+                            <text class="text-[var(--price-text-color)] price-font text-[32rpx] font-bold">¥{{
+                                onMoney }}</text>
                         </view>
-                        <view class="flex items-center justify-end mt-[6rpx]" v-if="total.promotion_money" @click="couponDetailsShow = true">
+                        <view class="flex items-center justify-end mt-[6rpx]" v-if="total.promotion_money"
+                            @click="couponDetailsShow = true">
                             <text class="text-[22rpx] text-[#666]">优惠明细</text>
-                            <text class="iconfont iconjiantoushang text-[#666] !text-[22rpx] ml-[4rpx] font-bold"></text>
+                            <text
+                                class="iconfont iconjiantoushang text-[#666] !text-[22rpx] ml-[4rpx] font-bold"></text>
                         </view>
                     </view>
 
                     <!-- #ifdef H5 -->
-                    <button class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
+                    <button
+                        class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
                         @click="settlement">结算</button>
                     <!-- #endif -->
 
                     <!-- #ifdef MP-WEIXIN -->
                     <!--                    <button v-if="isBindMobile && info && !info.mobile" class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border" open-type="getPhoneNumber" @getphonenumber="memberStore.bindMobile">结算</button>-->
                     <!--                    <button v-else class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border" @click="settlement">结算</button>-->
-                    <button class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
+                    <button
+                        class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
                         @click="settlement">结算</button>
                     <!-- #endif -->
 
                 </view>
                 <view class="flex-1 flex items-center justify-end" v-else>
-                    <button class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
+                    <button
+                        class="w-[180rpx] h-[70rpx] font-500 text-[26rpx] leading-[70rpx] !text-[#fff] m-0 rounded-full primary-btn-bg remove-border"
                         @click="deleteCartFn">删除</button>
                 </view>
             </view>
         </view>
         <!--  #endif -->
         <loading-page :loading="loading"></loading-page>
-        <ns-goods-manjian ref="manjianShowRef"></ns-goods-manjian>
         <tabbar />
-        <!-- 强制绑定手机号 -->
-        <bind-mobile ref="bindMobileRef" />
     </view>
 </template>
 
 <script setup lang="ts">
 import { ref, computed, nextTick, watch } from 'vue'
-import useMemberStore from '@/stores/member'
 import { useLogin } from '@/hooks/useLogin'
 import { onShow } from '@dcloudio/uni-app'
-import { img, redirect } from '@/utils/common'
-import useCartStore from '@/addon/shop/stores/cart'
-import { getCartGoodsList, getCartCalculate } from '@/addon/shop/api/cart'
-import bindMobile from '@/components/bind-mobile/bind-mobile.vue';
-import { t } from "@/locale";
-import { useGoods } from '@/addon/shop/hooks/useGoods'
-import nsGoodsManjian from '@/addon/shop/components/ns-goods-manjian/ns-goods-manjian.vue';
-import nsGoodsRecommend from '@/addon/shop/components/ns-goods-recommend/ns-goods-recommend.vue';
+import { img, redirect, getToken } from '@/utils/common'
+import { getCartGoodsList, getCartCalculate, editCart, deleteCart } from '@/addon/shop/api/cart'
 import { topTabar } from '@/utils/topTabbar';
-import { useShare } from '@/hooks/useShare'
-const { setShare } = useShare()
 /********* 自定义头部 - start ***********/
 const topTabarObj = topTabar()
-let topTabbarData = topTabarObj.setTopTabbarParam({ title: '购物车', topStatusBar: { textColor: '#333' }})
+let topTabbarData = topTabarObj.setTopTabbarParam({ title: '购物车', topStatusBar: { textColor: '#333' } })
 /********* 自定义头部 - end ***********/
-
-const diyGoods = useGoods();
-const memberStore = useMemberStore()
-const info = computed(() => memberStore.info)
 const loading = ref(true)
 const optionLoading = ref(false)
 const total = ref({
@@ -295,37 +294,34 @@ const total = ref({
 const cartList = ref<object[]>([])
 const invalidList = ref<object[]>([]) //  失效商品:已下架、已删除
 const isEdit = ref(false)
-const querOne = ref(true)
-const cartStore = useCartStore();
-const manjianShowRef: any = ref(null); //满减送
 const couponDetailsShow: any = ref(false); //优惠明细
 
 const getCartGoodsListFn = () => {
-    getCartGoodsList({}).then(({ data }) => {
+    getCartGoodsList({}).then((res: any) => {
+        const data = res.rows
         cartList.value = []
         invalidList.value = []
-        data.forEach(item => {
+
+        data.forEach((item: any) => {
             item.checked = false
-            if (item.goodsSku) {
-                if (item.goods.status && item.goods.delete_time == 0) {
-                    if (item.goodsSku.stock) {
-                        if (item.num > item.goodsSku.stock) item.num = item.goodsSku.stock;
-                        cartList.value.push(item)
-                    } else {
-                        // 库存为0 时,移动到售罄商品
-                        invalidList.value.push(item)
-                    }
+            item.num = Number(item.productNum)
+            item.allStock = Number(item.totalInventory || 0) + Number(item.nowInventory || 0) + Number(item.virtualInventory || 0);
+            if (item.productStatus == 1) {
+                if (item.allStock > 0) {
+                    if (item.productNum > item.allStock) item.num = item.allStock;
+                    cartList.value.push(item)
                 } else {
+                    // 库存为0 时,移动到售罄商品
                     invalidList.value.push(item)
                 }
+            } else {
+                invalidList.value.push(item)
             }
+
         })
 
         selectAll();
-        cartCalculateFn();
         loading.value = false
-        cartStore.isAddCartRecommend = false
-        if (querOne.value) querOne.value = false
     }).catch((err) => {
         if (err.code == 401) {
             cartList.value = []
@@ -336,24 +332,6 @@ const getCartGoodsListFn = () => {
 }
 
 onShow(() => {
-    console.log('购物车')
-       
-       setTimeout(() => {
-            let share = {
-                title: '购物车',
-                desc: '',
-                // url: img(detail.value.material_list[activeIndex.value].url)
-            }
-
-            setShare({
-                wechat: {
-                    ...share
-                },
-                weapp: {
-                    ...share
-                }
-            });
-    }, 600);
     getCartGoodsListFn()
 })
 
@@ -366,14 +344,7 @@ const goodsSkuInputFn = (data) => {
             data.num = numLimit(data).max;
         }
         uni.$u.debounce((event: any) => {
-            cartStore.increase({
-                id: data.id,
-                goods_id: data.goods_id,
-                sku_id: data.sku_id,
-                stock: data.goodsSku.stock,
-                sale_price: data.goodsSku.sale_price,
-                num: Number(data.num)
-            }, 0);
+            editCart({ productId: data.id, productNum: data.num }).then((res: any) => { })
         }, 500)
     }, 0)
 }
@@ -388,14 +359,7 @@ const goodsSkuBlurFn = (event, index) => {
         }
 
         uni.$u.debounce((event: any) => {
-            cartStore.increase({
-                id: data.id,
-                goods_id: data.goods_id,
-                sku_id: data.sku_id,
-                stock: data.goodsSku.stock,
-                sale_price: data.goodsSku.sale_price,
-                num: Number(data.num)
-            }, 0, cartCalculateFn());
+            editCart({ productId: data.id, productNum: data.num }).then((res: any) => { })
         }, 500)
     }, 0)
 }
@@ -408,67 +372,17 @@ const checkedNum = computed(() => {
     return num
 })
 
-const manjianOpenFn = (data: any) => {
-    let obj = {};
-    obj.condition_type = data.condition_type;
-    obj.rule_json = data.rule_json;
-    obj.name = data.manjian_name;
-    manjianShowRef.value.open(obj);
-}
-
-let isLoadCalculate = false;
-const cartCalculateFn = () => {
-    let calculateArr: Object = [];
+const onMoney = computed(() => {
+    let money = 0;
+    let price = '';
     cartList.value.forEach((item: any) => {
-        if (item.checked && item.goodsSku) {
-            let obj = {};
-            obj.num = item.num;
-            obj.sku_id = item.sku_id;
-            calculateArr.push(obj);
+        if (item.checked) {
+            money = money + Number(item.memberPrice * item.num);
         }
-    })
-
-    if (!calculateArr.length) {
-        total.value.order_money = 0
-        total.value.promotion_money = 0
-        return false;
-    }
-
-    if (isLoadCalculate) return false;
-    isLoadCalculate = true;
-
-    getCartCalculate({ sku_ids: calculateArr }).then(({ data }) => {
-        total.value.goods_money = data.goods_money;
-        total.value.order_money = data.order_money;
-        total.value.promotion_money = data.promotion_money;
-        cartList.value.forEach((item, index) => {
-            for (let subIndex = 0; subIndex < data.match_list.length; subIndex++) {
-                if (item.goods_id == data.match_list[subIndex].goods_id && item.sku_id == data.match_list[subIndex].sku_id && item.manjian_info && Object.keys(item.manjian_info).length) {
-                    item.manjian_info.is_show = true;
-                    let subTempShowNum = 0;
-                    item.manjian_info.rule_json.forEach((threeItem, threeIndex) => {
-                        if (threeIndex == data.match_list[subIndex].level) {
-                            threeItem.is_show = true;
-                            subTempShowNum++;
-                        } else {
-                            threeItem.is_show = false;
-                        }
-                    })
-                    if (subTempShowNum == 0) {
-                        item.manjian_info.is_show = false;
-                    } else {
-                        item.manjian_info.is_show = true;
-                    }
-                    return;
-                }
-            }
-            if (item.manjian_info && Object.keys(item.manjian_info).length) {
-                item.manjian_info.is_show = false;
-            }
-        })
-        isLoadCalculate = false;
-    })
-}
+    });
+    price = Number(money).toFixed(2);
+    return price;
+});
 
 const toLogin = () => {
     useLogin().setLoginBack({ url: '/addon/shop/pages/goods/cart' })
@@ -481,37 +395,20 @@ const toDetail = (data: any) => {
 const numChange = (event: any, index: any) => {
     uni.$u.debounce((event: any) => {
         const data: any = cartList.value[index]
-        cartStore.increase({
-            id: data.id,
-            goods_id: data.goods_id,
-            sku_id: data.sku_id,
-            stock: data.goodsSku.stock,
-            sale_price: data.goodsSku.sale_price,
-            num: data.num
-        }, 0, cartCalculateFn());
+        editCart({ productId: data.id, productNum: data.num }).then((res: any) => { })
     }, 500)
 }
 const addNumChange = (data: any) => {
-    if (data.num >= data.goods.stock) {
+    if (data.num >= data.allStock) {
         uni.showToast({ title: "商品库存不足", icon: 'none' });
         return;
     }
-
-    if (data.goods.is_limit) {
-        let tips = `该商品单次限购${ data.goods.max_buy }件`;
-        if (data.goods.limit_type != 1) { //单次限购
-            tips = `该商品每人限购${ data.goods.max_buy }件`;
-        }
-        if (data.num >= data.goods.max_buy) {
-            uni.showToast({ title: tips, icon: 'none' })
-        }
-    }
 }
 
 const reduceNumChange = (data: any) => {
-    if (data.goods.is_limit && data.goods.min_buy) {
-        let tips = `该商品起购${ data.goods.min_buy }件`;
-        if (data.num <= data.goods.min_buy) {
+    if (data.minOrderQuantity) {
+        let tips = `该商品起购${data.minOrderQuantity}${data.unitName}`;
+        if (data.num <= data.minOrderQuantity) {
             uni.showToast({ title: tips, icon: 'none' })
         }
     }
@@ -519,32 +416,16 @@ const reduceNumChange = (data: any) => {
 
 const numLimit = (data: any) => {
     let obj = {
-        min: 1,
-        max: data.goodsSku.stock || 1
+        min: data.minOrderQuantity || 1,
+        max: data.allStock || 1
     };
 
-    // 限购 - 是否开启限购
-    if (data.goods.is_limit) {
-        if (data.goods.max_buy) {
-            let max_buy = data.goods.max_buy;
-            if (max_buy > data.goods.stock) {
-                obj.max = data.goods.stock
-            } else if (max_buy <= data.goods.stock) {
-                obj.max = max_buy;
-            }
-        }
-    }
-
-    // 起售
-    if (data.goods.min_buy > 0) {
-        obj.min = data.goods.min_buy;
-    }
     return obj;
 }
 
 const cartOptions = ref([
     {
-        text: t('delete'),
+        text: '删除',
         style: {
             backgroundColor: 'var(--primary-color)',
             width: '100rpx',
@@ -558,12 +439,12 @@ const swipeActive = ref()
 const swipeClick = (index: any, item: any) => {
     if (optionLoading.value) return
     optionLoading.value = true
-    cartStore.delete(item.id, () => {
+
+    deleteCart(item.shoppingCartId).then((res: any) => {
         cartList.value.splice(index, 1)
         nextTick(() => {
             if (swipeActive.value) swipeActive.value.closeOther()
         })
-        cartCalculateFn();
         optionLoading.value = false
     })
 }
@@ -573,7 +454,6 @@ const swipeClick = (index: any, item: any) => {
  */
 const selectOnlyGoods = (data: any = {}) => {
     data.checked = !data.checked
-    cartCalculateFn();
 }
 
 /**
@@ -584,13 +464,8 @@ const selectAll = () => {
     cartList.value.forEach((item: any) => {
         item.checked = checked
     })
-    cartCalculateFn();
 }
 
-//强制绑定手机号
-const bindMobileRef: any = ref(null)
-const isBindMobile = ref(uni.getStorageSync('isBindMobile'))
-
 /**
  * 结算
  */
@@ -636,10 +511,9 @@ const deleteCartFn = () => {
 
     const ids: any = []
     cartList.value.forEach((item: any) => {
-        if (item.checked) ids.push(item.id)
+        if (item.checked) ids.push(item.shoppingCartId)
     })
-
-    cartStore.delete(ids, () => {
+    deleteCart(ids.join(',')).then((res: any) => {
         getCartGoodsListFn()
         optionLoading.value = false
     })
@@ -650,27 +524,21 @@ const deleteCartFn = () => {
 const deleteInvalidList = () => {
     if (optionLoading.value) return
     optionLoading.value = true
-    const ids = invalidList.value.map((el: any) => el.id)
-
-    cartStore.delete(ids, () => {
+    const ids: any = []
+    invalidList.value.forEach((item: any) => {
+        ids.push(item.shoppingCartId)
+    })
+    deleteCart(ids.join(',')).then((res: any) => {
         getCartGoodsListFn()
         optionLoading.value = false
+        invalidList.value = []
     })
-    invalidList.value = []
 }
 
 // 商品价格
 const goodsPrice = (data: any) => {
-    return data.goodsSku.show_price
+    return data.memberPrice
 }
-
-watch(
-    () => cartStore.isAddCartRecommend,
-    (newValue, oldValue) => {
-        if(newValue){
-            getCartGoodsListFn()
-        }
-    })
 </script>
 <style lang="scss" scoped>
 @import '@/addon/shop/styles/common.scss';

+ 1 - 1
src/addon/shop/pages/goods/detail.vue

@@ -31,7 +31,7 @@ const posterParam = ref({});
 const copyUrlParam = ref('');
 const nsGoodsSkuData = ref()
 const diy = useDiyGoodsDetail({
-    name: 'DIY_SHOP_GOODS_DETAIL'
+    type: '2'
 })
 const memberStore = useMemberStore()
 const userInfo = computed(() => memberStore.info)

+ 7 - 0
src/app/api/auth.ts

@@ -7,6 +7,13 @@ export function registerMiniCustomer(data: any) {
     return request.post('customer/miniCustomer/registerMiniCustomer', data, { showErrorMessage: true })
 }
 
+/**
+ * 用户登录
+ */
+export function clientLogin(data: any) {
+    return request.post('auth/client/login', data, { showErrorMessage: true })
+}
+
 /**
  * 用户名登录
  */

+ 1 - 1
src/app/api/member.ts

@@ -1,7 +1,7 @@
 import request from '@/utils/request'
 
 export function getMemberInfo() {
-    return request.get('member/member')
+    return request.get('customer/miniEnterprise/info')
 }
 
 /**

+ 43 - 47
src/app/pages/auth/index.vue

@@ -8,13 +8,9 @@
             <!-- #endif -->
             <view class="mx-[var(--sidebar-m)] px-[var(--pad-sidebar-m)]">
                 <view class="pt-[154rpx] flex justify-center">
-                    <view v-if="systemStore.site?.front_end_logo" class="h-[90rpx] w-[300rpx]">
-                        <image class="h-[90rpx] w-[300rpx]" :src="img(systemStore.site?.front_end_logo)" mode="aspectFit" />
+                    <view  class="h-[90rpx] w-[300rpx]">
+                        <image class="h-[90rpx] w-[300rpx]" :src="img('https://index.xiaoluwebsite.xyz/assets/logo1-CZNYIEPv.png')" mode="aspectFit" />
                     </view>
-                    <view v-else-if="systemStore.site?.front_end_icon" class="h-[250rpx] w-[250rpx]">
-                        <image class="h-[250rpx] w-[250rpx]" :src="img(systemStore.site?.front_end_icon)" mode="aspectFit" />
-                    </view>
-                    <view v-else class="h-[90rpx] w-[300rpx]"></view>
                 </view>
                 <view class="text-[var(--text-color-light6)]] text-[28rpx] text-center leading-[34rpx] min-h-[34rpx] mt-[40rpx]">{{ loginConfig.desc }}</view> 
                 <view class="mt-[181rpx]">
@@ -190,47 +186,47 @@ const bindMobileFn = () => {
 }
 
 onLoad(async() => {
-    await systemStore.getSiteInfoFn()
-	await systemStore.getMemberMobileExistFn()
-    await configStore.getLoginConfig()
-    let normalLogin = !configStore.login.is_username && !configStore.login.is_mobile && !configStore.login.is_bind_mobile; // 未开启普通登录
-
-    // #ifdef H5
-    if (isWeixinBrowser()) {
-        // 微信浏览器
-        if (!getToken() && normalLogin && authRegisterLogin.value) {
-            uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
-            setTimeout(() => {
-                redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
-            }, 100)
-        }
-    } else {
-        // 普通浏览器
-        if (!getToken() && normalLogin) {
-            uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
-            setTimeout(() => {
-                redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
-            }, 100)
-        }
-    }
-    // #endif
-
-    // #ifdef MP
-    if (!getToken() && normalLogin && authRegisterLogin.value) {
-        uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
-        setTimeout(() => {
-            redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
-        }, 100)
-        return;
-    }
-
-    wapMemberMobile.value = uni.getStorageSync('member_mobile_exist');
-
-    nextTick(() => {
-        if (wxPrivacyPopupRef.value) wxPrivacyPopupRef.value.proactive();
-    })
-
-    // #endif
+    // await systemStore.getSiteInfoFn()
+	// await systemStore.getMemberMobileExistFn()
+    // await configStore.getLoginConfig()
+    // let normalLogin = !configStore.login.is_username && !configStore.login.is_mobile && !configStore.login.is_bind_mobile; // 未开启普通登录
+
+    // // #ifdef H5
+    // if (isWeixinBrowser()) {
+    //     // 微信浏览器
+    //     if (!getToken() && normalLogin && authRegisterLogin.value) {
+    //         uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
+    //         setTimeout(() => {
+    //             redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
+    //         }, 100)
+    //     }
+    // } else {
+    //     // 普通浏览器
+    //     if (!getToken() && normalLogin) {
+    //         uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
+    //         setTimeout(() => {
+    //             redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
+    //         }, 100)
+    //     }
+    // }
+    // // #endif
+
+    // // #ifdef MP
+    // if (!getToken() && normalLogin && authRegisterLogin.value) {
+    //     uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
+    //     setTimeout(() => {
+    //         redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
+    //     }, 100)
+    //     return;
+    // }
+
+    // wapMemberMobile.value = uni.getStorageSync('member_mobile_exist');
+
+    // nextTick(() => {
+    //     if (wxPrivacyPopupRef.value) wxPrivacyPopupRef.value.proactive();
+    // })
+
+    // // #endif
 })
 
 onShow(() => {

+ 181 - 266
src/app/pages/auth/login.vue

@@ -1,113 +1,66 @@
 <template>
-    <view class="w-screen h-screen flex flex-col  " :style="themeColor()" v-if="type">
-        <!-- #ifdef MP-WEIXIN -->
-        <view :style="{'height':headerHeight}">
-            <top-tabbar :data="param" :scrollBool="topTabarObj.getScrollBool()" class="top-header" />
-        </view>
-        <!-- #endif -->
-        <view class="mx-[60rpx]">
-            <view class="pt-[140rpx] text-[44rpx] font-500 text-[#333]">{{ type == 'username' ? t('accountLogin') : t('mobileLogin') }}</view>
-            <view class="text-[26rpx] text-[#333] leading-[34rpx] mt-[24rpx] mb-[90rpx]" @click="redirect({ url: '/app/pages/auth/register',param:{type} })">
-                <text>{{ t('noAccount') }},</text>
-                <text class="text-primary">{{ t('toRegister') }}</text>
-            </view>
-            <u-form labelPosition="left" :model="formData" errorType='toast' :rules="rules" ref="formRef">
-                <template v-if="type == 'username'">
-                    <view class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6]">
-                        <u-form-item label="" prop="username" :border-bottom="false">
-                            <u-input v-model="formData.username" border="none" maxlength="40"
-                                     :placeholder="t('usernamePlaceholder')" autocomplete="off" class="!bg-transparent"
-                                     :disabled="real_name_input" fontSize="26rpx"
-                                     placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]" />
-                        </u-form-item>
-                    </view>
-                    <view class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6] mt-[40rpx]">
-                        <u-form-item label="" prop="password" :border-bottom="false">
-                            <u-input v-model="formData.password" border="none" :password="isPassword" maxlength="40"
-                                     :placeholder="t('passwordPlaceholder')" autocomplete="new-password"
-                                     class="!bg-transparent" :disabled="real_name_input" fontSize="26rpx"
-                                     placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]">
-                                <template #suffix>
-                                    <view @click="changePassword" v-if="formData.password">
-                                        <u-icon :name="isPassword?'eye-off':'eye-fill'" color="#b9b9b9" size="20"></u-icon>
-                                    </view>
-                                </template>
-                            </u-input>
-                        </u-form-item>
-                    </view>
-                </template>
-                <template v-if="type == 'mobile'">
-                    <view class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6]">
-                        <u-form-item label="" prop="mobile" :border-bottom="false">
-                            <u-input v-model="formData.mobile" type="number" maxlength="11" border="none"
-                                     :placeholder="t('mobilePlaceholder')" autocomplete="off" class="!bg-transparent"
-                                     :disabled="real_name_input" fontSize="26rpx"
-                                     placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]" />
-                        </u-form-item>
-                    </view>
-                    <view class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6] mt-[40rpx]">
-                        <u-form-item label="" prop="mobile_code" :border-bottom="false">
-                            <u-input v-model="formData.mobile_code" type="number" maxlength="4" border="none"
-                                     class="!bg-transparent" fontSize="26rpx" :disabled="real_name_input"
-                                     :placeholder="t('codePlaceholder')"
-                                     placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]">
-                                <template #suffix>
-                                    <sms-code v-if="configStore.login.agreement_show" :mobile="formData.mobile" type="login" v-model="formData.mobile_key" :isAgree="isAgree"></sms-code>
-                                    <sms-code v-else :mobile="formData.mobile" type="login" v-model="formData.mobile_key"></sms-code>
-                                </template>
-                            </u-input>
-                        </u-form-item>
-                    </view>
-                </template>
-            </u-form>
-            <view class="h-[34rpx] text-right text-[24rpx] text-[var(--text-color-light6)] leading-[34rpx] mt-[20rpx] " @click="toResetpwd">{{ type == 'username' ? t('resetpwd') : '' }}</view>
-            <view class="mt-[106rpx]">
-                <button class="w-full h-[80rpx] !bg-[var(--primary-color)] text-[26rpx] rounded-[40rpx] leading-[80rpx] font-500 !text-[#fff] !mx-[0]" :loadingText="t('logining')" @click="handleLogin">{{ t('login') }}</button>
-                <view v-if="configStore.login.agreement_show" class="flex items-center mt-[20rpx] py-[14rpx]" @click.stop="agreeChange">
-                    <u-checkbox-group @change="agreeChange">
-                        <u-checkbox activeColor="var(--primary-color)" :checked="isAgree" shape="circle" size="24rpx" />
-                    </u-checkbox-group>
-                    <view class="text-[24rpx] text-[var(--text-color-light6)] flex items-center flex-wrap leading-[30rpx]">
-                        <text>{{ t('agreeTips') }}</text>
-                        <text @click.stop="redirect({ url: '/app/pages/auth/agreement?key=privacy' })" class="text-primary">《{{ t('privacyAgreement') }}》</text>
-                        <text>{{ t('and') }}</text>
-                        <text @click.stop="redirect({ url: '/app/pages/auth/agreement?key=service' })" class="text-primary">《{{ t('userAgreement') }}》</text>
-                    </view>
-                </view>
-            </view>
-        </view>
-        <uni-popup ref="popupRef" type="dialog">
-            <view class="bg-[#fff] flex flex-col justify-between w-[600rpx] min-h-[280rpx] rounded-[var(--rounded-big)] box-border px-[35rpx] pt-[35rpx] pb-[8rpx] relative">
-                <view class="flex justify-center">
-                    <text class="text-[33rpx] font-700"> 用户协议及隐私保护</text>
-                </view>
-                <view class="flex items-center mb-[20rpx] mt-[20rpx] py-[20rpx]" @click.stop="agreeChange">
-                    <view class="text-[26rpx] text-[var(--text-color-light6)] flex items-center flex-wrap">
-                        <text>{{ t('agreeTips') }}</text>
-                        <text @click.stop="redirect({ url: '/app/pages/auth/agreement?key=privacy' })" class="text-primary">《{{ t('privacyAgreement') }}》</text>
-                        <text>{{ t('and') }}</text>
-                        <text @click.stop="redirect({ url: '/app/pages/auth/agreement?key=service' })" class="text-primary">《{{ t('userAgreement') }}》</text>
-                    </view>
-                </view>
-                <view>
-                    <view class="w-[100%] flex justify-center bg-[var(--primary-color)] h-[70rpx] leading-[70rpx] text-[#fff] text-[26rpx] border-[0] font-500 rounded-[50rpx]" @click="dialogConfirm">同意并登录</view>
-                    <view class="w-[100%] flex justify-center h-[70rpx] leading-[70rpx] text-[#999] text-[24rpx] border-[0] font-500 rounded-[50rpx]" @click="dialogClose">不同意</view>
-                </view>
-            </view>
-        </uni-popup>
-        <view class="footer w-full" v-if="type == 'mobile' && configStore.login.is_username || type == 'username' && configStore.login.is_mobile || isShowQuickLogin">
-            <view class="text-[26rpx] leading-[36rpx] text-[#666] text-center mb-[30rpx] font-400">其他登录方式</view>
-            <view class="flex justify-center gap-[40rpx]">
-                <text v-if="type == 'mobile' && configStore.login.is_username"  @click="setType" class="w-[66rpx] h-[66rpx] flex items-center justify-center iconfont iconmima6Vmm border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
-                <text v-if="type == 'username' && configStore.login.is_mobile" @click="setType" class="w-[66rpx] h-[66rpx] flex items-center justify-center iconfont iconshouji6Vmm border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
-                <text v-if="isShowQuickLogin" @click="toLink" class="w-[66rpx] h-[66rpx] !text-[#1AAB37] flex items-center justify-center iconfont iconweixinV6mm1 border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
-            </view>
-        </view>
-    </view>
+	<view class="w-screen h-screen flex flex-col  " :style="themeColor()">
+		<!-- #ifdef MP-WEIXIN -->
+		<view :style="{ 'height': headerHeight }">
+			<top-tabbar :data="param" :scrollBool="topTabarObj.getScrollBool()" class="top-header" />
+		</view>
+		<!-- #endif -->
+		<view class="mx-[60rpx]">
+			<view class="pt-[140rpx] text-[44rpx] font-500 text-[#333]">账号密码登录</view>
+			<view class="text-[26rpx] text-[#333] leading-[34rpx] mt-[24rpx] mb-[90rpx]"
+				@click="redirect({ url: '/app/pages/auth/register', param: { type } })">
+				<text>还没有账号,</text>
+				<text class="text-primary">去注册</text>
+			</view>
+			<u-form labelPosition="left" :model="formData" errorType='toast' :rules="rules" ref="formRef">
+				<view class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6]">
+					<u-form-item label="" prop="username" :border-bottom="false">
+						<u-input v-model="formData.username" border="none" maxlength="40" placeholder="请输入账号"
+							autocomplete="off" class="!bg-transparent" :disabled="real_name_input" fontSize="26rpx"
+							placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]" />
+					</u-form-item>
+				</view>
+				<view
+					class="h-[88rpx] flex w-full items-center px-[30rpx] rounded-[40rpx] box-border bg-[#F6F6F6] mt-[40rpx]">
+					<u-form-item label="" prop="password" :border-bottom="false">
+						<u-input v-model="formData.password" border="none" :password="isPassword" maxlength="40"
+							placeholder="请输入密码" autocomplete="new-password" class="!bg-transparent"
+							:disabled="real_name_input" fontSize="26rpx"
+							placeholderClass="!text-[var(--text-color-light9)] text-[26rpx]">
+							<template #suffix>
+								<view @click="changePassword" v-if="formData.password">
+									<u-icon :name="isPassword ? 'eye-off' : 'eye-fill'" color="#b9b9b9"
+										size="20"></u-icon>
+								</view>
+							</template>
+						</u-input>
+					</u-form-item>
+				</view>
+			</u-form>
+			<view class="h-[34rpx] text-right text-[24rpx] text-[var(--text-color-light6)] leading-[34rpx] mt-[20rpx] "
+				@click="toResetpwd">忘记密码</view>
+			<view class="mt-[106rpx]">
+				<button
+					class="w-full h-[80rpx] !bg-[var(--primary-color)] text-[26rpx] rounded-[40rpx] leading-[80rpx] font-500 !text-[#fff] !mx-[0]"
+					loadingText="登录中" @click="handleLogin">登录</button>
+			</view>
+		</view>
+		<view class="footer w-full">
+			<view class="text-[26rpx] leading-[36rpx] text-[#666] text-center mb-[30rpx] font-400">其他登录方式</view>
+			<view class="flex justify-center gap-[40rpx]">
+				<text v-if="type == 'mobile' && configStore.login.is_username" @click="setType"
+					class="w-[66rpx] h-[66rpx] flex items-center justify-center iconfont iconmima6Vmm border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
+				<text v-if="type == 'username' && configStore.login.is_mobile" @click="setType"
+					class="w-[66rpx] h-[66rpx] flex items-center justify-center iconfont iconshouji6Vmm border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
+				<text v-if="isShowQuickLogin" @click="toLink"
+					class="w-[66rpx] h-[66rpx] !text-[#1AAB37] flex items-center justify-center iconfont iconweixinV6mm1 border-[2rpx] rounded-[50%] border-solid border-[#ddd] !text-[26rpx]"></text>
+			</view>
+		</view>
+	</view>
 </template>
 <script setup lang="ts">
 import { ref, reactive, computed, onMounted } from 'vue'
-import { usernameLogin, mobileLogin } from '@/app/api/auth'
+import { usernameLogin, mobileLogin, clientLogin } from '@/app/api/auth'
 import useMemberStore from '@/stores/member'
 import useConfigStore from '@/stores/config'
 import { useLogin } from '@/hooks/useLogin'
@@ -123,7 +76,7 @@ const topTabarObj = topTabar()
 const param = topTabarObj.setTopTabbarParam({ title: '', topStatusBar: { bgColor: '#fff', textColor: '#333' } })
 /********* 自定义头部 - end ***********/
 const headerHeight = computed(() => {
-    return Object.keys(systemStore.menuButtonInfo).length ? pxToRpx(Number(systemStore.menuButtonInfo.height)) + pxToRpx(systemStore.menuButtonInfo.top) + pxToRpx(8) + 'rpx' : 'auto'
+	return Object.keys(systemStore.menuButtonInfo).length ? pxToRpx(Number(systemStore.menuButtonInfo.height)) + pxToRpx(systemStore.menuButtonInfo.top) + pxToRpx(8) + 'rpx' : 'auto'
 })
 const real_name_input = ref(true);
 const memberStore = useMemberStore()
@@ -135,218 +88,180 @@ const popupRef = ref()
 const isPassword = ref(true)
 
 const changePassword = () => {
-    isPassword.value = !isPassword.value
+	isPassword.value = !isPassword.value
 }
 
 const dialogClose = () => {
-    popupRef.value.close();
+	popupRef.value.close();
 }
 
 const dialogConfirm = () => {
-    isAgree.value = true
-    popupRef.value.close();
-    handleLogin()
+	isAgree.value = true
+	popupRef.value.close();
+	handleLogin()
 }
 
-onLoad(async(option: any) => {
-    await configStore.getLoginConfig()
-    if (!getToken() && !configStore.login.is_username && !configStore.login.is_mobile) {
-        uni.showToast({ title: '商家未开启普通账号登录', icon: 'none' })
-        setTimeout(() => {
-            redirect({ url: '/app/pages/index/index', mode: 'reLaunch' })
-        }, 100)
-    }
+onLoad(async (option: any) => {
 	// #ifdef H5
-    uni.getStorageSync('openid') && (Object.assign(formData, { wx_openid: uni.getStorageSync('openid') }))
-    // #endif
+	uni.getStorageSync('openid') && (Object.assign(formData, { wx_openid: uni.getStorageSync('openid') }))
+	// #endif
 
-    // #ifdef MP-WEIXIN
-    uni.getStorageSync('openid') && (Object.assign(formData, { weapp_openid: uni.getStorageSync('openid') }))
-    // #endif
-	
-    if (option.type) {
-        if (option.type == 'mobile') {
-            if (configStore.login.is_mobile) {
-                type.value = option.type
-                uni.getStorageSync('pid') && (Object.assign(formData, { pid: uni.getStorageSync('pid') }))
-            }
-        } else if (option.type == 'username' && configStore.login.is_username) {
-            type.value = option.type
-        }
-    } else {
-        if (configStore.login.is_username) {
-            type.value = 'username'
-        } else if (configStore.login.is_mobile) {
-            type.value = 'mobile'
-        }
+	// #ifdef MP-WEIXIN
+	uni.getStorageSync('openid') && (Object.assign(formData, { weapp_openid: uni.getStorageSync('openid') }))
+	// #endif
 
-    }
+	// if (option.type) {
+	// 	if (option.type == 'mobile') {
+	// 		if (configStore.login.is_mobile) {
+	// 			type.value = option.type
+	// 			uni.getStorageSync('pid') && (Object.assign(formData, { pid: uni.getStorageSync('pid') }))
+	// 		}
+	// 	} else if (option.type == 'username' && configStore.login.is_username) {
+	// 		type.value = option.type
+	// 	}
+	// } else {
+	// 	if (configStore.login.is_username) {
+	// 		type.value = 'username'
+	// 	} else if (configStore.login.is_mobile) {
+	// 		type.value = 'mobile'
+	// 	}
 
-    // 如果只开启了账号密码登录,那么就不需要跳转到登录中间页了
+	// }
 
-    // #ifdef MP-WEIXIN
-    if (!configStore.login.is_auth_register) {
-        isShowQuickLogin.value = false;
-    } else {
-        isShowQuickLogin.value = true;
-    }
-    // #endif
+	// // 如果只开启了账号密码登录,那么就不需要跳转到登录中间页了
 
-    // #ifdef H5
-    if (isWeixinBrowser()) {
-        // 微信浏览器
-        if (!configStore.login.is_auth_register) {
-            isShowQuickLogin.value = false;
-        } else {
-            isShowQuickLogin.value = true;
-        }
-    } else {
-        // 普通浏览器
-        isShowQuickLogin.value = false;
-    }
-    // #endif
+	// // #ifdef MP-WEIXIN
+	// if (!configStore.login.is_auth_register) {
+	// 	isShowQuickLogin.value = false;
+	// } else {
+	// 	isShowQuickLogin.value = true;
+	// }
+	// // #endif
+
+	// // #ifdef H5
+	// if (isWeixinBrowser()) {
+	// 	// 微信浏览器
+	// 	if (!configStore.login.is_auth_register) {
+	// 		isShowQuickLogin.value = false;
+	// 	} else {
+	// 		isShowQuickLogin.value = true;
+	// 	}
+	// } else {
+	// 	// 普通浏览器
+	// 	isShowQuickLogin.value = false;
+	// }
+	// // #endif
 })
 
 const formData = reactive({
-    username: '',
-    password: '',
-    mobile: '',
-    mobile_code: '',
-    mobile_key: ''
+	username: '',
+	password: ''
 })
 
 onMounted(() => {
-    // 防止浏览器自动填充
-    setTimeout(() => {
-        real_name_input.value = false;
-    }, 800)
+	// 防止浏览器自动填充
+	setTimeout(() => {
+		real_name_input.value = false;
+	}, 800)
 });
 
 const agreeChange = () => {
-    isAgree.value = !isAgree.value
+	isAgree.value = !isAgree.value
 }
 
 const setType = () => {
-    type.value = type.value == 'username' ? 'mobile' : 'username'
+	type.value = type.value == 'username' ? 'mobile' : 'username'
 }
 
 const loading = ref(false)
 
 const rules = computed(() => {
-    return {
-        'username': {
-            type: 'string',
-            required: type.value == 'username',
-            message: t('usernamePlaceholder'),
-            trigger: ['blur', 'change'],
-        },
-        'password': {
-            type: 'string',
-            required: type.value == 'username',
-            message: t('passwordPlaceholder'),
-            trigger: ['blur', 'change']
-        },
-        'mobile': [
-            {
-                type: 'string',
-                required: type.value == 'mobile',
-                message: t('mobilePlaceholder'),
-                trigger: ['blur', 'change'],
-            },
-            {
-                validator(rule: any, value: any) {
-                    if (type.value != 'mobile') return true
-                    else return uni.$u.test.mobile(value)
-                },
-                message: t('mobileError'),
-                trigger: ['change', 'blur'],
-            }
-        ],
-        'mobile_code': {
-            type: 'string',
-            required: type.value == 'mobile',
-            message: t('codePlaceholder'),
-            trigger: ['blur', 'change']
-        }
-    }
+	return {
+		'username': [
+			{
+				type: 'string',
+				required: true,
+				message: '请输入账号',
+				trigger: ['blur', 'change'],
+			},
+			{
+				validator(rule: any, value: any) {
+					return uni.$u.test.mobile(value);
+				},
+				message: '请输入正确的手机号',
+				trigger: ['change', 'blur'],
+			}
+		],
+		'password': {
+			type: 'string',
+			required: true,
+			message: '请输入密码',
+			trigger: ['blur', 'change']
+		},
+	}
 })
 
 const formRef: any = ref(null)
 
 const handleLogin = () => {
-    formRef.value.validate().then(() => {
-        if (configStore.login.agreement_show && !isAgree.value) {
-            popupRef.value.open();
-            // uni.showToast({ title: t('isAgreeTips'), icon: 'none' });
-            return false;
-        }
-
-        if (loading.value) return
-        loading.value = true
-
-        const login = type.value == 'username' ? usernameLogin : mobileLogin
-        
-        login(formData).then((res: any) => {
-            memberStore.setToken(res.data.token)
-            // todo 已注册的会员不受影响
-            // if (configStore.login.is_bind_mobile && !res.data.mobile) {
-            //     uni.setStorageSync('isBindMobile', true)
-            // }
-            useLogin().handleLoginBack()
-        }).catch(() => {
-            loading.value = false
-        })
-    })
+	formRef.value.validate().then(() => {
+		if (loading.value) return
+		loading.value = true
+		clientLogin(formData).then((res: any) => {
+			memberStore.setToken(res.data.access_token)
+			useLogin().handleLoginBack()
+		}).catch(() => {
+			loading.value = false
+		})
+	})
 }
 
 const toLink = () => {
-    const pages = getCurrentPages(); // 获取页面栈
-    if (pages.length > 1) {
-        const currentPage = pages[pages.length - 2].route;
-        if (currentPage == 'app/pages/auth/index') {
-            // 返回上一页
-            uni.navigateBack({
-                delta: 1 // 默认值是1,表示返回的页面层数
-            });
-        } else {
-            redirect({ url: '/app/pages/auth/index', mode: 'redirectTo' })
-        }
-    } else {
-        redirect({ url: '/app/pages/auth/index', mode: 'redirectTo' })
-    }
+	const pages = getCurrentPages(); // 获取页面栈
+	if (pages.length > 1) {
+		const currentPage = pages[pages.length - 2].route;
+		if (currentPage == 'app/pages/auth/index') {
+			// 返回上一页
+			uni.navigateBack({
+				delta: 1 // 默认值是1,表示返回的页面层数
+			});
+		} else {
+			redirect({ url: '/app/pages/auth/index', mode: 'redirectTo' })
+		}
+	} else {
+		redirect({ url: '/app/pages/auth/index', mode: 'redirectTo' })
+	}
 }
 
-const toResetpwd = () =>{
-    if(type.value == 'username'){
-        redirect({ url: '/app/pages/auth/resetpwd' })
-    }
+const toResetpwd = () => {
+	uni.showToast({ title: '请联系管理员重置密码', icon: 'none' })
 }
 </script>
 <style lang="scss" scoped>
 :deep(.u-input) {
-    background-color: transparent !important;
+	background-color: transparent !important;
 }
 
 :deep(.u-checkbox) {
-    margin: 0 !important;
+	margin: 0 !important;
 }
 
 :deep(.u-form-item) {
-    flex: 1;
+	flex: 1;
 
-    .u-line {
-        display: none;
-    }
+	.u-line {
+		display: none;
+	}
 }
 
 .footer {
-    // position: absolute;
-    // position: fixed;
-    margin-top: 200rpx;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    padding-bottom: calc(151rpx + constant(safe-area-inset-bottom));
-    padding-bottom: calc(151rpx + env(safe-area-inset-bottom));
+	// position: absolute;
+	// position: fixed;
+	margin-top: 200rpx;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	padding-bottom: calc(151rpx + constant(safe-area-inset-bottom));
+	padding-bottom: calc(151rpx + env(safe-area-inset-bottom));
 }
-</style>
+</style>

+ 12 - 18
src/hooks/useLogin.ts

@@ -23,21 +23,20 @@ export function useLogin() {
             const config = useConfigStore()
             const systemStore = useSystemStore()
 
-            // #ifdef MP-WEIXIN
+            // // #ifdef MP-WEIXIN
 
-            if (!uni.getStorageSync('autoLoginLock')  && config.login.is_bind_mobile) {
-                uni.setStorageSync('isBindMobile', true) // 强制绑定手机号标识
-            }
-            // #endif
+            // if (!uni.getStorageSync('autoLoginLock')  && config.login.is_bind_mobile) {
+            //     uni.setStorageSync('isBindMobile', true) // 强制绑定手机号标识
+            // }
+            // // #endif
 
-            // #ifdef H5
-            if (!uni.getStorageSync('autoLoginLock') && isWeixinBrowser() && config.login.is_bind_mobile) {
-                uni.setStorageSync('isBindMobile', true) // 强制绑定手机号标识
-            }
-            // #endif
+            // // #ifdef H5
+            // if (!uni.getStorageSync('autoLoginLock') && isWeixinBrowser() && config.login.is_bind_mobile) {
+            //     uni.setStorageSync('isBindMobile', true) // 强制绑定手机号标识
+            // }
+            // // #endif
 
             // 如果只开启了账号密码登录,就不需要跳转到登录中间页了,直接进入普通账号密码登录页面
-
             // #ifdef MP-WEIXIN
             if (config.login.is_username && !config.login.is_mobile && !config.login.is_auth_register) {
                 redirect({ url: '/app/pages/auth/login', param: { type: 'username' } })
@@ -59,14 +58,9 @@ export function useLogin() {
                     redirect({ url: '/app/pages/auth/index' })
                 }
             } else {
+                console.log('??????')
                 // 普通浏览器
-                if (config.login.is_username && !config.login.is_mobile) {
-                    redirect({ url: '/app/pages/auth/login', param: { type: 'username' } })
-                } else if (systemStore.initStatus == 'finish' && !config.login.is_username && !config.login.is_mobile) {
-                    uni.showToast({ title: '商家未开启登录注册', icon: 'none' })
-                } else {
-                    redirect({ url: '/app/pages/auth/index' })
-                }
+                redirect({ url: '/app/pages/auth/login', param: { type: 'username' } })
             }
             // #endif
         })