Przeglądaj źródła

本地生活模块

DaMowang 2 lat temu
rodzic
commit
86578c1ecf

+ 4 - 6
src/app.scss

@@ -21,7 +21,6 @@ div {
 }
 
 // 文本溢出
-.ellipsis1,
 .ellipsis {
     white-space: nowrap;
     overflow: hidden;
@@ -46,13 +45,12 @@ div {
 
 //  文本溢出-end
 
-/* CDN 服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
+/* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
 @font-face {
     font-family: 'iconfont';  /* Project id 3748689 */
-    src: 
-         url('//at.alicdn.com/t/c/font_3748689_ejdslx0rnek.woff2?t=1681724961508') format('woff2'),
-         url('//at.alicdn.com/t/c/font_3748689_ejdslx0rnek.woff?t=1681724961508') format('woff'),
-         url('//at.alicdn.com/t/c/font_3748689_ejdslx0rnek.ttf?t=1681724961508') format('truetype');
+    src: url('//at.alicdn.com/t/c/font_3748689_wcw36kgzp2l.woff2?t=1684402036060') format('woff2'),
+         url('//at.alicdn.com/t/c/font_3748689_wcw36kgzp2l.woff?t=1684402036060') format('woff'),
+         url('//at.alicdn.com/t/c/font_3748689_wcw36kgzp2l.ttf?t=1684402036060') format('truetype');
   }
 
 .iconfont {

+ 26 - 13
src/pages.json

@@ -28,7 +28,8 @@
 			"path": "pages/orderingfood/merchantlist",
 			"style": {
 				"navigationBarTitleText": "本地生活",
-				"onReachBottomDistance": 200
+				"onReachBottomDistance": 200,
+				"navigationStyle": "custom"
 			}
 		},
 		{
@@ -253,6 +254,18 @@
 						"navigationBarTitleText": "本地生活"
 					}
 				},
+				{
+					"path": "orderingfood/payTheBill",
+					"style": {
+						"navigationBarTitleText": "买单"
+					}
+				},
+				{
+					"path": "orderingfood/activation",
+					"style": {
+						"navigationBarTitleText": "激活"
+					}
+				},
 				{
 					"path": "order/verificationCode",
 					"style": {
@@ -313,12 +326,12 @@
 			]
 		}
 	],
-	// "preloadRule": {
-	// 	"pages/index/index": {
-	// 		"network": "all",
-	// 		"packages": ["pagesB"]
-	// 	}
-	// },
+	"preloadRule": {
+		"pages/index/index": {
+			"network": "all",
+			"packages": ["pagesB"]
+		}
+	},
 	"tabBar": {
 		"color": "#999",
 		"selectedColor": "#18bb88",
@@ -331,18 +344,18 @@
 				"selectedIconPath": "static/nav/home.png",
 				"text": "首页"
 			},
-			{
-				"pagePath": "pages/sign/index",
-				"iconPath": "static/nav/benefits_.png",
-				"selectedIconPath": "static/nav/benefits.png",
-				"text": "福利"
-			},
 			{
 				"pagePath": "pages/orderingfood/merchantlist",
 				"iconPath": "static/nav/local_.png",
 				"selectedIconPath": "static/nav/local.png",
 				"text": "本地生活"
 			},
