<template>
  <view>
    <!-- 公共组件-每个页面必须引入 -->

    <view class="contentBox commonPageContentBox order_box">
      <view
        v-show="isShowAddress"
        class="order_top common_radius_box color_shandow goods_box address_box"
        @click="goToAddress"
      >
        <u-icon
          name="map-fill"
          class="themeColor"
          size="23"
          style="display: inline-block; margin-right: 10rpx"
        ></u-icon>
        <view class="normal_box" v-if="addressData.consigneeName">
          <view class="normal_box_top">
            <view class="curriulum_title">{{ addressData.address }} </view>
            <view class="user_info">
              <text class="name"> {{ addressData.consigneeName }} </text>
              <text class="tel"> {{ addressData.consigneePhone }} </text>
            </view>
          </view>
        </view>
        <view class="normal_box" v-else>
          <view class="normal_box_top">
            <view class="curriulum_title">请添加收货地址 </view>
          </view>
        </view>
        <view class="right">
          <image
            src="@/static/icon/icon_right.png"
            class="rightArrow"
            style=""
          ></image>
        </view>
      </view>

      <view class="order_top common_radius_box color_shandow goods_box">
        <view
          class="curriulum_title_box goods_item"
          style="position: relative"
          v-for="(v, i) in goodsDataList"
        >
          <slot name="goodsInfoLabelSlot" :row="v" :rowIndex="i"></slot>
          <slot name="goodsInfoImgSlot" :row="v" :rowIndex="i"></slot>

          <view class="normal_box">
            <view
              class="normal_box_top"
              style="justify-content: space-between; position: relative"
            >
              <view class="curriulum_title">
                <slot name="goodsInfoNameSlot" :row="v" :rowIndex="i"></slot>
              </view>
            </view>
            <view>
              <slot name="goodsInfoPriceSlot" :row="v" :rowIndex="i"></slot>

              <u-number-box
                v-model="orderNumber"
                style="float: right"
                v-if="showNumber"
              >
                <view slot="minus" class="minus">
                  <u-icon name="minus" size="12"></u-icon>
                </view>
                <text
                  slot="input"
                  style="width: auto; text-align: center; border: none"
                  class="input"
                  >{{ orderNumber }}</text
                >
                <view slot="plus" class="plus">
                  <u-icon name="plus" color="#FFFFFF" size="12"></u-icon>
                </view>
              </u-number-box>
              <text v-else style="float: right"> X {{ orderNumber }}</text>
            </view>
          </view>
        </view>
        <view
          class="pay_box"
          style="margin-top: 20rpx"
          v-if="!options.isFudu && !options.isVip"
        >
          <view
            @click="openOrderModal(v)"
            class="curriulum_title_box goods_item pay_item"
            v-for="(v, i) in orderInfoList"
            :key="i"
          >
            <view class="top">
              <view class="left">
                <text> {{ v.text }}</text>
              </view>
              <view class="right" style="display: flex; align-items: center">
                <text
                  style="
                    float: left;
                    text-align: right;
                    color: #b0b0b0;
                    font-size: 24rpx;
                    display: inline-block;
                    width: 200rpx;
                  "
                  :class="remark ? 'hidden1 hasRemark' : 'hidden1'"
                >
                  {{ remark == "" ? v.placeholder : remark }}</text
                >
                <image
                  src="@/static/icon/icon_right.png"
                  class="rightArrow"
                  style=""
                ></image>
              </view>
            </view>
          </view>
        </view>
      </view>

      <view class="order_top common_radius_box color_shandow goods_box pay_box">
        <view class="title">价格明细</view>

        <view
          class="curriulum_title_box goods_item pay_item"
          v-for="(v, i) in priceBreakdownList"
          :key="i"
        >
          <view class="top">
            <view class="left">
              <image
                v-if="v.imgUrl"
                class="pay_item_img"
                :src="v.imgUrl"
                mode="aspectFil"
                :style="v.style"
              >
              </image>
              <u-icon
                v-if="v.icon"
                name="map-fill"
                color="#018F89"
                size="23"
                style="display: inline-block"
              ></u-icon>

              <text v-if="v.type == 6">
                <span
                  style="color: #f94f04; font-weight: bold; margin-right: 2px"
                  >VIP</span
                >
                专享立减</text
              >
              <text v-else> {{ v.text }}</text>
              <template v-if="v.type == 4">
                <text style="color: #aaa; margin-left: 10rpx">
                  (全部积分：{{ initData.user.jf }})</text
                >
              </template>
            </view>
            <view class="right">
              <template v-if="v.type == 1">
                ￥{{ Number(totalPrice).toFixed(2) }}</template
              >
              <template v-if="v.type == 2">
                <text>
                  ￥{{
                    isShowAddress ? freightNum.toFixed(2) : Number(0).toFixed(2)
                  }}</text
                >
              </template>
              <template v-if="v.type == 3">
                <template v-if="!curCoupon.id">
                  <view
                    v-if="couponHistoryList.length > 0"
                    @click="showCouponPup = true"
                    style="display: flex; align-items: center"
                  >
                    <text
                      style="color: #999"
                      v-if="selectcouponList.length == 0"
                      >不可用
                    </text>
                    <text
                      style="
                        color: #ec4729;
                        background-color: #fceeeb;
                        padding: 1rpx 20rpx;
                        border-radius: 10rpx;
                        line-height: 34rpx;
                      "
                      v-else
                      >共 {{ selectcouponList.length }} 张
                    </text>

                    <image
                      src="@/static/icon/icon_right.png"
                      class="rightArrow"
                      style=""
                    ></image>
                  </view>
                  <template v-else>
                    <text style="color: #999">暂无可用优惠券</text>
                  </template>
                </template>
                <template v-else>
                  <text style="color: #fe6035"
                    >- ￥ {{ curCoupon.couponEntity.couponAmount }}</text
                  >
                  <text
                    @click="showCouponPup = true"
                    style="
                      display: inline-block;
                      margin-left: 20rpx;
                      background-color: #fe6035;
                      color: #fff;
                      border-radius: 30rpx;
                      font-size: 26rpx;
                      border: 4rpx #fe6035 solid;
                    "
                    >重新选择</text
                  >
                </template>
              </template>

              <template v-if="v.type == 4">
                <text style="color: #fe6035"> -￥{{ jfNumberShow }}</text>
              </template>
              <template v-if="v.type == 5">
                <text style="color: #fa2d12"
                  >- ￥{{ districtAmount.toFixed(2) }}</text
                >
              </template>
              <template v-if="v.type == 6">
                <text style="color: #fa2d12"
                  >- ￥{{ vipPrice.toFixed(2) }}</text
                >
              </template>
            </view>
          </view>

          <view
            class="bottom jf_box"
            v-if="v.type == 4 && initData.user.jf > 0"
          >
            <view class="jf_box">
              <text class="themeColor" style="font-weight: 600"
                >可用积分({{ jfNumberMax }}分)</text
              >
              <view class="jf_input">
                <u--input
                  type="number"
                  @input="handleChangejf"
                  @clear="jfNumber = 0"
                  :max="jfNumberMax"
                  :min="0"
                  v-model="jfNumber"
                  placeholder="请输入积分"
                  border="surround"
                  clearable
                ></u--input>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view class="order_top common_radius_box color_shandow goods_box pay_box">
        <view class="title">支付方式</view>
        <!-- 商品是安卓环境支付，或者商品列表中没有课程 -->
        <view
          class="curriulum_title_box goods_item pay_item"
          v-for="(v, i) in payList"
        >
          <view :class="isDefaultCurrency && i != 2 ? 'bgGrey top' : 'top'">
            <view class="left">
              <image
                class="pay_item_img"
                :src="v.imgUrl"
                mode="aspectFil"
                :style="v.style"
              >
              </image>
              <template v-if="v.type == 4">
                <text> {{ v.text }}</text>
                <text
                  class="themeColor"
                  style="font-weight: 600; margin-left: 10rpx"
                >
                  (余额：{{
                    initData && initData.user ? initData.user.peanutCoin : 0
                  }})</text
                >
              </template>

              <text v-else> {{ v.text }}</text>
            </view>

            <template v-if="isDefaultCurrency">
              <radio
                v-if="i == 2"
                :value="v.value"
                :color="themeColor"
                :checked="selectPayIndex == i ? true : false"
                @click="radioChange(i)"
                size="10"
              />
            </template>
            <template v-else>
              <radio
                :value="v.value"
                :color="themeColor"
                :checked="selectPayIndex == i ? true : false"
                @click="radioChange(i)"
                size="10"
              />
            </template>
          </view>
        </view>
        <template v-if="selectPayIndex == 2 || $platform == 'ios'">
          <view
            class="goods_detail_list_title bg_box_shandow color_shandow bg_color"
          >
            <view
              class="linlanzhifu"
              style="
                width: 100%;
                overflow: hidden;
                justify-content: space-between;
              "
            >
              <view class="linlanzhifu">
                <u-icon
                  name="error-circle"
                  class="themeColor"
                  size="20"
                  style="display: inline-block; margin-right: 10rpx"
                ></u-icon>
                确保您的天医币足够支付
              </view>

              <text
                class="fdButtonBox aui-text-danger fdButtonBoxRed"
                style="float: right"
                @click="
                  onPageJump('/pages/mine/wallet/recharge/index?source=order')
                "
                >立即充值</text
              >
            </view>

            <view class="other_info" style="margin-top: 12rpx">
              <view class="explain" style="margin-bottom: 10rpx"> 说明 </view>
              <view class="explain"> 1. 1天医币 = 1元人民币 </view>
              <view class="explain">
                2.若有疑问或意见请致电客服
                <span style="font-size: 15px"
                  ><u @click="gotoPhone">022-24142321</u></span
                >
              </view>
              <view class="explain">
                3.非中国大陆用户可以信用卡支付。简单快捷，推荐使用！
                支付时使用的信用卡需要带有Visa或MasterCard的标识。请向邮箱
                <text
                  @click="fnCopy('publisher@tmrjournals.com', '邮箱')"
                  class="aui-text-success themeColor"
                  style="text-decoration: underline"
                >
                  publisher@tmrjournals.com
                </text>
                （点击复制）发送支付请求，内容需包含：拟购买的课程名称、支付金额、APP注册姓名及手机号码，或者加一路健康客服微信（
                <text
                  class="aui-text-success themeColor"
                  @click="fnCopy('yilujiankangkefu', '微信名')"
                  style="text-decoration: underline"
                >
                  yilujiankangkefu </text
                >）（点击复制）联系我们，我们将在24小时内向您的邮箱或者微信发送支付链接，根据提示即可完成信用卡支付，无需兑换外币。
              </view>
            </view>
          </view>
        </template>
      </view>

      <template>
        <common-sticky
          label="title"
          :itemStyle="`width:${
            cateList.length == 2 ? '50' : '33'
          }%;padding-left: 15px; padding-right: 15px; height: 68rpx;`"
          :list="cateList"
          :currentCateIndex="currentCateIndex"
          @handleselectCate="handleselectCate"
        >
        </common-sticky>
      </template>
    </view>
    <view class="goods_nav_box">
      <common-goods-nav
        :iconList="[]"
        :customButton="customButton"
        @submit="goBuyJie"
      >
        <!-- leftSlot -->
        <template slot="leftSlot" slot-scope="slotProps">
          <view class="price_box order_bottom_box">
            <text class="price"
              >合计:

              <text class="total">
                <template v-if="actualPayment > 0">
                  ￥{{ Number(actualPayment).toFixed(2) }}
                </template>
                <text
                  style="margin: 0 4rpx"
                  v-if="actualPayment > 0 && jfNumber > 0"
                >
                  +
                </text>

                <text v-if="jfNumber > 0">{{ jfNumber }} 积分</text>
              </text>
            </text>
          </view>
        </template>
      </common-goods-nav>
      <view
        class="agree_wo"
        style="background-color: #fff"
        v-if="pageType == 'vip'"
      >
        <radio-group class="agree">
          <view v-for="(item, index) in argee" :key="index">
            <radio
              class="agreeRadio"
              :value="item.id"
              :checked="item.id == radioValue"
              color="#7dc1f0"
              @click="radioCheck(index)"
            ></radio>
          </view>
        </radio-group>
        <view
          >* 我已阅读并同意<span class="highlight" @click="showXieyi"
            >《会员服务协议》</span
          ></view
        >
      </view>
    </view>

    <u-popup :show="show" mode="right">
      <common-address
        backState="3000"
        ref="commonAddress"
        @fresh="handleFresh"
        @selectAddress="selectAddress"
      ></common-address
    ></u-popup>
    <u-popup :show="orderModalShow" mode="bottom" :round="20">
      <view class="orderModalShow popup_box">
        <u-icon
          name="close"
          color="#333"
          size="18"
          @click="closeOrderModalShow"
          style="
            display: inline-block;
            position: absolute;
            right: 20rpx;
            top: 20rpx;
          "
        ></u-icon>
        <view v-if="orderModalShowInfo.type == 'remark'">
          <view class="order_top common_radius_box goods_box">
            <view class="curriulum_title_box goods_item">
              <view class="title">订单备注</view>
              <u--textarea
                v-model="content"
                placeholder="选填：给商家留言"
                count
                class="textarea"
              ></u--textarea>
            </view>
          </view>
        </view>
        <view class="goods_nav_box">
          <uni-goods-nav
            :fill="true"
            :options="[]"
            :button-group="customButtonGroup1"
            @click="onHandleClickBuy"
            @buttonClick="onHandleClickBuy"
          />
        </view>
      </view>
    </u-popup>
    <order-coupon
      v-if="showCouponPup"
      :sumMeony="totalPrice"
      :selectcouponList="selectcouponList"
      :curCouponId="curCouponId"
      :list="couponHistoryList"
      ref="orderCoupon"
      @confirmCoupon="confirmCoupon"
      @close="closeCoupon"
    ></order-coupon>
    <u-popup :show="xieyiShow" :round="10" @close="xieyiShow = false">
      <view class="tanchu">
        <view class="dp_title">{{ xieyi.title }}</view>
        <view style="max-height: 1000rpx; overflow-y: scroll">
          <view v-html="xieyi.content"></view>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<script>
 var themeColor='#3ab3ae';
import orderCoupon from "@/components/orderCoupon.vue";
import courseDescription from "@/pages/component/commonComponents/list";
import { setPay, setPayAssign, setWXPay } from "@/config/utils";
import $http from "@/config/requestConfig.js";
const { platform } = uni.getSystemInfoSync();
import { mapState } from "vuex";
export default {
  props: [
    "options",
    "pageType",
    "goodsDataList",
    "showNumber",
    "isHideAddress",
    "priceKey",
    "initData",
    "urlList",
    "isHideJf",
  ],
  components: {
    courseDescription, //课程说明
    orderCoupon, // 优惠券弹出
  },
  watch: {
    isDefaultCurrency: {
      immediate: true,
      handler(newRoute) {
        if (this.isDefaultCurrency) {
          if (platform == "ios") {
            this.selectPayIndex = 0;
          } else {
            this.selectPayIndex = 0;
          }
        } else {
          if (platform == "ios") {
            this.selectPayIndex = 0;
          } else {
            this.selectPayIndex = 0;
          }
        }

        this.payType = this.payList[this.selectPayIndex].type;
        if (this.actualPayment == 0) {
          var that = this;
          this.payList.forEach((e, i) => {
            if (e.type == 4) {
              that.selectPayIndex = i;
              that.payType = 4;
            }
          });
          this.$forceUpdate();
        }
        this.$forceUpdate();
      },
    },
    orderNumber: {
      immediate: true,
      handler(newRoute) {
        if (this.orderNumber >= 1) {
          this.$nextTick(async () => {
            await this.getGoodsList();
            // await this.getVipFei();
            // await this.getDistrictAmount();
            // await this.getActiveCouponList();
          });
        }
        this.$forceUpdate();
      },
    },
  },
  data() {
    return {
      appName: "zmzm",
      come: 1,
      argee: [{ value: false, id: "1" }], // 同意权限
      radioValue: "",
      xieyi: {
        title: "",
        content: "",
      },
      xieyiShow: false,
      vipPrice: 0,
      districtAmount: 0,
      historyOrderInfo: undefined, //上一个订单的参数
      isDefaultCurrency: false,
      isShowAddress: false,
      jfNumber: 0,
      orderNumber: 1,
      totalPrice: 0,
      actualPayment: 0,
      jfNumberShow: "",
      jfNumberMax: 0,
      selectcouponList: [],

      orderModalShowInfo: {},
      orderModalShow: false,
      payType: 1,
      freightNum: 0,
      addressData: {
        address: "",
        consigneeName: "",
        consigneePhone: "",
      },
      selectPayIndex: 1,
      farePrice: 0,
      payList: [],
      priceBreakdownList: [],
      orderInfoList: [
        {
          text: "订单备注",
          placeholder: "点击填写订单备注",
          imgUrl: "",
          type: "remark",
        },
      ],
      number: 1,
      detailInfo: {},
      content: "",
      remark: "",
      iconList: [],
      buyingFlag: false, // 购买进行中flag
      swiperList: [],

      relatedCoursesList: [], //相关课程
      curriculumData: {},
      curriculumInfo: {},
      detailInfo: {},
      themeColor:themeColor,
      fdButtonStyle: {
        width: "120rpx",
        "border-color": themeColor,
        color: themeColor,
        float: "right",
        "margin-right": "20rpx",
        "margin-left": "30rpx",
      },
      modalInfo: {},
      canjump: true, // 是否可以跳转到其他页面
      currentCateIndex: 0,
      show: false,
      playData: {},

      taiHuClassInfo: {},
      searchValue: "",
      teachingList: [
        {
          title: "临床实践",

          type: "02",
          apiUrl: "app/phoneDoctor.do?getTaiHuToShine",
        },
        {
          title: "学习问答",
          type: "03",
          oid: "8a9fb99809e4428888aad6b56a3096a6",
        },
        {
          title: "学习心得",

          type: "01",
        },
        {
          title: "在线作业",

          type: "04",
          oid: "d0f47071c2194e94845fbb373d06f59d",
        },
      ], // 一级分类标题1
      cateList: [], // 一级分类标题1
      twoCateList: [], // 二级分类标题
      dataList: [], // 方剂标题
      defaultAddressList: {},
      allDataList: [], // 方剂标题
      currentStatusIndex: 0, // 当前选中的一级分类

      curTwoCateIndex: 0, // 当前选中的二级分类
      searchList: [], // 搜索结果数组
      showSearchList: false,
      userMes: {}, // 用户信息
      searchDisable: false, // 搜索不可用
      limitShow: false,
      limitTitle: "提示",
      goToInfo: {},
      limitContent: "",
      scrollViewHeight: 0,

      customButton: [
        {
          width: "200rpx",
          text: "立即支付",
          backgroundColor: `linear-gradient(90deg,  ${themeColor} 0%,${themeColor} 100%)`,
          color: "#fff",
        },
      ],
      customButtonGroup1: [
        {
          with: 200,
          text: "确定",
          backgroundColor: `linear-gradient(90deg,  ${themeColor} 0%,${themeColor} 100%)`,
          color: "#fff",
        },
      ],
      haveCourse: false, // 结算队列是否有课程类型的商品
      isAndroid: null, //操作系统
      beizhuShow: false, // 是否显示天医币说明？
      couponHistoryList: [], // 可用优惠券
      showCouponPup: false, // 是否显示优惠券弹窗
      curCoupon: {}, // 选中的优惠券信息
      curCouponId: undefined,
    };
  },

  async mounted() {
    this.curCouponId = undefined;
    var that = this;
    await uni.$on("returnData", function (data) {
      if (data) {
        that.addressData = {
          ...data,
          address: `${data.province}${data.city}${data.county}${data.detailAddress}`,
          consigneeName: data.consigneeName,
          consigneePhone: data.consigneePhone,
        };
        that.$forceUpdate();

        that.getUserAddress();
      } else {
      }
    });

    if (platform == "ios") {
      this.payList = [
        {
          text: "天医币",
          imgUrl: require("@/static/icon/pay_3.png"),
          type: 4,
          value: "2",
        },
      ];
      this.selectPayIndex = 0;
      this.payType = 4;
    } else {
      this.payList = [
        {
          text: "支付宝",
          imgUrl: require("@/static/icon/pay_1.png"),
          type: 2,
          value: "0",
        },
        {
          text: "微信",
          imgUrl: require("@/static/icon/pay_2.png"),
          type: 1,
          value: "1",
        },
        {
          text: "天医币",
          imgUrl: require("@/static/icon/pay_3.png"),
          type: 4,
          value: "2",
        },
      ];
      this.selectPayIndex = 1;
      this.payType = 1;
    }
  },
  computed: {
    ...mapState(["userInfo"]),
  },
  methods: {
    radioCheck(index) {
      this.argee.forEach((item) => {
        item.isCheck = false;
      });
      if (this.radioValue == this.argee[index].id) {
        this.radioValue = null;
      } else {
        this.radioValue = this.argee[index].id;
      }
    },
    //会员协议
    async showXieyi() {
      var data = await this.$commonJS.getAgreement(105);
      if (data.content) {
        data.content = data.content.replace(
          /<h5>/g,
          '<view style="font-weight: bold;font-size: 32rpx;margin-top: 20rpx;margin-bottom: 20rpx;">'
        );
        data.content = data.content.replace(/<\/h5>/g, "</view>");
      }

      this.xieyi = data;
      this.xieyiShow = true;
    },
    async getGoodsList() {
      //获取商品信息
      //   await this.getGoodsDataInfo();
      await this.initPrepareOrder();
      this.$nextTick(async () => {
        if (this.pageType == "vip") {
          await this.getTotalPrice();
        } else {
          await this.getVipFei();
          await this.getDistrictAmount();
          await this.getActiveCouponList();
        }

        var list = [...this.goodsDataList];
        list = list.map((e) => e.goodsType);
        this.haveCourse = list.some((ele) => ele === "05");
        if (this.options.sourceType == "curriculum") {
          this.goToInfo = {
            url: "/pages/course/myCourse",
            type: 2,
          };
        } else {
          this.goToInfo = {
            url: "/pages/bookShop/orderList",
            type: 1,
          };
        }
      });
    },
    async getVipFei() {
      let key = [];
      let dataToString = "";
      this.goodsDataList.forEach((item, index) => {
        key.push({
          productId: item.productId,
          quantity: this.orderNumber,
        });
      });

      await $http
        .request({
          url: "/book/buyOrder/getVipDiscountAmount",
          method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
          data: {
            productList: key,
          },
          header: {
            "Content-Type": "application/json",
          },
        })
        .then(async (res) => {
          if (res.code == 0) {
            console.log("res.code at line 538:", res);
            this.vipPrice = res.discountAmount;
            await this.getTotalPrice();
          }
        });
    },
    async getDistrictAmount() {
      let key = [];
      let dataToString = "";

      this.goodsDataList.forEach((item, index) => {
        key.push({
          productId: item.productId,
          quantity: this.orderNumber,
        });
        //	dataToString = dataToString.concat(item.productId+"="+item.productAmount+"&")
      });
      console.log(key, "this.adressMoRen.areaidpath");

      await $http
        .request({
          // url: "book/buyOrder/calculateTransportPrice/",
          url: "/book/buyOrder/getDistrictAmount",
          // url: "book/buyorder/getTransPrice/" + this.adressMoRen.areaidpath + "?" + dataToString,
          method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
          data: {
            productList: key,
          },
          header: {
            //默认 无 说明：请求头
            "Content-Type": "application/json",
          },
        })
        .then(async (res) => {
          if (res.code == 0) {
            console.log("res.code at line 538111111111111111:", res);
            this.districtAmount = res.districtAmount;
            // console.log('需要的运费', res.result)
            await this.getTotalPrice();
          }
        });
    },
    closeCoupon() {
      this.showCouponPup = false;
    },
    confirmCoupon(data) {
      if (data) {
        this.curCoupon = data;
        this.curCouponId = data.couponEntity.id;
      } else {
        this.curCoupon = {};
        this.curCouponId = undefined;
      }

      this.getTotalPrice();
    },
    // 查询商品可用优惠券
    async getActiveCouponList() {
      var list = [];
      this.goodsDataList.forEach((e) => {
        var str = `${e.productId}:${
          e.activityPrice > 0 ? e.activityPrice : e[this.priceKey]
        }:${this.orderNumber}`;
        list.push(str);
      });

      var idsString = list.join(",");
      this.$http
        .request({
          url: "common/coupon/getCouponListPayment",
          method: "POST",
          data: {
            shopProductInfos: idsString,
          },
          header: {
            "Content-Type": "application/json",
          },
        })

        .then(async (res) => {
          if (res.code != 0) {
            uni.showToast({
              title: res.errMsg,
              icon: "none",
            });
            if (this.isShowAddress) {
              await this.getUserAddress();
            } else {
              await this.getTotalPrice();
            }

            return;
          }
          if (res.code == 0) {
            this.couponHistoryList = res.couponHistoryList;

            this.selectcouponList = this.couponHistoryList.filter(
              (item) => item.canUse != 0
            );
            console.log(
              "this.selectcouponList at line 984:",
              this.selectcouponList
            );
            if (
              this.selectcouponList.filter(
                (item) => item.couponId == this.curCouponId
              ).length == 0
            ) {
              this.curCoupon = {};
              this.curCouponId = undefined;
            }
          } else {
            this.couponHistoryList = [];

            this.selectcouponList = [];
          }

          if (this.selectcouponList.length == 0) {
            this.curCoupon = {};
            this.curCouponId = undefined;
          }

          this.$forceUpdate();
          if (this.isShowAddress) {
            await this.getUserAddress();
          } else {
            await this.getTotalPrice();
          }
        })
        .catch((e) => {
          uni.showToast({
            title: e.errMsg,
            icon: "none",
          });
        });
    },
    handleChangejf(val) {
      var value = val;
      this.$nextTick(() => {
        // 1. 只允许数字字符，并去掉小数点后的部分
        value = value.replace(/[^0-9.]/g, ""); // 删除非数字和小数点字符

        // 2. 如果有小数点，只保留小数点前的部分
        if (value.indexOf(".") !== -1) {
          value = value.split(".")[0]; // 截取小数点前的部分
        }

        // 如果输入为0，强制设置为0并显示为 "0"
        if (val == 0) {
          this.jfNumber = 0;
          this.jfNumberShow = "0";
        } else {
          // 3. 强制转换为正整数
          let numericValue = parseInt(value, 10); // 使用parseInt转换为整数
          if (numericValue < 0 || isNaN(numericValue)) {
            numericValue = 0;
          }

          // 4. 确保最大值限制
          if (numericValue >= this.jfNumberMax) {
            numericValue = this.jfNumberMax;
          }

          // 更新最终的数字值和显示
          this.jfNumber = Math.max(0, numericValue); // 强制为正整数
          this.jfNumberShow = this.jfNumber.toString(); // 显示整数
        }

        // 计算实际支付金额
        var couponAmount = 0;
        if (this.curCouponId && this.curCoupon.couponEntity.id) {
          couponAmount = this.curCoupon.couponEntity.couponAmount;
        }
        this.actualPayment =
          this.totalPrice -
          couponAmount -
          this.jfNumber +
          this.freightNum -
          this.districtAmount -
          this.vipPrice;

        // 如果实际支付金额为0，设置支付方式为默认货币
        if (this.actualPayment == 0) {
          console.log("this.actualPayment at line 1097:", this.actualPayment);
          this.isDefaultCurrency = true;
          var that = this;
          this.payList.forEach((e, i) => {
            if (e.type == 4) {
              that.selectPayIndex = i;
              that.payType = 4;
            }
          });
          this.$forceUpdate();
        } else {
          this.isDefaultCurrency = false;
        }
        this.$forceUpdate();
      });
    },
    onHandleClickBuy() {
      this.orderModalShow = false;
      this.remark = this.content;
    },
    closeOrderModalShow() {
      if (this.orderModalShowInfo.type == "remark") {
        this.content = "";
      }
      this.orderModalShow = false;
    },
    onPageJump(url) {
      console.log(url, "url");
      uni.navigateTo({
        url: url,
      });
    },
    // 获取订单初始话
    async initPrepareOrder() {
      if (this.options.isFudu) {
        this.priceBreakdownList = [
          {
            text: "商品总价",
            imgUrl: "",
            type: 1,
          },
          {
            text: "运费",
            imgUrl: "",
            type: 2,
          },
        ];
      } else {
        this.priceBreakdownList = [
          {
            text: "商品总价",
            imgUrl: "",
            type: 1,
          },
          {
            text: "运费",
            imgUrl: "",
            type: 2,
          },

          {
            text: "优惠券",
            imgUrl: "",
            type: 3,
          },
        ];
      }
      if (
        this.goodsDataList[0].activityPrice &&
        this.goodsDataList[0].activityPrice > 0
      ) {
        this.priceBreakdownList.push({
          text: "活动立减",
          imgUrl: "",
          type: 5,
        });
      }
      if (
        this.goodsDataList[0].isVipPrice &&
        this.goodsDataList[0].vipPrice &&
        this.goodsDataList[0].vipPrice > 0
      ) {
        this.priceBreakdownList.push({
          text: "VIP专享立减",
          imgUrl: "",
          type: 6,
        });
      }

      this.isShowAddress = !this.isHideAddress;
      if (!this.isShowAddress&&this.initData.user.jf>0) {
        this.priceBreakdownList.push({
          text: "积分",
          imgUrl: require("@/static/icon/jifen.png"),
          type: 4,
        });
      }
    },
    // 获取地址列表
    async getUserAddress() {
      var data = {};

      var that = this;

      this.$http
        .request({
          url: `${this.urlList.addressList}?userId=${this.userInfo.id}`,
          method: "POST", // POST、GET、PUT、DELETE，具体说明查看官方文档
          data,
          header: {
            "Content-Type": "application/json",
          },
        })

        .then(async (res) => {
          console.log("res at line 374:", res);
          if (res.code == 0) {
            if (res.list.length > 0) {
              var index = res.list.findIndex((e) => e.isDefault == 1);
              console.log("index at line 37711111111111111111111111:", index);
              if (index >= 0) {
                that.defaultAddressList = {
                  ...res.list[index],

                  address: `${res.list[index].province}${res.list[index].city}${
                    res.list[index].county
                  }${
                    res.list[index].detailAddress
                      ? res.list[index].detailAddress
                      : ""
                  }`,
                };
              } else {
                console.log(that.defaultAddressList, "11111111111111");
                that.defaultAddressList = {
                  ...res.list[0],
                  address: `${res.list[0].province}${res.list[0].city}${
                    res.list[0].county
                  }${
                    res.list[0].detailAddress ? res.list[0].detailAddress : ""
                  }`,
                };
              }
            } else {
              this.defaultAddressList = {};
            }
          }
          if (!this.addressData.id) {
            this.addressData = this.defaultAddressList;
          }
          if (this.defaultAddressList.id) {
            console.log("有默认地址");
            await this.getFreightNum();
          }
          this.$forceUpdate();
        });
    },

    //获取运费
    async getFreightNum() {
      console.log("this.userInfo.id at line 368:", this.userInfo.id);
      var data = {
        products: this.goodsDataList.map((e) => {
          return {
            productId: e.productId,
            quantity: this.orderNumber,
          };
        }),
        regionCode: this.addressData.regionCode,
      };

      var that = this;

      this.$http
        .request({
          url: `${this.urlList.freightNum}`,
          method: "POST",
          data,
          header: {
            "Content-Type": "application/json",
          },
        })

        .then(async (res) => {
          console.log("res at line 37411:", res);
          if (res.code == 0) {
            this.freightNum = res.result;
          }
          await this.getTotalPrice();
          this.$forceUpdate();
        });
    },
    handleFresh() {
      this.show = false;
    },
    async getReturnData() {},
    async getTotalPrice() {
      var s = 0;
      var that = this;
      for (var i = this.goodsDataList.length - 1; i >= 0; i--) {
        s += this.goodsDataList[i][this.priceKey];
      }
      that.totalPrice = s * this.orderNumber;
      console.log("that.totalPrice at line 1226:", that.totalPrice);
      var couponAmount = 0;
      var couponData = this.selectcouponList.filter(
        (e) => e.couponId == that.curCouponId
      );
      if (this.curCoupon.couponId) {
        couponAmount = that.curCoupon.couponEntity.couponAmount;
      } else {
        couponAmount = 0;
      }
      if (!this.isShowAddress) {
        if (that.initData.user && that.initData.user.jf) {
          var totalMoney =
            that.totalPrice - that.districtAmount - that.vipPrice;
          if (this.initData.user.jf >= totalMoney) {
            const integerPart = Math.floor(totalMoney);

            this.jfNumber = integerPart - couponAmount; // 设置 jfNumber
            this.jfNumberMax = integerPart - couponAmount; // 设置 jfNumberMax
          } else {
            if (this.initData.user.jf >= couponAmount) {
              this.jfNumber = this.initData.user.jf - couponAmount;
              this.jfNumberMax = this.initData.user.jf - couponAmount;
            } else {
              this.jfNumber = this.initData.user.jf;
              this.jfNumberMax = this.initData.user.jf;
            }
          }
        } else {
          this.jfNumber = 0;
        }

        if (that.jfNumber == 0 || that.jfNumber == null) {
          that.jfNumberShow = "0.00";
          that.actualPayment = that.totalPrice - couponAmount;
        } else {
          that.jfNumberShow = that.jfNumber.toFixed(2);
          that.actualPayment = that.totalPrice - that.jfNumber - couponAmount;
        }
        that.actualPayment =
          that.actualPayment +
          that.freightNum -
          that.districtAmount -
          that.vipPrice;
      } else {
        that.actualPayment =
          that.totalPrice +
          that.freightNum -
          couponAmount -
          that.districtAmount -
          that.vipPrice;
      }
      if (this.actualPayment == 0 && !this.isShowAddress) {
        this.isDefaultCurrency = true;
      } else {
        this.isDefaultCurrency = false;
      }
      this.$forceUpdate();
    },
    selectAddress(data) {
      this.show = false;
    },
    goToAddress() {
      uni.navigateTo({
        url: "/pages/component/commonComponents/address/index?type=order",
      });
    },
    fnCopy(value, title) {
      this.$commonJS.handleMakingPhoneCalls(value, title);
    },

    gotoPhone() {
      this.$commonJS.handleMakingPhoneCalls("022-24142321");
    },
    openOrderModal(v) {
      this.orderModalShowInfo = v;
      console.log(
        "this.orderModalShowInfo at line 727:",
        this.orderModalShowInfo
      );
      this.orderModalShow = true;
      if (this.orderModalShowInfo.type == "remark") {
        this.content = this.remark;
      }
    },
    async goBuyJie() {
      if (this.pageType == "vip") {
        if (this.radioValue != "1") {
          uni.showToast({
            title: "请勾选 已阅读会员服务协议",
            icon: "none",
          });
          return false;
        }
      }

      if (this.buyingFlag) {
        uni.showToast({
          title: "操作太频繁了，休息下吧",
          icon: "none",
        });
        return;
      }
      this.buyingFlag = true;
      var that = this;
      this.nowClick = false;
      setTimeout(() => {
        this.nowClick = true;
      }, 5000);

      let xiaBiao = [];
      let data = {};

      if (
        this.payType == 4 &&
        this.initData.user.peanutCoin < Number(this.actualPayment)
      ) {
        uni.showToast({
          title: "天医币余额不足",
          icon: "none",
        });
        return;
      }
      if (this.pageType == "fudu") {
        data = {
          jfDeduction: this.jfNumber,
          paymentMethod: this.payType, //支付方式   2支付宝，1微信，3ios内购    4，天医币购买
          orderMoney: this.totalPrice, //订单金额
          realMoney: this.actualPayment, //实收金额
          remark: this.goodsDataList
            .map((e) => e.productId + "," + e.productName)
            .join(","), //productId,商品名
          come: this.come,
        };
      } else if (this.pageType == "vip") {
        data = {
          paymentMethod: this.payType, //1微信2支付宝3苹果支付4虚拟币
          orderMoney: this.totalPrice, //订单金额
          realMoney: this.actualPayment, //实际金额
          shippingMoney: 0, //运费
          jfDeduction: this.jfNumber,
          vipBuyConfigId: this.goodsDataList[0].id,
          come: this.come, //订单来源，0疯子读书1国学众妙之门2医学吴门医述
        };
      } else {
        if (this.options.goods[0].goodsType != "05") {
          if (!this.addressData.id) {
            this.$commonJS.showToast("请选择收货地址");
            return false;
          }
        }

        data = {
          buyType: this.options.typeId, //0- 商品页直接下单  1- 购物车结算
          userId: this.userInfo.id, //下单人ID
          shippingUser: this.addressData
            ? this.addressData.consigneeName
            : "111", //收货人姓名
          userPhone: this.addressData.consigneePhone, //收货人手机号
          jfDeduction: this.jfNumber,
          paymentMethod: this.payType, //支付方式   2支付宝，1微信，3ios内购    4，天医币购买
          orderMoney: this.totalPrice, //订单金额
          realMoney: this.actualPayment, //实收金额
          shippingMoney: this.freightNum, //运费
          remark: this.remark, //备注
          couponId: this.curCouponId ? this.curCoupon.id : null, //优惠券Id
          // isSend: this.isSend,
          couponName:
            this.curCouponId && this.curCoupon.id
              ? this.curCoupon.couponEntity.couponName
              : "", //优惠券名称
          districtMoney: 0, //优惠金额
          vipDiscountAmount: this.vipPrice, //折扣金额
          districtMoney: this.districtAmount, //折扣金额

          productList: this.goodsDataList.map((e) => {
            return {
              productId: e.productId,
              quantity: this.orderNumber,
            };
          }), //订单列表商品
          orderType: "order", //订单类型
          addressId:
            this.options.goods[0].goodsType != "05" ? this.addressData.id : 0, // 地址ID
          appName: this.appName,
          come: this.come,
        };
        var productList = [...data.productList];
        var thisproduct = productList.map((item) => {
          return item.productId + "_" + item.quantity;
        });
        thisproduct = thisproduct.join(",");
      }
      if (
        this.historyOrderInfo &&
        thisproduct == this.historyOrderInfo.product &&
        data.addressId == this.historyOrderInfo.addressId &&
        this.historyOrderInfo.realMoney == data.realMoney
      ) {
        that.canjump = false;
        uni.showModal({
          title: "提示",
          content: "您短时间内有一笔相同金额的订单，是否确定继续下单？",
          cancelText: "点错了",
          confirmText: "继续操作",
          success: function (res) {
            that.canjump = true;
            if (res.confirm) {
              that.buyingFlag = false;
              console.log("用户点击确定", that.buyingFlag);
              that.submitorder(data);
            } else {
              that.buyingFlag = false;
            }
          },
        });
      } else {
        that.submitorder(data);
      }
    },
    //支付操作
    async submitorder(data) {
      uni.showLoading({
        title: "正在请求订单",
      });
      // this.buyingFlag = false
      console.log("进来请求了吗？");
      let that = this;
      var url = "";
      switch (that.pageType) {
        case "fudu":
          url = that.urlList.renewPayment;
          // 常规支付
          break;
        case "vip":
          url = that.urlList.vipPayment;
          // 常规支付
          break;
        default:
          url = that.urlList.buyOrder;
          // 常规支付
          break;
      }
      await $http
        .request({
          url: url,
          method: "POST",
          data,
          header: {
            "Content-Type": "application/json",
          },
        })
        .then(async (res) => {
          console.log("res at line 598系统下单返回结果:", res);
          that.buyingFlag = false;
          if (!that.options.isFudu && !this.options.isVip) {
            var product = data.productList.map((item) => {
              return item.productId + "_" + item.quantity;
            });
            product = product.join(",");
            that.historyOrderInfo = {
              product: product,
              addressId: data.addressId,
              realMoney: data.realMoney,
            };
          }
          if (res.code == 0) {
            if (res.orderSn == null) {
              uni.showToast({
                title: "失败,请重新下单",
                icon: "none",
                image: "../../../static/icon/ic_close.png",
              });
            } else {
              uni.showToast({
                title: "下单成功，即将进行支付",
                icon: "none",
              });
              if (that.payType == 2) {
                // 常规支付
                await setPay(
                  {
                    typePay: "alipay",
                    subject: "order",
                    totalAmount: res.money,
                    type: 2,
                    relevanceoid: res.orderSn,
                    customerId: that.userInfo.id,
                  },
                  (res) => {
                    uni.showLoading({
                      title: "加载中",
                    });
                    console.log(res, "支付支付");
                    if (res.success) {
                      uni.hideLoading();
                      uni.showToast({
                        title: "支付成功",
                      });
                      setTimeout(() => {
                        if (that.canjump) {
                          if (that.goToInfo.type == 1) {
                            uni.switchTab({
                              url: `${that.goToInfo.url}?type=order`,
                            });
                          } else {
                            uni.redirectTo({
                              url: `${that.goToInfo.url}?backType=order`,
                            });
                          }
                        }
                      }, 1000);
                    } else {
                      setTimeout(() => {
                        console.log("延迟调用 失败提示");
                        uni.showToast({
                          title: "支付失败",
                          image: "../../../static/icon/ic_close.png",
                        });
                      }, 0);
                    }
                  }
                );
              } else if (that.payType == 1) {
                // 微信支付
                let data1 = {
                  orderSn: res.orderSn,
                  buyOrderId: null,
                  totalAmount: res.money,
                };
                setWXPay(data1, (res) => {
                  if (res.success) {
                    uni.hideLoading();
                    uni.showToast({
                      title: "支付成功",
                    });
                    setTimeout(() => {
                      if (that.canjump) {
                        if (that.goToInfo.type == 1) {
                          uni.switchTab({
                            url: `${that.goToInfo.url}?type=order`,
                          });
                        } else {
                          uni.redirectTo({
                            url: `${that.goToInfo.url}?backType=order`,
                          });
                        }
                      }
                    }, 1000);
                  } else {
                    uni.hideLoading();
                    console.log(res, "微信支付111111111111111");
                    if (res.data.errMsg.indexOf("User canceled") != -1) {
                      uni.showToast({
                        title: "用户取消支付",
                        icon: "none",
                        image: "../../../static/icon/ic_close.png",
                      });
                    } else {
                      uni.showToast({
                        title: "支付失败",
                        icon: "none",
                        image: "../../../static/icon/ic_close.png",
                      });
                    }
                  }
                });
              } else if (that.payType == 4) {
                that.buyingFlag = false;
                // 天医币支付
                uni.hideLoading();
                uni.showToast({
                  title: "购买成功",
                  icon: "success",
                });
                setTimeout(() => {
                  if (that.canjump) {
                    if (that.goToInfo.type == 1) {
                      uni.switchTab({
                        url: `${that.goToInfo.url}?type=order`,
                      });
                    } else {
                      uni.redirectTo({
                        url: `${that.goToInfo.url}?backType=order`,
                      });
                    }
                  }
                }, 1000);
              }
            }
          }
        })
        .catch((e) => {
          that.buyingFlag = false;
          uni.hideLoading();
        });
    },
    radioChange(index) {
      this.selectPayIndex = index;
      this.payType = this.payList[this.selectPayIndex].type;
      this.$forceUpdate();
    },
    handleValChange(e) {
      console.log("e at line 424:", e);
    },
    buttonClick(e) {
      console.log(e);
      this.options[2].info++;
    },

    hancleModalConfirm() {
      var data = {
        values: {
          customerType: "D",
          token: uni.getStorageSync("token"),
          customerOid: uni.getStorageSync("customerOid"),
          ...this.taiHuClassInfo,
        },
      };
    },
    fnRelearn(oid, days, courseFee) {
      //99和199课程复读一个月60三个月120; 299和399课程复读一个月80三个月180
      //499和599课程复读一个月90三个月220; 699和799课程复读一个月100三个月248
      var feeAs = [
        [60, 120],
        [80, 180],
        [90, 220],
        [100, 248],
      ];
      var fee = 0;
      if (courseFee < 206) {
        fee = feeAs[0][days == 30 ? 0 : 1];
      } else if (courseFee < 406) {
        fee = feeAs[1][days == 30 ? 0 : 1];
      } else if (courseFee < 606) {
        fee = feeAs[2][days == 30 ? 0 : 1];
      } else {
        fee = feeAs[3][days == 30 ? 0 : 1];
      }
      this.modalInfo = {
        title: "提示信息",
        content:
          "用户您好，该课程已到期，通过支付" +
          fee +
          "元，本门课程可获得" +
          days +
          "天延期学习时间，点击确认即完成自动扣费，感谢配合！",
      };

      this.taiHuClassInfo = {
        taiHuClassOid: oid,
        days: days,
        fee: fee,
      };
      this.show = true;
    },
    async getCourseDescriptionData() {
      var data = {};
      var that = this;
      console.log(this.$store.state, "11111111111");
      this.$http
        .post(this.urlList.list, {
          customerType: "D",
          token: uni.getStorageSync("token"),
          customerOid: uni.getStorageSync("customerOid"),
          oid: this.options.oid,
        })
        .then(async (res) => {
          that.curriculumData = res.obj;

          if (
            that.curriculumData.productImageList == null ||
            that.curriculumData.productImageList == ""
          ) {
            this.swiperList.push(that.curriculumData.explainsImg);
          } else {
            that.swiperList = that.curriculumData.productImageList.split(",");
          }

          that.dataList = res.obj.correlatedList;
          await that.getDetailInfo();
        });
    },
    getPriceData() {
      var that = this;
      setTimeout(() => {
        that.$nextTick(() => {
          that.$refs.priceDetail.getTotalPrice();
        });
      }, 100);
    },
    // 检查是有权限使用搜索功能
    checkDisable() {
      console.log("点击了");
    },
    // 获取用户详情
    getUserInfo() {
      // 用户详情
      if (this.userInfo.id != undefined) {
        this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
          this.userMes = res.user;
          this.getCateList();
          console.log(this.userMes, "呼呼");
        });
      }
    },

    async handleselectCate(item, index) {
      this.dataList = [];
      var data = [];
      console.log(item, index, 99999);
      var that = this;
      this.$http
        .post(this.urlList.curriculumInfo, {
          customerType: "D",
          token: uni.getStorageSync("token"),
          customerOid: uni.getStorageSync("customerOid"),
          oid: item.coid,
        })
        .then(async (res) => {
          that.curriculumInfo = res.obj;
          that.dataList = res.obj.courseList;
        });
      this.searchValue = "";
      this.searchList = [];
      this.showSearchList = false;
      return data;
    },
    async getDetailInfo() {
      var that = this;
      this.detailInfo = {
        content:
          "<img src='http://oss.taihumed.com/other/null_20210528102528870.jpg' ></img> <img src='http://101.201.146.165:8088/curriculum/detailImg/curriculum_20170420143333621.png'  ></img><p><p>没有中医基础想学中医难不难？中医学者治疗出现瓶颈怎么办？中西医究竟有什么不同呢？吴雄志教授将以全新的视角，完美整合中药学和西医学知识，让你领略当代中医生理学魅力。</p><p><br/><p></p><p><br/></p><p>【思考题】</p><p>1、简述中医的发展这些年出现了哪些变化？</p><p>2、简述中西医学科的异同？</p>",
      };

      this.searchValue = "";
      this.searchList = [];
      this.showSearchList = false;

      return data;
    },
    async setOneCateIndex(item, index) {
      this.allDataList = [];
      console.log(index, 99999);
      var that = this;
      this.currentStatusIndex = index;
      this.searchValue = "";
      this.searchList = [];
      this.showSearchList = false;
      this.$nextTick(async () => {
        await that.getCourseDescriptionData();

        this.$forceUpdate();
      });
    },

    transformData(inputData) {
      const result = {};
      inputData.forEach((item) => {
        const { letter } = item;
        if (!result[letter]) {
          result[letter] = [];
        }
        result[letter].push(item);
      });
      return result;
    },
    getCateList(id) {
      id ? "" : (id = 0);
      this.twoCateList = [];
      this.curTwoCateIndex = 0;
    },
  },
  onBackPress() {
    // #ifdef APP-PLUS
    plus.key.hideSoftKeybord();
    // #endif
  },
};
</script>

<style lang="scss" scoped>
@import "@/style/mixin.scss";

.order_box {
  padding: 20rpx;

  .order_top {
    background-color: #fff;
    margin-bottom: 20rpx;
  }

  .goods_item {
    //
    width: 100%;
    overflow: hidden;

    .textarea {
      margin-top: 20rpx;
      background-color: #fffdfd;
    }

    .normal_box {
      width: calc(100% - 160rpx);
      height: auto;
      float: right;

      // overflow: hidden;
      .normal_box_top {
        width: 100%;
        display: flex;

        height: 100rpx;
        // margin-bottom: 40rpx;
      }
    }
  }
}

.u-grid-list {
  // height: 40rpx;
}

.flexbox {
  display: flex;
}

.dataList {
  height: 100%;
}

.titleList2 {
  height: calc(100% - 150rpx);
}

.priceDetail {
  height: calc(100% - 180rpx) !important;
  padding: 0rpx 0;
  box-sizing: border-box;
}

.componentPage {
  height: calc(100% - 90rpx) !important;
}

.dateReminder {
  width: 100%;
  font-size: 24rpx;
  text-align: right;
  line-height: 40rpx;
}

.fdButtonBox {
  border: 1rpx solid $themeColor;
  background-color: $themeColor;
  color: #fff;
  // width: 100%;
  float: right;
  padding: 4rpx 14rpx;
  font-size: 24rpx;
  font-weight: 500;
  line-height: 30rpx;
  border-radius: 10rpx;
  box-sizing: border-box;

  // margin-top: 20rpx;
  // display: flex;
  // align-items: center;
}

.commonDetailPage {
  font-size: 28rpx;
  padding-bottom: 150rpx !important;
}

.goods_box {
  background-color: #fff;
  // margin-top: 20rpx;
  // padding: 40rpx 30rpx;
  box-sizing: border-box;
  width: 100%;

  .title {
    color: #333;
    font-weight: 600;
    margin-bottom: 20rpx;
  }

  .curriulum_title_box {
    width: calc(100%) !important;
    padding-bottom: 20rpx;
    background-color: #fff;

    .curriulum_title {
      // width: calc(100% - 80rpx);
      width: calc(100%);
      font-weight: 500;
      font-size: 30rpx;
      // line-height: 40rpx;
      //     display: flex;
      // align-items: center;
      margin-top: 10rpx;
      float: left;
      margin-bottom: 0rpx;
      color: #333;
      // padding: 20rpx;
      box-sizing: border-box;
    }
  }
}

.dataList {
  background-color: #fff !important;
  padding: 0 30rpx 40rpx !important;
  box-sizing: border-box;
}

::v-deep.titleItem {
  // width: calc(100% - 120rpx) !important;
}

::v-deep.scroll-view-item:nth-child(2n-1) {
  background-color: transparent !important;
}

.dataList {
  height: auto !important;
}

.related_courses_box {
  background-color: #fff;

  .small_class_teaching_content {
    padding: 10rpx 20rpx;
    box-sizing: border-box;
  }
}

.related_courses_name {
  display: inline-block;
  width: calc(100% - 150rpx) !important;

  .aui-text-danger {
    display: inline-block;
    float: right;
  }
}

.original_price {
  font-size: 28rpx !important;
  font-weight: 500;
  color: #999 !important;
  white-space: nowrap;
  text-decoration: line-through;
  float: left;
  margin-top: 6rpx;
}

.price {
  width: auto;
  font-size: 30rpx;
  font-weight: 600;
  float: right;
  margin-right: 10rpx;
  color: #333;
  // font-family: PangMenZhengDaoBiaoTiTiMianFeiBan;
}

.price_box {
  width: auto;
  overflow: hidden;
  margin-top: 10rpx;
}

.commonTags {
  margin-right: 20rpx;
  margin-top: -5rpx !important;
}

.sales_number {
  text-decoration: none;
  color: #b0b0b0;
  font-weight: 500;
}

// .common_curriculum_list{

// }
::v-deep.common_curriculum_list {
  margin-top: 20rpx;
  padding: 20rpx 20rpx 20rpx;

  .content_item {
    width: 100% !important;
    margin-bottom: 0 !important;
    padding: 15rpx 0 0rpx;
    border-top: 1rpx solid #f1f0f0;
    // height: 160rpx;

    .book_image {
      width: 60rpx !important;
      height: 60rpx !important;
      float: left !important;
      background-color: #f5f5f5;
    }

    .common_curriculum_item {
      width: calc(100% - 88rpx);
      float: right;
      display: block !important;

      // overflow: hidden;

      .related_courses_name {
        width: 100% !important;
      }
    }
  }

  .content_item:nth-child(1) {
    border-top: none !important;
  }
}

::v-deep.common_section {
  padding: 0 !important;
  padding-bottom: 20rpx !important;
}

.goods_detail_list_title {
  display: block;
  padding-top: 20rpx;
  padding-bottom: 40rpx;

  .linlanzhifu {
    display: flex;
    align-items: center;
  }

  .other_info {
    font-size: 28rpx;
    // color: #aaa;
    color: #5a5a5a;

    .explain {
    }
  }

  .left {
    display: flex;
    align-items: center;
  }

  .right {
    font-size: 24rpx;
    font-weight: 500 !important;
    color: #999;
    font-family: none;
  }

  // justify-content: space-between;
}

.commonPageContentBox {
  height: auto !important;
}

.minus {
  width: 50rpx;
  height: 50rpx;
  border-width: 2rpx;
  border-color: #e6e6e6;
  border-right-color: transparent;

  border-top-left-radius: 10rpx;
  border-bottom-left-radius: 10rpx;
  border-style: solid;
  // border-top-left-radius: 100px;
  // border-top-right-radius: 100px;
  // border-bottom-left-radius: 100px;
  // border-bottom-right-radius: 100px;
  // border-radius:10rpx;
  @include flex;
  justify-content: center;
  align-items: center;
}

.input {
  padding: 0 10px;
  height: 50rpx;
  border: 1rpx solid #e6e6e6;
}

.plus {
  width: 50rpx;
  height: 50rpx;
  border-width: 2rpx;
  border-color: #e6e6e6;
  border-left-color: transparent;
  border-style: solid;
  // background-color: #258feb;

  border-top-right-radius: 10rpx;
  border-bottom-right-radius: 10rpx;
  /* #ifndef APP-NVUE */
  display: flex;
  /* #endif */
  justify-content: center;
  align-items: center;
  color: $themeColor;
}

.order_bottom_box {
  position: absolute;
  right: 20rpx;

  .number {
    font-size: 28rpx;
    margin-right: 15rpx;
    margin-top: 5rpx;
  }

  .price {
    .total {
      font-size: 30rpx;
      color: red;
    }
  }
}

::v-deep.goods_nav_box {
  .left {
    margin-top: -10rpx;
    width: calc(100% - 220rpx);
    height: auto;
    position: relative;
    // overflow: hidden;
  }
}

.explain {
  word-wrap: break-word;
  word-break: normal;
  word-break: break-all; //会断词
  // white-space: nowrap;
}

.order_bottom_box {
  display: flex;
  align-items: center;
}

.pay_box {
  .pay_item {
    border-bottom: 1rpx solid #eeecec;
    padding-top: 20rpx;
    justify-content: space-between;

    .top {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .left {
      line-height: 50rpx;
      font-family: MicrosoftYaHei;
      font-weight: 500;

      color: #242323;

      .pay_item_img {
        width: 50rpx;
        height: 50rpx;
        float: left;
        margin-right: 20rpx;
      }
    }

    .bottom {
      width: calc(100% - 60rpx);
      float: right;
      // background-color: #dcdfe6;
      background-color: #f5f5f5;
      border-radius: 20rpx;
      margin-top: 20rpx;

      .jf_box {
        width: 100%;
        display: flex;
        align-items: center;
        padding: 0 20rpx;
        box-sizing: border-box;
        justify-content: space-between;
        color: #aaa;
      }

      .jf_input {
        width: calc(100% - 320rpx) !important;
        padding: 10rpx 0;
        box-sizing: border-box;
      }
    }
  }

  ::v-deep.pay_item:nth-last-child(1) {
    border-bottom: none !important;
  }
}

.linlanzhifu {
  font-size: 28rpx;
  line-height: 24rpx;
}

.address_box {
  // padding: 20rpx;
  display: flex;
  align-items: center;

  .order_top {
    background-color: #fff;
    // margin-bottom: 20rpx;
  }

  .user_info {
    width: 100%;
    float: left;
    display: flex;
    margin-top: 10rpx;
    align-items: center;

    .name {
      color: #838282;
      margin-right: 10rpx;
    }

    .tel {
      color: #838282;
    }
  }

  .curriulum_title {
    width: auto;
    font-size: 34rpx;
    font-weight: 700;
    float: left;
    margin-right: 10rpx;
    color: #333;
    line-height: 50rpx;
    letter-spacing: 2rpx;
  }

  .normal_box {
    margin-left: 5rpx;
    width: calc(100% - 120rpx);
  }

  .goods_box {
    padding: 20rpx 20rpx;
    display: flex;
    align-items: center;
  }

  .rightArrow {
    margin-left: 40rpx;
    width: 40rpx;
    height: 40rpx;
    // position: absolute;
    // right: 30rpx;
  }
}

.rightArrow {
  width: 40rpx;
  height: 40rpx;
  // position: absolute;
  // right: 30rpx;
}

.orderModalShow {
  width: 100%;
  max-height: 48vh;
  padding-bottom: 120rpx;
}

.popup_box {
  padding: 20rpx;
  box-sizing: border-box;
  .curriulum_title_box {
    .title {
      text-align: center;
      font-size: 34rpx !important;
      padding-top: 15rpx !important;
      margin-bottom: 60rpx !important;
    }
  }
}

.hasRemark {
  color: #333 !important;
  font-size: 40rpx !important;
}

.bgGrey {
  // background-color: #f5f5f5;
}

.minus {
  width: 22px;
  height: 22px;
  border-width: 1px;
  border-color: #e6e6e6;
  border-style: solid;
  border-top-left-radius: 100px;
  border-top-right-radius: 100px;
  border-bottom-left-radius: 100px;
  border-bottom-right-radius: 100px;
  @include flex;
  justify-content: center;
  align-items: center;
}

.input {
  padding: 0 10px;
}

.plus {
  width: 22px;
  height: 22px;
  background-color: #ff0000;
  border-radius: 50%;
  /* #ifndef APP-NVUE */
  display: flex;
  /* #endif */
  justify-content: center;
  align-items: center;
}
.agree_wo {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #aaa;
  line-height: 30rpx;
  font-size: 28rpx;
  padding: 10rpx 10rpx 20rpx 0;
}
.agreeRadio {
  zoom: 0.8;
}
.agree {
  width: auto !important;
}
.highlight {
  color: $uni-color-primary;
}
.tanchu {
  padding: 40rpx 30rpx 40rpx 30rpx;
  position: relative;

  .dp_title {
    font-size: 32rpx;
    margin-bottom: 50rpx;
    color: #555;
    text-align: center;
    font-weight: bold;
  }
}
.themeColor {
  color: $themeColor;
}
</style>
