qianxinyu пре 3 месеци
родитељ
комит
1fcc94ea6e
7 измењених фајлова са 506 додато и 29 уклоњено
  1. 12 0
      pages.json
  2. 6 1
      pages/index/index.vue
  3. 316 0
      pages/orders/detail.vue
  4. 33 26
      pages/orders/index.vue
  5. 5 1
      pages/product/index.vue
  6. 133 0
      pages/user/bind.vue
  7. 1 1
      pages/user/index.vue

+ 12 - 0
pages.json

@@ -191,6 +191,18 @@
       "style": {
         "navigationBarTitleText": "添加客服"
       }
+    },
+    {
+      "path": "pages/user/bind",
+      "style": {
+        "navigationBarTitleText": "企微绑定"
+      }
+    },
+    {
+      "path": "pages/orders/detail",
+      "style": {
+        "navigationBarTitleText": "订单详情"
+      }
     }
   ],
   "globalStyle": {

+ 6 - 1
pages/index/index.vue

@@ -159,7 +159,12 @@ export default {
     this.$http.request("/api/product/get_type").then((re) => {
       if (re.code === "success") {
         // re.data.unshift();
-        this.tabs = this.tabs.concat(re.data || []);
+        this.tabs = [
+          {
+            id: 0,
+            name: "全部",
+          },
+        ].concat(re.data || []);
       }
     });
   },

+ 316 - 0
pages/orders/detail.vue

@@ -0,0 +1,316 @@
+<template>
+  <view>
+    <view class="addr_item">
+      <view class="contact_user" style="display: flex; justify-content: space-between; width: 100%">
+        <view style="display: flex">
+          <text class="contact_name">{{ order_datail.order_addr?.contact_name }}</text>
+          <text class="contact_phone">{{ order_datail.order_addr?.contact_phone }}</text>
+        </view>
+        <view class="contact_shop text-ellipsis" style="width: 250rpx; text-align: end">
+          <text v-if="order_datail.order_addr?.shop_type">({{ $CONSTANTS.SHOP_TYPES[order_datail.order_addr?.shop_type] }})&nbsp;</text>
+          {{ order_datail.order_addr?.contact_shop }}
+        </view>
+      </view>
+      <view class="contact_addr"
+        >{{ order_datail.order_addr?.contact_area }} {{ order_datail.order_addr?.contact_school }} {{ order_datail.order_addr?.contact_grade }} {{ order_datail.order_addr?.contact_class }}</view
+      >
+    </view>
+    <view class="car_list">
+      <view class="business_name"> {{ order_datail?.business_name }}</view>
+
+      <view class="car_item" v-for="(item, index) in order_datail.order_items" :key="index" @click="_navToProduct(item.product_id)">
+        <view class="box_left">
+          <image class="car_image" :src="item.product_thumb" mode=""></image>
+        </view>
+        <view class="box_center">
+          <view class="car_name">{{ item.product_name }}</view>
+          <view class="car_spec">{{ item.product_spec }}</view>
+          <view v-if="item.promo_title" class="promo_title">{{ item.promo_title }}</view>
+          <view class="car_price">
+            <text class="price">¥{{ item.pay_total }}</text>
+          </view>
+        </view>
+        <view class="box_right">
+          <view class="buy_num_box">
+            <view class="buy_num">共{{ item.buy_num }}件</view>
+          </view>
+        </view>
+      </view>
+    </view>
+
+    <view class="price_content">
+      <view class="price_content_item">
+        <view>订单编号</view>
+        <view style="display: flex; align-items: center">
+          <view>{{ order_datail?.order_code }}</view
+          >&nbsp;
+          <view v-if="order_datail?.order_code" class="copy_btn" @click="_copyorderCode(order_datail?.order_code)">复制</view>
+        </view>
+      </view>
+      <view class="price_content_item">
+        <view>下单时间</view>
+        <view>{{ order_datail?.insert_time }}</view>
+      </view>
+      <view class="price_content_title"></view>
+      <view class="price_content_item">
+        <view>订单总价</view>
+        <view>¥{{ order_datail?.price_total }}</view>
+      </view>
+      <view class="price_content_item">
+        <view>优惠价格</view>
+        <view>¥-{{ order_datail?.coupon_total }}</view>
+      </view>
+      <view class="price_content_item">
+        <view>订单金额</view>
+        <view class="price">¥{{ order_datail?.pay_total }}</view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      order_datail: {},
+    };
+  },
+  onLoad(param) {
+    this._getOrderDetail(param.order_id); // 获取并打印订单详情
+  },
+  methods: {
+    _getOrderDetail(orderId) {
+      this.$http
+        .request("api/orders/get_detail", { id: orderId })
+        .then((response) => {
+          if (response.code == "success") {
+            this.order_datail = response.data; // 打印订单详情
+          }
+        })
+        .catch((error) => {
+          uni.showToast({
+            title: "获取订单详情失败",
+            icon: "error",
+            duration: 2000,
+          });
+        });
+    },
+    _navToProduct(id) {
+      if (id) {
+        uni.navigateTo({
+          url: "/pages/product/index?product_id=" + id,
+        });
+      }
+    },
+    _copyorderCode(info) {
+      // #ifndef H5
+      //uni.setClipboardData方法就是讲内容复制到粘贴板
+      uni.setClipboardData({
+        data: info, //要被复制的内容
+        success: () => {
+          //复制成功的回调函数
+          uni.showToast({
+            //提示
+            title: "复制成功",
+          });
+        },
+      });
+      // #endif
+
+      // #ifdef H5
+      let textarea = document.createElement("textarea");
+      textarea.value = info;
+      textarea.readOnly = "readOnly";
+      document.body.appendChild(textarea);
+      textarea.select(); // 选中文本内容
+      textarea.setSelectionRange(0, info.length);
+      uni.showToast({
+        //提示
+        title: "复制成功",
+      });
+      result = document.execCommand("copy");
+      textarea.remove();
+      // #endif
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.addr_item {
+  font-size: 24rpx;
+  overflow: hidden;
+  line-height: 40rpx;
+  padding: 20rpx 35rpx;
+  border-radius: 15rpx;
+  padding-bottom: 0rpx;
+  margin-bottom: 10rpx;
+  background-color: #ffffff;
+  .contact_user {
+    font-size: 24rpx;
+    line-height: 50rpx;
+    .contact_name {
+      font-size: 26rpx;
+      font-weight: bold;
+      margin-right: 16rpx;
+    }
+    .contact_shop {
+      float: right;
+    }
+  }
+  .contact_addr {
+    font-size: 24rpx;
+    line-height: 30rpx;
+    padding: 10rpx 5rpx;
+  }
+}
+
+.car_list {
+  display: block;
+  overflow: hidden;
+  margin: 0rpx auto;
+  margin-top: 20rpx;
+  background: #ffffff;
+  margin-bottom: 20rpx;
+  .business_name {
+    padding: 8rpx 35rpx;
+    border-bottom: 1px solid #f3f3f3;
+    font-size: 32rpx;
+    z-index: 1;
+    display: flex;
+    align-items: center;
+    .business_icon {
+      width: 48rpx;
+      height: 48rpx;
+      margin-right: 10rpx;
+    }
+  }
+  .car_item {
+    height: 170rpx;
+    display: block;
+    overflow: hidden;
+    margin: 0rpx auto;
+    padding: 20rpx 35rpx;
+    border-bottom: 2rpx solid #dddddd;
+
+    .box_left {
+      float: left;
+      width: 140rpx;
+      height: 190rpx;
+      margin-top: 10rpx;
+
+      .car_image {
+        width: 140rpx;
+        height: 140rpx;
+        border-radius: 5rpx;
+      }
+    }
+
+    .box_center {
+      float: left;
+      width: 300rpx;
+      margin-left: 25rpx;
+
+      .car_name {
+        max-height: 70rpx;
+        font-size: 30rpx;
+        line-height: 40rpx;
+        overflow: hidden;
+        white-space: nowrap;
+        /* 不换行 */
+        overflow: hidden;
+        /* 隐藏超出的内容 */
+        text-overflow: ellipsis;
+        /* 用省略号表示被隐藏的部分 */
+      }
+
+      .car_spec {
+        color: #999999;
+        font-size: 24rpx;
+        line-height: 60rpx;
+        max-height: 60rpx;
+        overflow: hidden;
+      }
+
+      .promo_title {
+        max-height: 80rpx;
+        font-size: 20rpx;
+        line-height: 40rpx;
+        overflow: hidden;
+        padding: 0rpx 0rpx;
+        color: #dd524d;
+      }
+
+      .car_price {
+        font-size: 30rpx;
+        line-height: 60rpx;
+
+        .price {
+          color: red;
+        }
+      }
+    }
+
+    .box_right {
+      float: right;
+      width: 185rpx;
+
+      .buy_num_box {
+        float: right;
+        color: #333333;
+        overflow: hidden;
+        font-size: 24rpx;
+        margin-top: 130rpx;
+        text-align: center;
+
+        .buy_num {
+          float: left;
+          width: 100rpx;
+          height: 30rpx;
+          font-size: 24rpx;
+          line-height: 30rpx;
+          padding: 0rpx 0rpx;
+          border-radius: 8rpx;
+        }
+      }
+    }
+  }
+
+  .car_item:last-child {
+    border-bottom: none;
+  }
+}
+
+.price_content {
+  background-color: #fff;
+  bottom: var(--window-bottom);
+  padding: 40rpx 35rpx 20rpx;
+  width: 100%;
+  box-sizing: border-box;
+  .price_content_title {
+    margin-bottom: 20rpx;
+    border-bottom: 1px dashed #f3f3f3;
+  }
+  .price_content_item {
+    margin-bottom: 20rpx;
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    font-size: 24rpx;
+    color: #00000073;
+    .price {
+      color: red;
+    }
+  }
+  .copy_btn {
+    border-radius: 20rpx;
+    background-color: #f3f3f3;
+    font-size: 24rpx;
+    width: 100rpx;
+    height: 45rpx;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+</style>

+ 33 - 26
pages/orders/index.vue

@@ -9,39 +9,41 @@
     <view class="to_bottom" v-if="!orderList.length"> -----还没有订单-----</view>
     <view class="order_list">
       <view class="order_item" v-for="(item, index) in orderList" :key="index">
-        <view class="order_title">
-          <view class="business_name">{{ item.business_name }}</view>
-          <!-- <view class="order_status">{{ item.state }}</view> -->
-        </view>
-        <view class="product_list" :class="item.contents_class ? 'active' : ''">
-          <view class="product_item" v-for="(product_info, k) in item.product_list" :key="k">
-            <image class="product_img" :src="product_info.product_thumb" mode="" @click="navToProduct(product_info.product_id)"></image>
-            <view class="product_info">
-              <view @click="navToProduct(product_info.product_id)" class="product_name"> <text v-if="product_info.is_rebate">【赠】</text> {{ product_info.product_name }} </view>
-              <view @click="navToProduct(product_info.product_id)" class="product_spec">
-                {{ product_info.product_spec }}
+        <view @click.stop="goDetail(item.id)">
+          <view class="order_title">
+            <view class="business_name">{{ item.business_name }}</view>
+            <!-- <view class="order_status">{{ item.state }}</view> -->
+          </view>
+          <view class="product_list" :class="item.contents_class ? 'active' : ''">
+            <view class="product_item" v-for="(product_info, k) in item.product_list" :key="k">
+              <image class="product_img" :src="product_info.product_thumb" mode=""></image>
+              <view class="product_info">
+                <view class="product_name"> <text v-if="product_info.is_rebate">【赠】</text> {{ product_info.product_name }} </view>
+                <view class="product_spec">
+                  {{ product_info.product_spec }}
+                </view>
               </view>
+              <view class="buy_num"> x{{ product_info.buy_num }} </view>
             </view>
-            <view class="buy_num"> x{{ product_info.buy_num }} </view>
           </view>
-        </view>
-        <view class="show_more" v-if="item.product_list.length > 1" @click.stop="changeHeight(index)">
-          <uni-icons :type="item.contents_class ? 'up' : 'down'"></uni-icons>
-        </view>
-        <view class="order_price">
-          <view class="pay_total">¥{{ item.pay_total }}</view>
-        </view>
-        <view class="order_btn" v-if="item.status == 1">
-          <!-- <button class="order_cancel" @click="cancelOrder(index)">取消订单</button> -->
-          <!--					<button class="order_share" @click="toReceipt(item)">我已收货</button>-->
-          <button class="order_share" @click="toPay(item)">去付款</button>
-        </view>
-        <!-- <view class="order_btn" v-if="item.status == 10">
+          <view class="show_more" v-if="item.product_list.length > 1" @click.stop="changeHeight(index)">
+            <uni-icons :type="item.contents_class ? 'up' : 'down'"></uni-icons>
+          </view>
+          <view class="order_price">
+            <view class="pay_total">¥{{ item.pay_total }}</view>
+          </view>
+          <view class="order_btn" v-if="item.status == 1">
+            <!-- <button class="order_cancel" @click="cancelOrder(index)">取消订单</button> -->
+            <!--					<button class="order_share" @click="toReceipt(item)">我已收货</button>-->
+            <button class="order_share" @click="toPay(item)">去付款</button>
+          </view>
+          <!-- <view class="order_btn" v-if="item.status == 10">
           <button class="order_cancel" @click="cancelOrderRegiment(index)">取消拼团</button>
         </view> -->
-        <!-- <view class="order_btn"v-if="item.status == 2">
+          <!-- <view class="order_btn"v-if="item.status == 2">
           <button class="order_share" @click="toCourse(index)">去上课</button>
         </view> -->
+        </view>
       </view>
     </view>
     <view class="to_bottom" v-if="isLast"> -----到底啦-----</view>
@@ -137,6 +139,11 @@ export default {
     });
   },
   methods: {
+    goDetail(id) {
+      uni.navigateTo({
+        url: "/pages/orders/detail?order_id=" + id,
+      });
+    },
     setStatus(status) {
       // 登录提示
       if (!this.$checkAccess.alterLogin()) return;

+ 5 - 1
pages/product/index.vue

@@ -72,7 +72,7 @@
 			</view>
 		</view>
 		<view class="product_description">
-			<rich-text :nodes="productInfo.description"></rich-text>
+			<rich-text style="word-break: break-all; white-space: pre-line;" :nodes="updatedHtmlString(productInfo.description)"></rich-text>
 		</view>
 		<view class="product_poster" v-if="productInfo.poster">
 			<image class="product_image" :src="productInfo.poster" mode="widthFix"></image>
@@ -448,6 +448,10 @@
 			}
 		},
 		methods: {
+			updatedHtmlString(str){
+				if(!str) return
+				return str.replace(/text-wrap-mode:\s*nowrap;/g, 'text-wrap-mode: wrap;');
+			},
 			closePopup() {
 				this.$refs.addFollow.close();
 			},

+ 133 - 0
pages/user/bind.vue

@@ -0,0 +1,133 @@
+<template>
+  <view class="bind">
+    <view class="bind-content">
+      <view v-if="show_btn == 1" class="btn-list">
+        <view @click="_getGift" class="btn">领取玩具</view>
+      </view>
+      <view v-if="show_btn == 2" class="btn-list">
+        <view class="disabled">{{ error_msg }}</view>
+      </view>
+      <view class="tip">
+        <view>领取规则:</view>
+        <view style="margin-top: 10rpx">下单添加客服免费领取玩具,随刊赠送</view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      show_btn: 0,
+      kailin_uid: null,
+      work_userid: null,
+    };
+  },
+  onLoad(param) {
+    if (!this.$checkAccess.alterLogin()) {
+      return;
+    }
+
+    this.kailin_uid = param.kailin_uid;
+    this.work_userid = param.work_userid;
+    if (param.kailin_uid && param.work_userid) {
+      this.$http.request("api/work_bind/user", { work_userid: param.work_userid, kailin_uid: param.kailin_uid }).then((re) => {
+        // 成功渲染数据
+        console.log("api/work_bind/user", re);
+        if (re.code == "success") {
+          this.show_btn = 1;
+        } else {
+          this.show_btn = 2;
+          this.error_msg = re.data.error || "登记失败,请联系客服";
+        }
+      });
+    }
+  },
+  methods: {
+    _getGift() {
+      this.$http.request("api/orders_receive/receive").then((re) => {
+        // 成功渲染数据
+        console.log("api/work_bind/get_gift", re);
+        if (re.code == "success") {
+          console.log("领取成功");
+          uni.showModal({
+            content: "您已成功领取",
+            showCancel: false,
+            confirmText: "查看订单",
+            success: () => {
+              uni.redirectTo({
+                url: "/pages/orders/index",
+              });
+            },
+          });
+        } else {
+          console.log("领取失败");
+          this.show_btn = 2;
+          this.error_msg = re.msg;
+          uni.showModal({
+            content: re.msg,
+            showCancel: false,
+            confirmText: "回到首页",
+            success: () => {
+              uni.switchTab({
+                url: "/pages/index/index",
+              });
+            },
+          });
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.bind {
+  width: 100vw;
+  height: 100vh;
+  position: relative;
+  background-image: url("https://baokan-mp.oss-cn-shenzhen.aliyuncs.com/static/wanju_bgimg.png");
+  background-size: 100% 100%;
+  background-repeat: no-repeat;
+  box-sizing: border-box;
+  .bind-content {
+    position: absolute;
+    bottom: 50rpx;
+    .btn-list {
+      display: flex;
+      flex-direction: column;
+      gap: 30rpx;
+      align-items: center;
+
+      .btn {
+        width: 300rpx;
+        height: 80rpx;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        box-sizing: border-box;
+        background-color: #f46f2a;
+        border-radius: 60rpx;
+        color: #fff;
+        font-weight: bold;
+        font-size: 36rpx;
+      }
+      .disabled {
+        color: #f46f2a;
+        font-size: 36rpx;
+        font-weight: bold;
+      }
+    }
+    .tip {
+      width: 100vw;
+      box-sizing: border-box;
+      padding: 0 80rpx;
+      color: #f46f2a;
+      margin-top: 40rpx;
+      font-size: 30rpx;
+      font-weight: bold;
+    }
+  }
+}
+</style>

+ 1 - 1
pages/user/index.vue

@@ -47,7 +47,7 @@
           <view class="navigator_image_coupon">
             <image class="navigator_image" src="../../static/user_icon/user_coupon_icon.png" mode=""></image>
           </view>
-          <view class="navigator_title">优惠</view>
+          <view class="navigator_title">优惠</view>
         </navigator>
         <navigator class="navigator_item" url="/pages/score/clockin">
           <view class="navigator_image_order">