Browse Source

feat:甄选好物增加支付方式及优惠抵扣

DaMowang 2 years ago
parent
commit
493fc94f49

+ 1 - 1
src/pages.json

@@ -59,7 +59,7 @@
 		{
 			"path": "pages/to-pay-list/index",
 			"style": {
-				"navigationBarTitleText": "订单购买"
+				"navigationBarTitleText": "提交订单"
 			}
 		},
 		{

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

@@ -81,16 +81,6 @@ export default {
             not_list: [], // 公告列表
             // 金刚区
             area_list: [
-                // {
-                //     name: "零售区",
-                //     url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/cart.png",
-                //     type: 1,
-                // },
-                // {
-                //     name: "批发区",
-                //     url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/wholesale.png",
-                //     type: 2,
-                // },
                 {
                     name: "货易优选",
                     url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/ss.png",
@@ -108,7 +98,7 @@ export default {
                 },
             ],
             spc_list: [{
-                    url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/01.jpg",
+                    url: "http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/480112538cdee825e06f70d8bea95ca715b3763apng",
                 },
                 {
                     url: "https://teaclub.oss-cn-chengdu.aliyuncs.com/menu/02.jpg",

+ 28 - 31
src/pages/my/index.vue

@@ -11,24 +11,17 @@
                     </view>
                 </view>
                 <block v-if="userinfo.nickname">
-                    <view class="user_con flex_c">
+                    <view class="user_con flex_c flex_as flex_jc">
                         <view class="user_name flex_r flex_ae ellipsis">
                             <view @click="goto('/pages/my/userinfo')">{{ userinfo.nickname }}</view>
                             <text v-if="isAuthentication">({{ userinfo.is_authentication == 0 ? "未实名" : "已实名" }})</text>
                         </view>
-                        <view class="flex_r flex_ac">
-                            <view class="user_level clearfix">
-                                <img class="level_img" src="/static/my/huangguan.png">
-                                <span class="level_text">{{ userinfo.level_name }}</span>
-                            </view>
-                        </view>
-                        <view class="user_account flex_r flex_ac mar_t10">
+                        <view class="user_account flex_r flex_ac mar_t16">
                             <view class="account">账号:{{ userinfo.mobile }}</view>
                             <view class="copy_account flex_r flex_ac flex_jc" @tap="copyText(userinfo.mobile)">复制</view>
                         </view>
                     </view>
                     <view class="user_option flex_r flex_ac flex_je">
-                        <!-- <image class="code_img" src="/static/my/f_img_code.png" @tap="getImgPage"></image> -->
                         <navigator class="flex_c flex_ac" @tap="getImgPage" hover-class="none">
                             <image class="fun_img" src="/static/my/f_img_code.png"></image>
                             <view class="fun_text">分享海报</view>
@@ -43,10 +36,10 @@
             </view>
             <!-- 用户信息-end -->
             <!-- 节点 -->
-            <view class="regional" v-if="userinfo.regionalNode">
+            <!-- <view class="regional" v-if="userinfo.regionalNode">
                 <img src="@/static/my/regional.png" alt="" srcset="" class="ico">
                 <span class="txtinfo">区域节点:{{ userinfo.regionalNode.regional_name }}</span>
-            </view>
+            </view> -->
             <!-- 账户信息 -->
             <view class="acc_info flex_r flex_jse">
                 <div class="i_num">
@@ -178,6 +171,10 @@
                         <image class="fun_img" src="/static/my/feedback.png"></image>
                         <view class="fun_text">用户须知</view>
                     </navigator>
+                    <navigator class="fun_list flex_c flex_ac" @click="goto('/pages/my/userinfo')" hover-class="none">
+                        <image class="fun_img" src="/static/my/h_n.png"></image>
+                        <view class="fun_text">头像昵称</view>
+                    </navigator>
                     <view class="fun_list flex_c flex_ac">
                         <button open-type="contact" style="background: #fff; border: 0; line-height: 1; padding: 0">
                             <image class="fun_img" src="/static/my/service.png"></image>
@@ -520,26 +517,26 @@ page {
 
 // 用户信息-end
 
-.regional {
-    padding: 0 10rpx;
-    margin-top: 16rpx;
-
-    .ico {
-        width: 32rpx;
-        height: 32rpx;
-        margin-right: 12rpx;
-    }
-
-    .txtinfo {
-        color: #000;
-        font-size: 25rpx;
-    }
-
-    .ico,
-    .txtinfo {
-        vertical-align: middle;
-    }
-}
+// .regional {
+//     padding: 0 10rpx;
+//     margin-top: 16rpx;
+
+//     .ico {
+//         width: 32rpx;
+//         height: 32rpx;
+//         margin-right: 12rpx;
+//     }
+
+//     .txtinfo {
+//         color: #000;
+//         font-size: 25rpx;
+//     }
+
+//     .ico,
+//     .txtinfo {
+//         vertical-align: middle;
+//     }
+// }
 
 // 账户信息
 .acc_info {

+ 492 - 581
src/pages/product/p_details.vue

@@ -1,193 +1,111 @@
 <template>
-  <view class="container">
-    <!-- 轮播图 -->
-    <swiper-banner
-      imgScale="1:1"
-      :imgArr="detail.goods_img"
-      :duration="1000"
-      :interval="5000"
-      :circular="true"
-      :autoplay="true"
-      :indicator-dots="true"
-      indicator-active-color="#12B280"
-      indicator-color="rgba(255, 255, 255, .82)"
-    ></swiper-banner>
-    <!-- 轮播图-end -->
-    <!-- 价格信息栏 -->
-    <view class="price_info flex_r flex_ac flex_jb">
-      <view v-if="type == 5" class="price">
-        <span v-if="Number(detail.cost_price) != 0"
-          >{{ detail.cost_price }}元</span
-        >
-        <span
-          v-if="Number(detail.cha_bao) != 0 && Number(detail.cost_price) != 0"
-          >+</span
-        >
-        <span v-if="Number(detail.cha_bao) != 0">{{ detail.cha_bao }}茶宝</span>
-      </view>
-      <view v-else class="price" :class="type == 2 ? 'samll' : ''">
-        <view>
-          <text class="p_favour" v-if="(type == 2)"
-            >¥{{ detail.trade_price }}  + {{detail.trade_num}}批发券 + {{detail.treasure_price}}茶宝</text
-          >
-		  <view v-if="type == 6">
-			  <text class="un_p_favour">¥{{
-			    detail.original_price
-			  }}</text>
-			  <text class="p_favour">¥{{
-			    detail.cost_price
-			  }}</text>
-		  </view>
-          <text v-if="(type == 1)" class="p_favour">¥{{
-            detail.cost_price
-          }}</text>
-          <text class="p_favour" v-if="(type == 3 || type == 4)">
-            ¥{{detail.cost_price}}
-          </text>
-          <text class="p_favour" v-if="(type == 5)">
-            ¥{{detail.cost_price}} + {{detail.treasure_price}}茶宝
-          </text>
-        </view>
-        <span class="p_trade" v-if="(type == 1)">送 {{detail.trade_give_num}} 批发券</span>
-        <span class="p_trade" v-if="(type == 3 || type == 4)">送 {{detail.give_cha_bao}} 茶宝</span>
-      </view>
-      <view class="price_span flex_r flex_ac flex_je">
-        <view class="triangle"></view>
-        <view class="span_conten flex_r flex_ac flex_jc">{{
-          tidyTpye(goodsDa.type)
-        }}</view>
-      </view>
-    </view>
-    <!-- 价格信息栏-end -->
-    <!-- 标题信息栏 -->
-    <view class="title_info">
-      <view class="goods_name">{{ detail.goods_name }}</view>
-      <view class="goods_teac flex_r flex_jb" v-if="['3','4'].includes(type)">
-        <view class="product-txt">限时赠送{{ detail.teac }}TeaC</view>
-        <view class="product-txt fenxiang"> 
-            <text class="iconfont red">&#xe62b;</text>
-            <text class="red">分享约获得 {{ detail.first_teac }} TeaC</text>
+    <view class="container">
+        <!-- 轮播图 -->
+        <swiper-banner imgScale="1:1" :imgArr="detail.goods_img" :duration="1000" :interval="5000" :circular="true" :autoplay="true" :indicator-dots="true" indicator-active-color="#12B280" indicator-color="rgba(255, 255, 255, .82)"></swiper-banner>
+        <!-- 轮播图-end -->
+        <!-- 价格信息栏 -->
+        <view class="price_info flex_r flex_ac flex_jb">
+            <view v-if="type == 5" class="price">
+                <span v-if="Number(detail.cost_price) != 0">{{ detail.cost_price }}元</span>
+                <span v-if="Number(detail.cha_bao) != 0 && Number(detail.cost_price) != 0">+</span>
+                <span v-if="Number(detail.cha_bao) != 0">{{ detail.cha_bao }}茶宝</span>
+            </view>
+            <view v-else class="price" :class="type == 2 ? 'samll' : ''">
+				<text class="p_favour" v-if="(type == 1)">¥{{ detail.cost_price }}</text>
+				<text class="p_favour" v-if="type == 2">¥{{ detail.trade_price }} + {{detail.trade_num}}批发券 + {{detail.treasure_price}}茶宝</text>
+				<text class="p_favour" v-if="type == 3">¥{{ detail.cost_price }}</text>
+				<text class="p_favour" v-if="type == 4">¥{{ $h.Sub(detail.cost_price,detail.consume) }}</text>
+				<text class="p_favour" v-if="type == 5">¥{{ detail.cost_price }} + {{ detail.treasure_price }}茶宝</text>
+				<template v-if="type == 6">
+					<text class="p_favour">¥{{ detail.cost_price }}</text>
+					<text class="un_p_favour">¥{{ detail.original_price }}</text>
+				</template>
+				<text class="p_trade" v-if="type == 1">送 {{detail.trade_give_num}} 批发券</text>
+				<text class="p_trade" v-if="(type == 3 || type == 4)">送 {{detail.give_cha_bao}} 茶宝</text>
+                <view v-if="type == 4">
+					<text class="un_p_favour un_p">{{ detail.cost_price }}</text>
+				    <text class="p_trade">消费金抵扣 {{detail.consume}}</text>
+                </view>
+            </view>
+            <view class="price_span flex_r flex_ac flex_je">
+                <view class="triangle"></view>
+                <view class="span_conten flex_r flex_ac flex_jc">{{ tidyTpye(goodsDa.type) }}</view>
+            </view>
         </view>
-      </view>
-      <view class="goods_subName">{{ detail.goodsMsg }}</view>
-    </view>
-    <!-- 标题信息栏-end -->
-    <!-- 产品简介 -->
-    <view class="brief mar_t20">
-      <view class="brief_title flex_r flex_ac">产品简介</view>
-      <view class="brief_con">
-        <jyfParser :html="detail.goods_content" ref="jyf"></jyfParser>
-        <!-- <image :lazy-load="true" style="width: 100%;display: block;" v-for="(item,index) in detail.goodsDetailesImage" :key="index" :src="item" mode="widthFix"></image> -->
-      </view>
-    </view>
-    <!-- 产品简介-end -->
-    <!-- 底部导航组件 -->
-    <view class="option">
-      <uni-goods-nav
-        :fill="true"
-        :options="options"
-        :buttonGroup="type == 5 ? buttonGroupTea : buttonGroup"
-        @click="onClick"
-        @buttonClick="buttonClick"
-      />
-    </view>
-    <!-- 底部导航组件-end -->
-    <!-- 授权 -->
-    <authorize-module
-      v-if="showAuth"
-      :shopInfo="shopInfo"
-      @authGetTelSuccess="onauthGetTelSuccess"
-    />
-    <!-- 授权-end -->
-    <!-- 购买或加入购物车弹窗 -->
-    <uni-popup ref="shopping" type="bottom">
-      <view class="shopping">
-        <view class="close_con flex_r flex_je">
-          <image
-            class="close_img"
-            src="/static/close.png"
-            @tap="closeBtn"
-            mode=""
-          ></image>
+        <!-- 价格信息栏-end -->
+        <!-- 标题信息栏 -->
+        <view class="title_info">
+            <view class="goods_name">{{ detail.goods_name }}</view>
+            <view class="goods_teac flex_r flex_jb" v-if="['3','4'].includes(type)">
+                <view class="product-txt">限时赠送{{ detail.teac }}TeaC</view>
+                <view class="product-txt fenxiang">
+                    <text class="iconfont red">&#xe62b;</text>
+                    <text class="red">分享约获得 {{ detail.first_teac }} TeaC</text>
+                </view>
+            </view>
+            <view class="goods_subName">{{ detail.goodsMsg }}</view>
         </view>
-        <view class="goods_info flex_r">
-          <image class="goods_img" :src="detail.original_img" mode=""></image>
-          <view class="goods_con flex_c flex_jb">
-            <view class="shop_names">{{ detail.goods_name }}</view>
-            <view class="goods_msg" v-if="type == 2"
-              >{{ detail.trade_price }}元+{{ detail.trade_num }}批发券+{{
-                detail.treasure_price
-              }}茶宝</view
-            >
-            <view class="goods_msg" v-else>¥{{ detail.cost_price }}</view>
-            <view class="num_con flex_r flex_je" v-if="type != 6">
-              <uni-number-box
-                :min="1"
-                @change="bindChange"
-                :value="buyNum"
-              ></uni-number-box>
+        <!-- 标题信息栏-end -->
+        <!-- 产品简介 -->
+        <view class="brief mar_t20">
+            <view class="brief_title flex_r flex_ac">产品简介</view>
+            <view class="brief_con">
+                <jyfParser :html="detail.goods_content" ref="jyf"></jyfParser>
+                <!-- <image :lazy-load="true" style="width: 100%;display: block;" v-for="(item,index) in detail.goodsDetailesImage" :key="index" :src="item" mode="widthFix"></image> -->
             </view>
-            <view class="num_str flex_r flex_je" v-else>x 1</view>
-          </view>
         </view>
-        <view class="goods_option flex_r flex_ac flex_jse" v-if="type == 2">
-          <view class="goods_raido flex_r flex_ac" @tap="setWay('0')">
-            <view
-              class="raido_img"
-              :class="pfway == '0' ? 'raido_box' : ''"
-            ></view>
-            <view class="raido_text">发货邮寄</view>
-          </view>
-          <view class="goods_raido flex_r flex_ac" @tap="setWay('1')">
-            <view
-              class="raido_img"
-              :class="pfway == '1' ? 'raido_box' : ''"
-            ></view>
-            <view class="raido_text">申请寄卖</view>
-          </view>
+        <!-- 产品简介-end -->
+        <!-- 底部导航组件 -->
+        <view class="option">
+            <uni-goods-nav :fill="true" :options="options" :buttonGroup="type == 5 ? buttonGroupTea : buttonGroup" @click="onClick" @buttonClick="buttonClick" />
         </view>
-        <!-- <view class="goods_option flex_r flex_ac flex_jse" v-if="type != 2">
-          <view class="goods_raido flex_r flex_ac" @tap="setQhWay('0')">
-            <view
-              class="raido_img"
-              :class="qhway == '0' ? 'raido_box' : ''"
-            ></view>
-            <view class="raido_text">快递邮寄</view>
-          </view>
-          <view class="goods_raido flex_r flex_ac" @tap="setQhWay('1')">
-            <view
-              class="raido_img"
-              :class="qhway == '1' ? 'raido_box' : ''"
-            ></view>
-            <view class="raido_text">到店自提</view>
-          </view>
-        </view> -->
-        <checkbox-group class="flex_r flex_ac flex_jc" @change="checkboxChange">
-          <label class="option_box">
-            <checkbox
-              value="1"
-              :checked="checked"
-              color="#2DB389"
-              style="transform: scale(0.7)"
-            />
-            我已阅读同意<text
-              @tap.stop="getProPage"
-              v-if="type != 5 && type != 6"
-              >《购买协议》</text
-            >
-            <text @tap.stop="getProPage" v-else-if="type == 5"
-              >《兑换协议》</text
-            >
-            <text @tap.stop="getProPage" v-else-if="type == 6"
-              >《天天捡漏协议》</text
-            >
-          </label>
-        </checkbox-group>
-        <view class="confim flex_r flex_ac flex_jc" @tap="ToPayPage">确定</view>
-      </view>
-    </uni-popup>
-    <!-- 购买或加入购物车弹窗-end -->
-  </view>
+        <!-- 底部导航组件-end -->
+        <!-- 授权 -->
+        <authorize-module v-if="showAuth" :shopInfo="shopInfo" @authGetTelSuccess="onauthGetTelSuccess" />
+        <!-- 授权-end -->
+        <!-- 购买或加入购物车弹窗 -->
+        <uni-popup ref="shopping" type="bottom">
+            <view class="shopping">
+                <view class="close_con flex_r flex_je">
+                    <image class="close_img" src="/static/close.png" @tap="closeBtn" mode=""></image>
+                </view>
+                <view class="goods_info flex_r">
+                    <image class="goods_img" :src="detail.original_img" mode=""></image>
+                    <view class="goods_con flex_c flex_jb">
+                        <view class="shop_names">{{ detail.goods_name }}</view>
+                        <view class="goods_msg" v-if="type == 2">{{ detail.trade_price }}元+{{ detail.trade_num }}批发券+{{
+                            detail.treasure_price
+                            }}茶宝</view>
+                        <view class="goods_msg" v-else>¥{{ detail.cost_price }}</view>
+                        <view class="num_con flex_r flex_je" v-if="type != 6">
+                            <uni-number-box :min="1" @change="bindChange" :value="buyNum"></uni-number-box>
+                        </view>
+                        <view class="num_str flex_r flex_je" v-else>x 1</view>
+                    </view>
+                </view>
+                <view class="goods_option flex_r flex_ac flex_jse" v-if="type == 2">
+                    <view class="goods_raido flex_r flex_ac" @tap="setWay('0')">
+                        <view class="raido_img" :class="pfway == '0' ? 'raido_box' : ''"></view>
+                        <view class="raido_text">发货邮寄</view>
+                    </view>
+                    <view class="goods_raido flex_r flex_ac" @tap="setWay('1')">
+                        <view class="raido_img" :class="pfway == '1' ? 'raido_box' : ''"></view>
+                        <view class="raido_text">申请寄卖</view>
+                    </view>
+                </view>
+                <checkbox-group class="flex_r flex_ac flex_jc" @change="checkboxChange">
+                    <label class="option_box">
+                        <checkbox value="1" :checked="checked" color="#2DB389" style="transform: scale(0.7)" />
+                        我已阅读同意<text @tap.stop="getProPage" v-if="type != 5 && type != 6">《购买协议》</text>
+                        <text @tap.stop="getProPage" v-else-if="type == 5">《兑换协议》</text>
+                        <text @tap.stop="getProPage" v-else-if="type == 6">《天天捡漏协议》</text>
+                    </label>
+                </checkbox-group>
+                <view class="confim flex_r flex_ac flex_jc" @tap="ToPayPage">确定</view>
+            </view>
+        </uni-popup>
+        <!-- 购买或加入购物车弹窗-end -->
+    </view>
 </template>
 <script>
 let page = 1;
@@ -201,549 +119,542 @@ import uniGoodsNav from "@/components/uni-goods-nav/uni-goods-nav.vue";
 import uniNumberBox from "@/components/uni-number-box/uni-number-box.vue";
 import authorizeModule from "@/components/authorize-module/index";
 export default {
-  components: {
-    uniPopup,
-    jyfParser,
-    uniGoodsNav,
-    swiperBanner,
-    uniNumberBox,
-    authorizeModule,
-  },
-  data() {
-    return {
-      imgArr: ["/static/goods5.jpg"],
-      content: "",
-      options: [
-        // 底部导航跳转
-        {
-          icon: "home",
-          text: "主页",
-        },
-        // {
-        //  icon: 'cart',
-        //  text: '购物车',
-        //  info: 0
-        // }
-      ],
-      buttonGroup: [
-        // 底部操作按钮
-        // {
-        //  text: '加入购物车',
-        //  backgroundColor: '#ff0000',
-        //  color: '#fff'
-        // },
-        {
-          text: "立即购买",
-          backgroundColor: "#ffa200",
-          color: "#fff",
-        },
-      ],
-      buttonGroupTea: [
-        // 底部操作按钮
-        // {
-        //  text: '加入购物车',
-        //  backgroundColor: '#ff0000',
-        //  color: '#fff'
-        // },
-        {
-          text: "立即兑换",
-          backgroundColor: "#ffa200",
-          color: "#fff",
-        },
-      ],
-      btnIndex: 0, // 用户点击按钮事件判断 0:加入购物车;1:立即购买
-      type: null, // 商品类型,1零售 2批发 3精品 4今日值买
-      goodsId: "", // 商品ID
-      id: "", //合伙人套餐ID
-      detail: {
-        goods: {},
-      }, // 商品详情
-      checked: false, //是否选中协议
-      buyNum: 1, //购买数量
-      pfway: "1", // 批发
-      qhway: "0", //提货方式
-      shopInfo: {}, // 商铺信息
-      showAuth: false,
-
-      userinfo: {},
-      goodsDa: {},
-      unid: "",
-    };
-  },
-  onLoad: function (e) {
-    this.userinfo = uni.getStorageSync("userinfo");
-    let token = uni.getStorageSync("token");
-    this.type = e.type;
-    this.goodsDa = e;
-    this.loadData(e);
-
-    if (e.invite && !token) this.login(e.invite);
-  },
-  onShow: function () {},
-  methods: {
-    // 商品详情信息
-    loadData(da) {
-      post("v1/goods/goodsDetail", da).then((res) => {
-        if (res.code === 0) {
-          this.detail = res.data.data;
-          let imgs = [];
-          imgs.push(this.detail.original_img);
-          imgs.push(...this.detail.goods_img);
-          this.detail.goods_img = imgs;
-        } else {
-          uni.showModal({
-            title: "提示",
-            content: res.msg,
-            showCancel: false,
-            success: function (res) {
-              if (res) {
-                uni.navigateBack({
-                  delta: 1,
-                });
-              }
-            },
-          });
-        }
-      });
-    },
-    // 去购买
-    ToPayPage: function () {
-      if (!this.checked) {
-        appEv.errTips("请阅读并同意购买协议");
-        return;
-      }
-      if (this.btnIndex == 0) {
-        this.toPayOrder();
-      }
-    },
-    // 创建购买订单
-    toPayOrder: function () {
-      let da = {
-        ...this.goodsDa,
-        num: Number(this.buyNum),
-        // prom_type:this.qhway,
-        is_sell: this.type == 2 ? this.pfway : "0",
-      };
-      this.goto("/pages/to-pay-list/index", da);
-    },
-    // 添加到购物车
-    SetCartGoodsList() {},
-    // 购买数量更改
-    bindChange(e) {
-      this.buyNum = e;
-    },
-    // 更改批发方式
-    setWay(e) {
-      this.pfway = e;
-    },
-    setQhWay(e){
-      this.qhway = e
-    },
-    // 点击同意协议
-    checkboxChange(e) {
-      let index = e.detail.value.indexOf("1");
-      if (index != -1) {
-        this.checked = true;
-      } else {
-        this.checked = false;
-      }
+    components: {
+        uniPopup,
+        jyfParser,
+        uniGoodsNav,
+        swiperBanner,
+        uniNumberBox,
+        authorizeModule,
     },
-    // 点击底部主页购物车等按钮
-    onClick(e) {
-      if (e.index === 0) {
-        uni.switchTab({ url: "/pages/index/index" });
-      }
+    data() {
+        return {
+            imgArr: ["/static/goods5.jpg"],
+            content: "",
+            options: [
+                // 底部导航跳转
+                {
+                    icon: "home",
+                    text: "主页",
+                },
+                // {
+                //  icon: 'cart',
+                //  text: '购物车',
+                //  info: 0
+                // }
+            ],
+            buttonGroup: [
+                // 底部操作按钮
+                // {
+                //  text: '加入购物车',
+                //  backgroundColor: '#ff0000',
+                //  color: '#fff'
+                // },
+                {
+                    text: "立即购买",
+                    backgroundColor: "#ffa200",
+                    color: "#fff",
+                },
+            ],
+            buttonGroupTea: [
+                // 底部操作按钮
+                // {
+                //  text: '加入购物车',
+                //  backgroundColor: '#ff0000',
+                //  color: '#fff'
+                // },
+                {
+                    text: "立即兑换",
+                    backgroundColor: "#ffa200",
+                    color: "#fff",
+                },
+            ],
+            btnIndex: 0, // 用户点击按钮事件判断 0:加入购物车;1:立即购买
+            type: null, // 商品类型,1零售 2批发 3精品 4今日值买
+            goodsId: "", // 商品ID
+            id: "", //合伙人套餐ID
+            detail: {
+                goods: {},
+            }, // 商品详情
+            checked: false, //是否选中协议
+            buyNum: 1, //购买数量
+            pfway: "1", // 批发
+            qhway: "0", //提货方式
+            shopInfo: {}, // 商铺信息
+            showAuth: false,
+
+            userinfo: {},
+            goodsDa: {},
+            unid: "",
+        };
     },
-    // 点击立即购买或加入购物车
-    buttonClick: function (e) {
-      this.btnIndex = e.index;
-      this.$refs.shopping.open();
-    },
-    // 点击关闭弹窗
-    closeBtn: function () {
-      this.$refs.shopping.close();
-    },
-    getProPage() {
-      uni.navigateTo({
-        url: "/pages/pay-agreement/index?type=" + this.goodsDa.type,
-      });
+    onLoad: function(e) {
+        this.userinfo = uni.getStorageSync("userinfo");
+        let token = uni.getStorageSync("token");
+        this.type = e.type;
+        this.goodsDa = e;
+        this.loadData(e);
+
+        if (e.invite && !token) this.login(e.invite);
     },
+    onShow: function() {},
+    methods: {
+        // 商品详情信息
+        loadData(da) {
+            post("v1/goods/goodsDetail", da).then((res) => {
+                if (res.code === 0) {
+                    this.detail = res.data.data;
+                    let imgs = [];
+                    imgs.push(this.detail.original_img);
+                    imgs.push(...this.detail.goods_img);
+                    this.detail.goods_img = imgs;
+                } else {
+                    uni.showModal({
+                        title: "提示",
+                        content: res.msg,
+                        showCancel: false,
+                        success: function(res) {
+                            if (res) {
+                                uni.navigateBack({
+                                    delta: 1,
+                                });
+                            }
+                        },
+                    });
+                }
+            });
+        },
+        // 去购买
+        ToPayPage: function() {
+            if (!this.checked) {
+                appEv.errTips("请阅读并同意购买协议");
+                return;
+            }
+            if (this.btnIndex == 0) {
+                this.toPayOrder();
+            }
+        },
+        // 创建购买订单
+        toPayOrder: function() {
+            let da = {
+                ...this.goodsDa,
+                num: Number(this.buyNum),
+                // prom_type:this.qhway,
+                is_sell: this.type == 2 ? this.pfway : "0",
+            };
+            this.goto("/pages/to-pay-list/index", da);
+        },
+        // 添加到购物车
+        SetCartGoodsList() {},
+        // 购买数量更改
+        bindChange(e) {
+            this.buyNum = e;
+        },
+        // 更改批发方式
+        setWay(e) {
+            this.pfway = e;
+        },
+        setQhWay(e) {
+            this.qhway = e
+        },
+        // 点击同意协议
+        checkboxChange(e) {
+            let index = e.detail.value.indexOf("1");
+            if (index != -1) {
+                this.checked = true;
+            } else {
+                this.checked = false;
+            }
+        },
+        // 点击底部主页购物车等按钮
+        onClick(e) {
+            if (e.index === 0) {
+                uni.switchTab({ url: "/pages/index/index" });
+            }
+        },
+        // 点击立即购买或加入购物车
+        buttonClick: function(e) {
+            this.btnIndex = e.index;
+            this.$refs.shopping.open();
+        },
+        // 点击关闭弹窗
+        closeBtn: function() {
+            this.$refs.shopping.close();
+        },
+        getProPage() {
+            uni.navigateTo({
+                url: "/pages/pay-agreement/index?type=" + this.goodsDa.type,
+            });
+        },
 
-    login(invite) {
-      let that = this;
-      // #ifdef  MP-WEIXIN
-      wx.login({
-        success(res) {
-          if (res.code) {
-            post("v1/appletLogin", {
-              invite,
-              code: res.code,
+        login(invite) {
+            let that = this;
+            // #ifdef  MP-WEIXIN
+            wx.login({
+                success(res) {
+                    if (res.code) {
+                        post("v1/appletLogin", {
+                            invite,
+                            code: res.code,
+                        }).then((res) => {
+                            if (res.code === 0) {
+                                if (res.data.token) {
+                                    uni.setStorageSync("token", res.data.token);
+                                    that.getuserInfo();
+                                } else {
+                                    that.unid = res.data.unid;
+                                    // setTimeout(() => {
+                                    that.shopInfo = app.globalData.shopInfo;
+                                    that.showAuth = true;
+                                    // }, 1000);
+                                }
+                            }
+                        });
+                    }
+                },
+            });
+            // #endif
+        },
+        onauthGetTelSuccess(da) {
+            this.showAuth = false;
+            post("v1/getMobile", {
+                unid: this.unid,
+                ...da.detail,
             }).then((res) => {
-              if (res.code === 0) {
-                if (res.data.token) {
-                  uni.setStorageSync("token", res.data.token);
-                  that.getuserInfo();
-                } else {
-                  that.unid = res.data.unid;
-                  // setTimeout(() => {
-                  that.shopInfo = app.globalData.shopInfo;
-                  that.showAuth = true;
-                  // }, 1000);
+                if (res.code === 0) {
+                    uni.setStorageSync("token", res.data.token);
+                    this.getuserInfo();
                 }
-              }
             });
-          }
         },
-      });
-      // #endif
+        async getuserInfo() {
+            this.userinfo = await uni.userfun();
+        },
     },
-    onauthGetTelSuccess(da) {
-      this.showAuth = false;
-      post("v1/getMobile", {
-        unid: this.unid,
-        ...da.detail,
-      }).then((res) => {
-        if (res.code === 0) {
-          uni.setStorageSync("token", res.data.token);
-          this.getuserInfo();
+    onShareAppMessage: function() {
+        let userinfo = uni.getStorageSync("userinfo");
+        var path =
+            "/pages/product/p_details?agentId=1" +
+            "&id=" +
+            this.goodsDa.id +
+            "&type=" +
+            this.goodsDa.type;
+        if (userinfo.invite) {
+            path =
+                "/pages/product/p_details?invite=" +
+                userinfo.invite +
+                "&id=" +
+                this.goodsDa.id +
+                "&type=" +
+                this.goodsDa.type;
         }
-      });
+        var title = `让数字经济赋能美好生活!`;
+        return {
+            title: title,
+            path: path,
+        };
     },
-    async getuserInfo() {
-      this.userinfo = await uni.userfun();
-    },
-  },
-  onShareAppMessage: function () {
-    let userinfo = uni.getStorageSync("userinfo");
-    var path =
-      "/pages/product/p_details?agentId=1" +
-      "&id=" +
-      this.goodsDa.id +
-      "&type=" +
-      this.goodsDa.type;
-    if (userinfo.invite) {
-      path =
-        "/pages/product/p_details?invite=" +
-        userinfo.invite +
-        "&id=" +
-        this.goodsDa.id +
-        "&type=" +
-        this.goodsDa.type;
-    }
-    var title = `让数字经济赋能美好生活!`;
-    return {
-      title: title,
-      path: path,
-    };
-  },
 };
 </script>
 <style lang="scss">
 // 页面配置
 page {
-  background: #f5f5f5;
+    background: #f5f5f5;
 }
 
 .container {
-  padding-bottom: 90rpx;
+    padding-bottom: 90rpx;
 }
 
 // 页面配置-end
 
 // 价格信息栏
 .price_span {
-  width: 283rpx;
-  height: 100%;
-  position: relative;
+    width: 283rpx;
+    height: 100%;
+    position: relative;
 }
 
 .price text {
-  // font-size: 24rpx;
-  color: #fff;
-  font-family: "SourceHanSansCN-Medium";
+    // font-size: 24rpx;
+    color: #fff;
+    font-family: "SourceHanSansCN-Medium";
 }
 
 .price_info {
-  background: #ff6d44;
-  height: 92rpx;
-  width: 100%;
-  box-sizing: border-box;
+    background: #ff6d44;
+    height: 92rpx;
+    width: 100%;
+    box-sizing: border-box;
 }
 
 .price {
-  font-size: 38rpx;
-  color: #fff;
-  font-family: "SourceHanSansCN-Medium";
-  margin-left: 20rpx;
-  justify-content: flex-end;
-  align-items: flex-end;
-  text-align: end;
-  display: flex;
-  flex-direction: row;
-  // padding: 2px 0;
-  .p_favour {
-    font-size: 36rpx;
-    flex: 2;
-    // margin-left: 20rpx;
-    // text-decoration: line-through;
-    // &:before{
-    //     content:"¥";
-    // }
-  }
-  
-  .un_p_favour{
-	  font-size: 36rpx;
-	  text-decoration: line-through;
-	  flex: 2;
-  }
-  .p_trade {
-    flex: 1;
-    font-size: 20rpx;
-    display: flex;
-    margin-left:20rpx;
-  }
+    color: #fff;
+    margin-left: 20rpx;
+	width: 400rpx;
+
+    .p_favour {
+        font-size: 36rpx;
+    }
+
+    .un_p_favour {
+        font-size: 26rpx;
+        text-decoration: line-through;
+		margin-left: 16rpx;
+        &.un_p{
+            margin-left: 0;
+        }
+    }
+
+    .p_trade {
+        font-size: 20rpx;
+        margin-left: 20rpx;
+    }
 }
 
 .span_conten {
-  width: calc(283rpx - 46rpx);
-  height: 100%;
-  background: #ffcabb;
-  position: relative;
-  font-size: 34rpx;
-  font-family: "SourceHanSansCN-Medium";
-  color: #682918;
+    width: calc(283rpx - 46rpx);
+    height: 100%;
+    background: #ffcabb;
+    position: relative;
+    font-size: 34rpx;
+    font-family: "SourceHanSansCN-Medium";
+    color: #682918;
 }
 
 .triangle {
-  width: 0px;
-  height: 0px;
-  border-top: 92rpx solid rgba(0, 0, 0, 0);
-  border-right: 92rpx solid rgba(0, 0, 0, 0);
-  border-bottom: 92rpx solid #ffcabb;
-  border-left: 92rpx solid rgba(0, 0, 0, 0);
-  transform: translate(-46rpx, -92rpx);
-  position: absolute;
-  top: 0;
-  left: 0;
+    width: 0px;
+    height: 0px;
+    border-top: 92rpx solid rgba(0, 0, 0, 0);
+    border-right: 92rpx solid rgba(0, 0, 0, 0);
+    border-bottom: 92rpx solid #ffcabb;
+    border-left: 92rpx solid rgba(0, 0, 0, 0);
+    transform: translate(-46rpx, -92rpx);
+    position: absolute;
+    top: 0;
+    left: 0;
 }
 
 .samll {
-  font-size: 28rpx;
-  max-width: calc(100% - 360rpx);
-  line-height: 1.3;
-  text-align: justify;
+	.p_favour{
+		font-size: 28rpx;
+	}
 }
 
 // 价格信息栏-end
 
 // 标题信息栏
 .goods_subName {
-  width: 100%;
-  overflow: hidden;
-  font-size: 22rpx;
-  color: #787878;
+    width: 100%;
+    overflow: hidden;
+    font-size: 22rpx;
+    color: #787878;
 }
 
 .title_info {
-  width: 100%;
-  overflow: hidden;
-  background: #ffffff;
-  padding: 20rpx;
-  box-sizing: border-box;
+    width: 100%;
+    overflow: hidden;
+    background: #ffffff;
+    padding: 20rpx;
+    box-sizing: border-box;
 }
 
 .goods_name {
-  width: 100%;
-  overflow: hidden;
-  font-size: 32rpx;
-  color: #1b1b1b;
-  font-family: "SourceHanSansCN-Bold";
-  font-weight: bold;
-  margin-bottom: 20rpx;
+    width: 100%;
+    overflow: hidden;
+    font-size: 32rpx;
+    color: #1b1b1b;
+    font-family: "SourceHanSansCN-Bold";
+    font-weight: bold;
+    margin-bottom: 20rpx;
 }
 
 // 标题信息栏-end
 
 // 产品简介
 .brief {
-  width: 100%;
-  overflow: hidden;
-  background-color: #fff;
+    width: 100%;
+    overflow: hidden;
+    background-color: #fff;
 }
 
 .brief_con {
-  width: 100%;
-  overflow: hidden;
-  padding: 20rpx;
-  box-sizing: border-box;
+    width: 100%;
+    overflow: hidden;
+    padding: 20rpx;
+    box-sizing: border-box;
 }
 
 .brief_title {
-  width: 100%;
-  overflow: hidden;
-  font-size: 26rpx;
-  color: #1b1b1b;
-  padding: 0 20rpx;
-  box-sizing: border-box;
-  border-bottom: 3rpx solid rgba(0, 0, 0, 0.12);
-  height: 74rpx;
+    width: 100%;
+    overflow: hidden;
+    font-size: 26rpx;
+    color: #1b1b1b;
+    padding: 0 20rpx;
+    box-sizing: border-box;
+    border-bottom: 3rpx solid rgba(0, 0, 0, 0.12);
+    height: 74rpx;
 }
 
 // 产品简介-end
 
 // 底部导航组件
 .option {
-  position: fixed;
-  width: 100%;
-  overflow: hidden;
-  left: 0;
-  bottom: 0;
+    position: fixed;
+    width: 100%;
+    overflow: hidden;
+    left: 0;
+    bottom: 0;
 }
 
 // 底部导航组件-end
 
 // 购买或加入购物车弹窗
 .option_box text {
-  color: #2db389;
+    color: #2db389;
 }
 
 .goods_raido {
-  // margin-right: 180rpx;
+    // margin-right: 180rpx;
 }
 
 .close_img {
-  width: 36rpx;
-  height: 36rpx;
+    width: 36rpx;
+    height: 36rpx;
 }
 
 .option_box {
-  font-size: 26rpx;
-  margin-top: 80rpx;
+    font-size: 26rpx;
+    margin-top: 80rpx;
 }
 
 .goods_raido:nth-last-child(1) {
-  margin-right: 0;
+    margin-right: 0;
 }
 
 .num_con {
-  width: 100%;
-  overflow: hidden;
-  padding-bottom: 3rpx;
+    width: 100%;
+    overflow: hidden;
+    padding-bottom: 3rpx;
 }
 
 .num_str {
-  font-size: 14px;
-  color: #989898;
+    font-size: 14px;
+    color: #989898;
 }
 
 .goods_option {
-  width: 100%;
-  overflow: hidden;
-  padding-top: 50rpx;
+    width: 100%;
+    overflow: hidden;
+    padding-top: 50rpx;
 }
 
 .close_con {
-  width: 100%;
-  overflow: hidden;
-  margin-bottom: 35rpx;
+    width: 100%;
+    overflow: hidden;
+    margin-bottom: 35rpx;
 }
 
 .raido_text {
-  font-size: 26rpx;
-  color: #545454;
-  margin-left: 18rpx;
+    font-size: 26rpx;
+    color: #545454;
+    margin-left: 18rpx;
 }
 
 .goods_con {
-  width: calc(100% - 202rpx - 30rpx);
-  overflow: hidden;
+    width: calc(100% - 202rpx - 30rpx);
+    overflow: hidden;
 }
 
 .goods_img {
-  width: 202rpx;
-  height: 187rpx;
-  margin-right: 30rpx;
-  border-radius: 12rpx;
+    width: 202rpx;
+    height: 187rpx;
+    margin-right: 30rpx;
+    border-radius: 12rpx;
 }
 
 .confim {
-  width: 100%;
-  height: 80rpx;
-  border-radius: 40rpx;
-  background: #2db389;
-  color: #fff;
-  font-size: 26rpx;
-  margin-top: 44rpx;
+    width: 100%;
+    height: 80rpx;
+    border-radius: 40rpx;
+    background: #2db389;
+    color: #fff;
+    font-size: 26rpx;
+    margin-top: 44rpx;
 }
 
 .shopping {
-  width: 100%;
-  overflow: hidden;
-  padding: 20rpx;
-  box-sizing: border-box;
-  border-radius: 30rpx 30rpx 0 0;
-  background: #fff;
+    width: 100%;
+    overflow: hidden;
+    padding: 20rpx;
+    box-sizing: border-box;
+    border-radius: 30rpx 30rpx 0 0;
+    background: #fff;
 }
 
 .goods_info {
-  width: 100%;
-  overflow: hidden;
-  align-items: inherit;
-  padding-bottom: 48rpx;
-  border-bottom: 3rpx solid rgba(0, 0, 0, 0.12);
+    width: 100%;
+    overflow: hidden;
+    align-items: inherit;
+    padding-bottom: 48rpx;
+    border-bottom: 3rpx solid rgba(0, 0, 0, 0.12);
 }
 
 .shop_names {
-  width: 100%;
-  overflow: hidden;
-  font-family: "SourceHanSansCN-Bold";
-  font-weight: bold;
-  color: #1b1b1b;
-  font-size: 32rpx;
+    width: 100%;
+    overflow: hidden;
+    font-family: "SourceHanSansCN-Bold";
+    font-weight: bold;
+    color: #1b1b1b;
+    font-size: 32rpx;
 }
 
 .goods_msg {
-  width: 100%;
-  overflow: hidden;
-  font-size: 28rpx;
-  color: #18bb88;
-  font-family: "SourceHanSansCN-Medium";
-  font-weight: 500;
+    width: 100%;
+    overflow: hidden;
+    font-size: 28rpx;
+    color: #18bb88;
+    font-family: "SourceHanSansCN-Medium";
+    font-weight: 500;
 }
 
 .raido_img {
-  width: 39rpx;
-  height: 35rpx;
-  background: url(~@/static/img/weixuanzhong.png);
-  background-repeat: no-repeat;
-  background-size: 35rpx 35rpx;
-  background-position: center center;
+    width: 39rpx;
+    height: 35rpx;
+    background: url(~@/static/img/weixuanzhong.png);
+    background-repeat: no-repeat;
+    background-size: 35rpx 35rpx;
+    background-position: center center;
 }
 
 .raido_box {
-  background: url(~@/static/img/consent.png);
-  background-repeat: no-repeat;
-  background-size: 39rpx 35rpx;
-  background-position: center center;
+    background: url(~@/static/img/consent.png);
+    background-repeat: no-repeat;
+    background-size: 39rpx 35rpx;
+    background-position: center center;
 }
 
 // 购买或加入购物车弹窗-end
 
-.goods_teac{
-  
-    .product-txt,.product-text {
+.goods_teac {
+
+    .product-txt,
+    .product-text {
         font-size: 22rpx;
         color: #787878;
     }
+
     .product-text {
         margin-left: 16rpx;
     }
-    .red{
+
+    .red {
         color: #FA2E18;
     }
-    .fenxiang{
+
+    .fenxiang {
         font-size: 22rpx;
-        background: rgba(250,46,24, 0.08);
+        background: rgba(250, 46, 24, 0.08);
         display: inline-block;
         border-radius: 6rpx;
         padding: 0 16rpx;

+ 11 - 5
src/pages/product/productRetail.vue

@@ -8,13 +8,17 @@
                 <view class="content-view">
                     <view :class="['product-title', 'ellipsis2']">{{ i.goods_name }}</view>
                     <view class="product-price">
-                        <text class="product-price-favour" v-if="type==6">{{(i.cost_price)}}</text>
-                        <text class="product-price-original">{{ (i.price) }}</text>
-                        <!-- <text class="product-tip">{{i.tip}}</text> -->
+                        <text class="product-price-favour" v-if="type==6">{{i.cost_price}}</text>
+                        <text class="product-price-original" v-if="type==4">{{ $h.Sub(i.price,i.consume) }}</text>
+                        <text class="product-price-original" v-else>{{ i.price }}</text>
                         <text class="product-text" v-if="['3','4'].includes(type)">赠<text class="corFE2C15">{{ i.give_cha_bao }}</text>茶宝</text>
                     </view>
+                    <view class="product-txt" v-if="type == 4">
+                        <text class="product-price-favour">{{i.price}}</text>
+                        <text class="product-text">消费金抵</text>
+                        <span class="corFE2C15">¥{{ Number(i.consume) }}</span>
+                    </view>
                     <view class="product-txt" v-if="type == 1">赠送{{ i.give_integral + "批发券" }}</view>
-                    <!-- <view class="product-txt" v-if="type != 6">赠送{{ i.give_integral ? i.give_integral + "批发券" : i.give_cha_bao + "茶宝" }}</view> -->
                     <view class="product-txt" v-if="type == 6">每<text class="green">{{i.interval_time}}</text> 分钟降价 <text class="green">{{i.drop_range * 100}}%</text> </view>
                     <view class="product-txt" v-if="['3','4'].includes(type)">限时赠送<text class="corFE2C15">{{ i.teac }}</text>TeaC</view>
                     <view class="product-txt fenxiang" v-if="['3','4'].includes(type)">
@@ -125,9 +129,11 @@ export default {
 page {
     background: #F4F4F4;
 }
-.container{
+
+.container {
     padding: 30rpx 0;
 }
+
 // 页面配置-end
 
 // 商品列表

BIN
src/static/my/dizhi.png


BIN
src/static/my/h_n.png