+			{
+				"pagePath": "pages/sign/index",
+				"iconPath": "static/nav/benefits_.png",
+				"selectedIconPath": "static/nav/benefits.png",
+				"text": "福利"
+			},
 			{
 				"pagePath": "pages/my/index",
 				"iconPath": "static/nav/my_.png",

+ 2 - 2
src/pages/index/index.vue

@@ -18,7 +18,7 @@
                 </view>
                 <swiper class="notice_swiper" vertical autoplay circular :interval="5000" :duration="1000">
                     <swiper-item v-for="(item, index) in not_list" :key="index" @click="toDetail(item.article_id)">
-                        <text class="not_list ellipsis1">{{ item.title }}</text>
+                        <text class="not_list ellipsis">{{ item.title }}</text>
                         <text class="not_ico iconfont">&#xe62e;</text>
                     </swiper-item>
                 </swiper>
@@ -50,7 +50,7 @@
                         <image class="product-image" :src="i.original_img"></image>
                     </view>
                     <view class="content-view">
-                        <view :class="['product-title', 'ellipsis1']">{{ i.goods_name }}</view>
+                        <view :class="['product-title', 'ellipsis']">{{ i.goods_name }}</view>
                         <view class="product-price">
                             <text class="product-price-original">{{ i.price }}</text>
                             <!-- <text class="product-price-favour">¥{{i.originalPrice}}</text> -->

+ 9 - 0
src/pages/my/index.vue

@@ -162,6 +162,15 @@
           </navigator>
         </view>
       </view>
+      <view class="fun mar_t30">
+        <view class="fun_title">本地生活</view>
+        <view class="fun_con mar_t50 flex_r flex_ac flex_jb">
+          <navigator class="fun_list flex_c flex_ac" @click="goto('/pages/agreement/index',{tit:'关于我们',type:7})" hover-class="none">
+            <image class="fun_img" src="/static/my/about.png" mode=""></image>
+            <view class="fun_text">团队</view>
+          </navigator>
+        </view>
+      </view>
       <view class="fun mar_t30">
         <view class="fun_title">我的服务</view>
         <view class="fun_con mar_t50 flex_r flex_ac flex_jb">

+ 87 - 5
src/pages/orderingfood/merchantlist.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="merchantlist">
-    <div class="head"></div>
+    <div class="head">
+      <div class="bg"></div>
+      <div class="card">
+        <div class="card_tit">消费积分账户</div>
+        <div class="msg"><span>支持主流消费场所使用</span><span class="iconfont">&#xe631;</span></div>
+        <div class="m">
+          <div class="tit">账户余额</div>
+          <div class="balance f_dinB">{{ local_uinfo.integral }}</div>
+        </div>
+      </div>
+    </div>
     <div class="list">
       <div class="li_item" v-for="(i,s) in merchantList" :key="s" @click="goMerchant(i)">
         <div class="logo_img">
@@ -17,8 +27,8 @@
 </template>
 
 <script>
-import { post } from "@/request/api.js";
 	import QQMapWX from '@/static/utils/qqmap-wx-jssdk.min.js'
+import { post } from "@/request/api.js";
 export default {
   name: "merchantlist",
   props: {},
@@ -33,9 +43,11 @@ export default {
       },
       merchant: {},
       merchantList: [],
+      local_uinfo: {},
     };
   },
   methods: {
+    // 获取附近商家
     getlists(){
       post("local/getMerchant",this.Query).then(res => {
         if(res.code == 0){
@@ -104,18 +116,36 @@ export default {
 				}
 			});
 		},
+    // 去店铺
     goMerchant(da) {
       uni.setStorageSync("MerchantItem",da)
       this.goto("/pagesB/orderingfood/orderingfood",{
         brand_id:da.brand_id,
         restaurant_id:da.restaurant_id
       })
+    },
+    // 是否激活本地生活
+    isActivation(){
+      post("local/isActivation",this.Query).then(res => {
+        if(res.code == -1){
+          this.goto("/pagesB/orderingfood/activation")
+        }else{
+          this.getLocation();
+          this.getLU();
+        }
+      })
+    },
+    getLU(){
+      post("local/userinfo").then(res=>{
+        if(res.code == 0){
+          this.local_uinfo = res.data
+        }
+      })
     }
   },
-  onLoad(da) {
-    this.getLocation();
+  onShow() {
+    this.isActivation();
   },
-  onShow() {},
   mounted() {},
   onReachBottom() {
     if(this.Query.page < this.merchant.last_page) this.getlists();
@@ -124,6 +154,58 @@ export default {
 </script>
 
 <style scoped lang='scss'>
+.head{
+  .bg{
+    height: 300rpx;
+    background-image: url("http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/a5500a3c12f967a83d123f774b333e2b2d9729bcpng");
+    background-size: 100% 100%;
+  }
+  .card{
+    width: calc(100% - 60rpx);
+    margin: -110rpx 30rpx 0;
+    background-color: #473D31;
+    // background: url("~@/static/my/myBack.png") no-repeat;
+    // background-size: 100% 100%;
+    border-radius: 16rpx;
+    padding: 28rpx 30rpx;
+    height: 280rpx;
+    position: relative;
+    .card_tit{
+      font-size: 36rpx;
+      color: #C99D60;
+    }
+    .msg{
+      color: #C99D60;
+      font-size: 20rpx;
+      margin-top: 8rpx;
+      .iconfont{
+        color: #C99D60;
+        font-size: 28rpx;
+        margin-left: 6rpx;
+      }
+      span{
+        vertical-align: middle;
+      }
+    }
+    .m{
+      position: absolute;
+      bottom: 30rpx;
+      right: 30rpx;
+    }
+    .tit,.balance{
+      color: #C99D60;
+      text-align: right;
+    }
+    .balance{
+      font-size: 40rpx;
+      margin-top: 8rpx;
+      &:before {
+        content: "¥";
+        font-size: 24rpx;
+      }
+    }
+  }
+}
 .list{
   padding: 30rpx;
   .li_item{

+ 1 - 1
src/pages/sign/index.vue

@@ -48,7 +48,7 @@
                     <image class="product-image" :src="i.original_img"></image>
                 </view>
                 <view class="content-view">
-                    <view :class="['product-title', 'ellipsis1']">{{ i.goods_name }}</view>
+                    <view :class="['product-title', 'ellipsis']">{{ i.goods_name }}</view>
                     <view class="product-price">
                         <text class="product-price-original">{{ i.price }}</text>
                         <!-- <text class="product-price-favour">¥{{i.originalPrice}}</text> -->

+ 1 - 1
src/pagesB/invoice/invoiceList.vue

@@ -8,7 +8,7 @@
               <span>{{item.create_time}}</span>
             </div>
             <div class="p2 flex_r flex_jb">
-                <div class="tit ellipsis1">电子发票</div>
+                <div class="tit ellipsis">电子发票</div>
                 <span class="money">金额{{ item.money}}</span>
             </div>
         </div>

+ 1 - 1
src/pagesB/my/assistant.vue

@@ -29,7 +29,7 @@
             <div class="p2 flex_r flex_jb">
               <img :src="item.original_img" class="odr_img" alt />
               <div class="odr_info flex_c flex_jb">
-                <div class="tit ellipsis1">{{ item.goods_name }}</div>
+                <div class="tit ellipsis">{{ item.goods_name }}</div>
                 <div class="num">数量 x{{ item.goods_num }}</div>
                 <div class="money flex_r flex_jb">
                   <span>金额{{ item.order_amount }}</span>

+ 78 - 0
src/pagesB/orderingfood/activation.vue

@@ -0,0 +1,78 @@
+<template>
+  <div class="activation">
+    <div class="con">
+        <div class="con_txt">请输入激活码</div>
+        <input class="activation_code f_dinB" :focus="true" v-model="code">
+    </div>
+    <div class="btnbar">
+        <div class="btn" @click="jihuo">立即激活</div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { post } from "@/request/api.js";
+export default {
+  name: "activation",
+  props: {},
+  components: {},
+  data() {
+    return {
+        code: '',
+    };
+  },
+  methods: {
+    jihuo(){
+        let code = this.code
+        post("local/activation",{code}).then(res=>{
+            if(res.code == 0){
+				uni.switchTab({ url: "/pages/orderingfood/merchantlist" });
+            }
+        })
+    }
+  },
+  onLoad(da) {},
+  onShow() {},
+  mounted() {},
+};
+</script>
+
+<style scoped lang='scss'>
+.activation{
+    padding: 0 30rpx;
+}
+.con{
+    margin-top: 100rpx;
+    .con_txt{
+        color: #999;
+        font-size: 30rpx;
+        text-align: center;
+        margin-bottom: 16rpx;
+    }
+    .activation_code{
+        // color: #000;
+        height: 90rpx;
+        background-color: #fff;
+        border-radius: 12rpx;
+        text-align: center;
+        font-weight: bold;
+        letter-spacing: 4rpx;
+        font-size: 38rpx;
+    }
+}
+.btnbar{
+    position: fixed;
+    bottom: 60rpx;
+    left: 0;
+    padding: 0 30rpx;
+    width: 100%;
+    .btn{
+        font-weight: bold;
+        height: 90rpx;
+        line-height: 90rpx;
+        text-align: center;
+        background: radial-gradient(circle, #d3aa79,#ebcda8);
+        border-radius: 45rpx;
+    }
+}
+</style>

+ 11 - 3
src/pagesB/orderingfood/orderingfood.vue

@@ -193,7 +193,6 @@
 </template>
 <script>
 import Icon from "@/pagesB/components/icon/icon.vue";
-// import QQMapWX from '@/static/utils/qqmap-wx-jssdk.min.js'
 import { post } from "@/request/api.js";
 const app = getApp();
 console.log('app', app);
@@ -340,9 +339,10 @@ export default {
                     curSelectNum++
                     for (let s = 0; s < specification[i].sku_infos.length; s++) {
                         if (specification[i].sku_infos[s].active) {
-                            let { id, name, price, amount } = specification[i].sku_infos[s]
+                            let pid = specification[i].id;
+                            let { id, name, price, amount } = specification[i].sku_infos[s];
 							spec_price += price;
-                            selectSpecArr.push({ id, name, price, amount });
+                            selectSpecArr.push({ id, name, price, amount, pid });
                             selectSpecification[specification[i].name] = specification[i].sku_infos[s].name;
                         }
                     }
@@ -470,6 +470,14 @@ export default {
                 })
             }
         },
+
+        // 去结算页
+        toPaypalTap(){
+            this.goto("/pagesB/orderingfood/payTheBill",{
+                restaurant_id: this.MerchantInfo.restaurant_id,
+                brand_id: this.MerchantInfo.brand_id,
+            })
+        }
     }
 }
 </script>

+ 242 - 0
src/pagesB/orderingfood/payTheBill.vue

@@ -0,0 +1,242 @@
+<template>
+    <div class="payTheBill">
+        <div class="head card">
+            <div class="p1">{{Merchant.restaurant_name}}</div>
+            <div class="p2">{{Merchant.restaurant_address}}</div>
+        </div>
+        <div class="phone card flex_r flex_jb">
+            <span>联系方式</span>
+            <span>{{ userinfo.mobile }}</span>
+        </div>
+        <div class="commodity card">
+            <div class="li tit">
+                <span class="s1">商品名称</span>
+                <span class="s2">数量</span>
+                <span class="s2">原价</span>
+            </div>
+            <div class="li li2" v-for="(i,s) in cartList" :key="s">
+                <span class="s1 ellipsis">{{ i.product_name }}</span>
+                <span class="s2">{{ i.number }}</span>
+                <span class="s2">{{ $h.Mul($h.Add(i.user_price, i.spec_price),i.number) }}</span>
+            </div>
+        </div>
+        <div class="money card">
+            <div class="li flex_r flex_jb">
+                <span>消费金额</span>
+                <span>¥{{ cartTotal || 0 }}</span>
+            </div>
+            <div class="li flex_r flex_jb">
+                <span>消费积分抵扣<span class="corg">{{Integral}}%</span></span>
+                <span>-¥{{ deduction || 0 }}</span>
+            </div>
+            <div class="li flex_r flex_jb">
+                <span>实付金额</span>
+                <span>¥{{ actuallypaid || 0 }}</span>
+            </div>
+        </div>
+        <div class="btnbar">
+            <div class="btn" @click="payBill">确认支付</div>
+        </div>
+        <div class="mag">*核对商品无误后即可付款,然后订单详情页会显示取餐码,将取餐码告知店员即可取餐</div>
+    </div>
+</template>
+<script>
+import { ToPayOpre } from "@/utils/reqTools.js";
+let toPayOpre = new ToPayOpre();
+import { post } from "@/request/api.js";
+export default {
+    name: "payTheBill",
+    props: {},
+    components: {},
+    data() {
+        return {
+            Merchant: {},
+            cartList: [],
+            cartTotal: 0,
+            userinfo: {},
+            Integral: 0,
+
+            deduction: 0,
+            actuallypaid: 0,
+        };
+    },
+    methods: {
+        getMerchant(da) {
+            post("local/getMerchantById", da).then(res => {
+                if (res.code == 0) {
+                    this.Merchant = res.data;
+                }
+            })
+        },
+        getIntegral(){
+            post("local/getIntegral").then(res=>{
+                if (res.code == 0) {
+                    let va = res.data
+                    this.Integral = this.$h.Mul(va,100);
+                    this.deduction = this.$h.Mul(this.cartTotal,va);
+                    this.actuallypaid = this.$h.Sub(this.cartTotal,this.deduction);
+                }
+            })
+        },
+        getCartList(id) {
+            post("local/myCart", {
+                restaurant_id: id,
+            }).then(res => {
+                if (res.code == 0) {
+                    let data = res.data;
+                    let totals = 0;
+                    data.forEach(itm => {
+                        totals = this.$h.Add(totals, this.$h.Mul(this.$h.Add(itm.user_price, itm.spec_price), itm.number));
+                    })
+                    this.cartList = data;
+                    this.cartTotal = totals;
+                    this.getIntegral();
+                }
+            })
+        },
+        async getuserInfo() {
+            this.userinfo = await uni.userfun();
+        },
+        payBill(){
+            let Arr = []
+            for (const it of this.cartList) {
+                let product_details = []
+                let spec = JSON.parse(it.spec)
+                // let ar = [], ar2 = [];
+                // for (const i of spec.selectSpecArr) {
+                //     ar.push(i.pid);
+                //     ar2.push(i.id);
+                // }
+                for (const i of spec.selectSpecArr) {
+                    product_details.push({
+                        specification_id: i.pid,
+                        sku_id: i.id
+                    })
+                }
+                Arr.push({
+                    product_id: it.product_id,
+                    amount: it.number,
+                    // product_details
+                })
+            }
+            let product_detail = JSON.stringify(Arr)
+            let da = {
+                brand_id: this.Merchant.brand_id,
+                restaurant_id: this.Merchant.restaurant_id,
+                phone: this.userinfo.mobile,
+                total_amount: this.actuallypaid,
+                product_detail
+            }
+            post("local/merchantOrder", da).then(res => {
+                if (res.code == 0 && res.data.prepayid) {
+                    toPayOpre.toPay(res.data, (rea) => {
+                      if (!rea) {
+                        // 支付成功
+                        uni.showToast({ title: "支付成功", icon: "none" });
+                      } else {
+                        // 支付失败
+                        uni.showToast({ title: "支付已取消", icon: "none" });
+                      }
+                    });
+                }
+            })
+        }
+    },
+    onReady() {
+        this.getuserInfo();
+    },
+    onLoad(da) {
+        this.getMerchant(da);
+        this.getCartList(da.restaurant_id);
+    },
+    onShow() {},
+    mounted() {},
+};
+</script>
+<style scoped lang='scss'>
+page {
+    background-color: #ECECEC;
+}
+
+.payTheBill {
+    padding: 32rpx;
+}
+
+.head{
+    .p2{
+        font-size: 26rpx;
+        color: #999;
+        margin-top: 10rpx;
+    }
+}
+
+.commodity {
+    .li{
+        margin-bottom: 8rpx;
+        &:last-child{
+            margin-bottom: 0;
+        }
+    }
+    .tit {
+        font-weight: bold;
+        margin-bottom: 18rpx;
+        .s1, .s2 {
+            font-size: 30rpx;
+        }
+    }
+
+    .s1, .s2 {
+        display: inline-block;
+        font-size: 26rpx;
+    }
+
+    .s1 {
+        width: calc(100% - 240rpx);
+    }
+
+    .s2 {
+        width: 120rpx;
+        text-align: center;
+    }
+}
+
+.money{
+    .li{
+        margin-bottom: 16rpx;
+        &:last-child{
+            margin-bottom: 0;
+        }
+        span{
+            font-size: 30rpx;
+        }
+    }
+    .corg{
+        color: #18bb88;
+        margin-left: 5rpx;
+    }
+}
+
+.btnbar{
+    padding: 20rpx 0;
+    .btn{
+        height: 80rpx;
+        line-height: 80rpx;
+        border-radius: 16rpx;
+        background-color: #18bb88;
+        text-align: center;
+        color: #fff;
+    }
+}
+
+.card {
+    background-color: #fff;
+    border-radius: 26rpx;
+    margin-bottom: 30rpx;
+    padding: 28rpx 30rpx;
+    font-size: 32rpx;
+
+    &:last-child {
+        margin-bottom: 0;
+    }
+}
+</style>