|
|
@ -1,30 +1,32 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<view :class="['page', { show: isDetail }]"> |
|
|
|
<view :class="['page', { show: isDetail && (form.isDel !== 1 && (auth('订单管理:修改') || (form.orderStatus === 1 && auth('订单管理:续费'))) || auth('订单管理:删除')) }]"> |
|
|
|
<view class="block"> |
|
|
|
<view class="block"> |
|
|
|
<view class="l-title">基本信息</view> |
|
|
|
<view class="l-title">基本信息</view> |
|
|
|
<view class="form-list"> |
|
|
|
<view class="form-list"> |
|
|
|
<view :class="['line req', {err: err === 'customerName'}]"> |
|
|
|
<view :class="['line req', {err: err === 'customerName'}]"> |
|
|
|
<view class="name">客户名称</view> |
|
|
|
<view class="name">客户名称</view> |
|
|
|
<view v-if="orderId" class="val">{{ form.customerName }}</view> |
|
|
|
<view v-if="orderId" class="val">{{ form.customerName }}</view> |
|
|
|
<view v-else :class="['ph', {val: form.customerName}]" @click="customerVisible = true">{{ form.customerName || '请选择客户' }}</view> |
|
|
|
<view v-else class="customer-wrap"> |
|
|
|
|
|
|
|
<view :class="['ph', {val: form.customerName}]" @click="customerVisible = true">{{ form.customerName || '请选择客户' }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="line" v-if="form.customerName"> |
|
|
|
<view class="name">省份</view> |
|
|
|
<view class="name">省份</view> |
|
|
|
<view class="val">{{ form.provinceName }}</view> |
|
|
|
<view class="val">{{ form.provinceName }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line" v-if="form.customerName"> |
|
|
|
<view class="name">城市</view> |
|
|
|
<view class="name">城市</view> |
|
|
|
<view class="val">{{ form.cityName }}</view> |
|
|
|
<view class="val">{{ form.cityName }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line" v-if="form.customerName"> |
|
|
|
<view class="name">联系人</view> |
|
|
|
<view class="name">联系人</view> |
|
|
|
<view class="val">{{ form.orderContact }}</view> |
|
|
|
<view class="val">{{ form.orderContact }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line" v-if="form.customerName"> |
|
|
|
<view class="name">电话</view> |
|
|
|
<view class="name">电话</view> |
|
|
|
<view class="val">{{ form.phone }}</view> |
|
|
|
<view class="val">{{ form.phone }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line" v-if="form.customerName"> |
|
|
|
<view class="name">邮箱</view> |
|
|
|
<view class="name">邮箱</view> |
|
|
|
<view class="val">{{ form.email }}</view> |
|
|
|
<view class="val">{{ form.email }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -43,6 +45,7 @@ |
|
|
|
<view v-if="isDetail" class="val">{{ form.businessManagerName }}</view> |
|
|
|
<view v-if="isDetail" class="val">{{ form.businessManagerName }}</view> |
|
|
|
<uni-data-picker v-else class="picker-input" placeholder="请选择商务经理" popup-title="请选择商务经理" preload :localdata="bms" :map="{text: 'userName', value: 'partnerId'}" v-model="form.businessManagerId" :readonly="form.teamId ? false : true"></uni-data-picker> |
|
|
|
<uni-data-picker v-else class="picker-input" placeholder="请选择商务经理" popup-title="请选择商务经理" preload :localdata="bms" :map="{text: 'userName', value: 'partnerId'}" v-model="form.businessManagerId" :readonly="form.teamId ? false : true"></uni-data-picker> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<template v-if="edited"> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="name">订单编号</view> |
|
|
|
<view class="name">订单编号</view> |
|
|
|
<view class="val">{{ form.orderNumber }}</view> |
|
|
|
<view class="val">{{ form.orderNumber }}</view> |
|
|
@ -55,6 +58,7 @@ |
|
|
|
<view class="name">订单金额(元)</view> |
|
|
|
<view class="name">订单金额(元)</view> |
|
|
|
<view class="val">{{ form.orderAmount }}</view> |
|
|
|
<view class="val">{{ form.orderAmount }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
@ -63,7 +67,8 @@ |
|
|
|
<view class="l-title">{{ c.name }}</view> |
|
|
|
<view class="l-title">{{ c.name }}</view> |
|
|
|
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> |
|
|
|
<uni-icons class="arrow" type="top" size="20" color="#007EFF" @click="toggle(c)"></uni-icons> |
|
|
|
<ul class="pro-list" v-show="!c.shrink"> |
|
|
|
<ul class="pro-list" v-show="!c.shrink"> |
|
|
|
<li v-for="(item, i) in c.list" :key="i" @click.stop="editCourse(c, i)"> |
|
|
|
<!-- <li v-for="(item, i) in c.list" :key="i" @click.stop="editCourse(c, i)"> --> |
|
|
|
|
|
|
|
<li v-for="(item, i) in c.list" :key="i"> |
|
|
|
<view class="name"> |
|
|
|
<view class="name"> |
|
|
|
<view class="left"> |
|
|
|
<view class="left"> |
|
|
|
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
|
|
|
<image class="icon" :src="$util.getIcon(item)" mode="widthFix"></image> |
|
|
@ -73,35 +78,71 @@ |
|
|
|
<!-- 1、查看时不可操作 |
|
|
|
<!-- 1、查看时不可操作 |
|
|
|
2、发货和启用不要同时出现,生效前只会显示发货不发货按钮,生效后只显示禁启用按钮 |
|
|
|
2、发货和启用不要同时出现,生效前只会显示发货不发货按钮,生效后只显示禁启用按钮 |
|
|
|
3、处理中的订单显示发货,不显示禁用 --> |
|
|
|
3、处理中的订单显示发货,不显示禁用 --> |
|
|
|
<button v-if="item.status === 1 || isHandle || !orderId" class="course-btn" type="primary" @click.stop="handleDeliver(n, i)">{{ item.ship ? '取消' : ''}}发货</button> |
|
|
|
<template v-if="!isDetail && (item.ship == 0 || isHandle || !orderId)"> |
|
|
|
<button v-else-if="!isDetail" class="course-btn" type="primary" @click.stop="handleEnable(n, i)">{{ item.isEnable ? '禁用' : '启用'}}</button> |
|
|
|
<button v-if="auth('订单管理:发货')" class="course-btn" type="primary" @click.stop="handleDeliver(n, i)">{{ item.ship ? '取消' : ''}}发货</button> |
|
|
|
<image v-if="!orderId || isRenew" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image> |
|
|
|
</template> |
|
|
|
|
|
|
|
<button v-else-if="!isDetail && auth('订单管理:启用')" class="course-btn" type="primary" @click.stop="handleEnable(n, i)">{{ item.isEnable ? '禁用' : '启用'}}</button> |
|
|
|
|
|
|
|
<button v-if="auth('订单管理:发货') && (item.authority == 0 || item.authority == 3 || item.authority == 4) && (!isDetail || (isDetail && item.shipContent))" class="course-btn mg" type="primary" @click.stop="showShip(item)">发货信息</button> |
|
|
|
|
|
|
|
<image v-if="!orderId || isRenew || isHandle" class="del" src="@/static/image/trash.png" mode="widthFix" @click.stop="delCourse(c, i)"></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="info"> |
|
|
|
<view class="info"> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
|
|
|
|
<view class="label">起始日期</view> |
|
|
|
|
|
|
|
<!-- <view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view> --> |
|
|
|
|
|
|
|
<view v-if="isDetail || isEdit" class="ph">{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}}</view> |
|
|
|
|
|
|
|
<uni-datetime-picker v-else type="date" v-model="item.startTime" :border="false" @change="calcDate(item)"> |
|
|
|
|
|
|
|
<view :class="['ph', {val: item.startTime}]"> |
|
|
|
|
|
|
|
{{ item.endTime ? item.startTime + ' - ' + item.endTime : item.startTime}} |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</uni-datetime-picker> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="line" :class="[ {err: err === 'periodOfUse' + item.dataOrCourseId + item.authority}]"> |
|
|
|
<view class="label">使用期限</view> |
|
|
|
<view class="label">使用期限</view> |
|
|
|
<view class="val">{{ item.startTime + (item.endTime && ' - ' + item.endTime) }}</view> |
|
|
|
<view v-if="isDetail || isEdit" class="ph">{{item.periodOfUse}}{{ units.find(e => e.id === item.options).text }}</view> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
|
|
|
|
<input class="period" type="number" v-model="item.periodOfUse" placeholder="请输入" @input="calcDate(item, !item.authority)" @change="handleErr(item, 'periodOfUse')"> |
|
|
|
|
|
|
|
<view class="val unit" @click="selectUnit(item)"> |
|
|
|
|
|
|
|
<text>{{ units.find(e => e.id === item.options).text }}</text> |
|
|
|
|
|
|
|
<image class="icon" src="@/static/image/arrow-down.png" mode="widthFix"></image> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view :class="['line req', {err: err === 'accountNum' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
|
|
|
<view class="label">数量</view> |
|
|
|
|
|
|
|
<view v-if="item.authority || (!item.authority && isDetail)" class="ph">1</view> |
|
|
|
|
|
|
|
<view v-else class="inline"> |
|
|
|
|
|
|
|
<input type="number" v-model="item.accountNum" placeholder="请输入账号数量" @input="calcFinalPrice(item)" @change="handleErr(item, 'accountNum')"> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">市场价(元)</view> |
|
|
|
<view class="label">{{ item.authority ? '市场价' : '市场单价' }}</view> |
|
|
|
<view class="val">{{ item.marketValue || 0 }}元</view> |
|
|
|
<view class="ph">{{ item.marketValue && item.marketValue + '元' }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">结算价</view> |
|
|
|
<view class="label">结算价</view> |
|
|
|
<view class="val">{{ item.settlementPrice }}元</view> |
|
|
|
<view v-if="isDetail" class="ph">{{ item.settlementPrice }}</view> |
|
|
|
|
|
|
|
<view class="inline" v-else> |
|
|
|
|
|
|
|
<input type="number" v-model="item.settlementPrice" placeholder="请输入" @change="handleErr(item, 'settlementPrice')" @input="updateServiceFee(item)"> |
|
|
|
|
|
|
|
元 |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">折扣率</view> |
|
|
|
<view class="label">折扣率</view> |
|
|
|
<view class="val">{{ item.discountRate }}</view> |
|
|
|
<view class="ph">{{ item.discountRate }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line"> |
|
|
|
<view class="line"> |
|
|
|
<view class="label">平台服务费</view> |
|
|
|
<view class="label">平台服务费</view> |
|
|
|
<view class="val">{{ item.serviceFee }}元</view> |
|
|
|
<view class="ph">{{ item.serviceFee }}元</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view :class="['line req', {err: err === 'finalPrice' + item.dataOrCourseId + item.authority}]"> |
|
|
|
|
|
|
|
<view class="label">成交价</view> |
|
|
|
|
|
|
|
<view v-if="isDetail" class="ph">{{ item.finalPrice }}</view> |
|
|
|
|
|
|
|
<view class="inline" v-else> |
|
|
|
|
|
|
|
<input type="number" v-model="item.finalPrice" placeholder="请输入" @input="calcFinalValue(item)" @change="handleErr(item, 'finalPrice')"> |
|
|
|
|
|
|
|
元 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="line done"> |
|
|
|
|
|
|
|
<view class="val">成交价格</view> |
|
|
|
|
|
|
|
<view class="price">{{ item.finalPrice }}元</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</li> |
|
|
|
</li> |
|
|
@ -110,8 +151,14 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<view class="bottom"> |
|
|
|
<view class="bottom"> |
|
|
|
<view v-if="!orderId" class="add-wrap"> |
|
|
|
<template v-if="!edited && !orderId"> |
|
|
|
<view class="add-btn" @click="toAdd"> |
|
|
|
<view class="next-wrap"> |
|
|
|
|
|
|
|
<view class="lg-btn next" @click="toAdd(0)">下一步</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
|
|
|
|
<view v-if="!orderId || isHandle" class="add-wrap"> |
|
|
|
|
|
|
|
<view class="lg-btn" @click="toAdd"> |
|
|
|
<uni-icons class="icon" type="plus" color="#007FFF"></uni-icons> |
|
|
|
<uni-icons class="icon" type="plus" color="#007FFF"></uni-icons> |
|
|
|
添加产品 |
|
|
|
添加产品 |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -134,15 +181,16 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="product-btns"> |
|
|
|
<view class="product-btns"> |
|
|
|
<view v-if="!isDetail" class="btn" @click="submit">提交({{ courses.length }})</view> |
|
|
|
<view v-if="!isDetail" class="btn" @click="submit">提交({{ courses.length }})</view> |
|
|
|
<view v-if="isHandle || (!orderId && courses.length)" class="btn" @click="batchDeliver">{{ courses.find(e => !e.ship) ? '一键发货' : '取消全部发货' }}</view> |
|
|
|
<view v-if="auth('订单管理:发货') && (isHandle || (!orderId && courses.length))" class="btn" @click="batchDeliver">{{ courses.find(e => !e.ship) ? '一键发货' : '取消全部发货' }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view v-if="isDetail" class="action"> |
|
|
|
<view v-if="isDetail" class="action"> |
|
|
|
<template v-if="form.isDel !== 1"> |
|
|
|
<template v-if="form.isDel !== 1"> |
|
|
|
<template v-if="form.orderStatus === 1"> |
|
|
|
<template v-if="form.orderStatus === 1"> |
|
|
|
<view class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=edit`)"> |
|
|
|
<view class="item" v-if="auth('订单管理:修改')" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=edit`)"> |
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> |
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> |
|
|
|
<view class="text">修改</view> |
|
|
|
<view class="text">修改</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -151,12 +199,12 @@ |
|
|
|
<view class="text">续费</view> |
|
|
|
<view class="text">续费</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<view v-else class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=handle`)"> |
|
|
|
<view v-else-if="auth('订单管理:修改')" class="item" @click="toAction(`../orderDetail/orderDetail?orderId=${orderId}&action=handle`)"> |
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> |
|
|
|
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="30" color="#959595"></uni-icons> |
|
|
|
<view class="text">处理</view> |
|
|
|
<view class="text">处理</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<view class="item" @click="del"> |
|
|
|
<view v-if="auth('订单管理:删除')" class="item" @click="del"> |
|
|
|
<uni-icons class="icon" type="trash-filled" size="30" color="#959595"></uni-icons> |
|
|
|
<uni-icons class="icon" type="trash-filled" size="30" color="#959595"></uni-icons> |
|
|
|
<view class="text">删除</view> |
|
|
|
<view class="text">删除</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -167,17 +215,35 @@ |
|
|
|
<view class="top">请选择客户</view> |
|
|
|
<view class="top">请选择客户</view> |
|
|
|
<uni-icons class="close" type="closeempty" size="20" @click="closeCustomer"></uni-icons> |
|
|
|
<uni-icons class="close" type="closeempty" size="20" @click="closeCustomer"></uni-icons> |
|
|
|
<uni-search-bar class="search" radius="5" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
|
|
|
<uni-search-bar class="search" radius="5" placeholder="请输入客户名称" v-model="keyword" clearButton="auto" cancelButton="none" /> |
|
|
|
|
|
|
|
<view class="create" @click="toClient">找不到客户?马上创建</view> |
|
|
|
<view class="list"> |
|
|
|
<view class="list"> |
|
|
|
<view class="item" v-for="item in customerList" @click="customerChange(item)">{{ item.customerName }}</view> |
|
|
|
<view class="item" v-for="item in customerList" @click="customerChange(item)">{{ item.customerName }}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<uni-popup ref="info" type="bottom" background-color="#fff"> |
|
|
|
|
|
|
|
<view class="ship-info"> |
|
|
|
|
|
|
|
<view v-if="isDetail" class="ship-text" v-html="shipContent" @click="copy"></view> |
|
|
|
|
|
|
|
<template v-else> |
|
|
|
|
|
|
|
<uni-easyinput type="textarea" focus v-model="shipContent" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" maxlength="300"></uni-easyinput> |
|
|
|
|
|
|
|
<view v-if="shipInfo" class="ship-links"> |
|
|
|
|
|
|
|
<view>产品链接</view> |
|
|
|
|
|
|
|
<view class="tooltip" @click="copy">{{ shipInfo }}</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-if="!isDetail" class="ship-btns"> |
|
|
|
|
|
|
|
<button @click.stop="closeShip">取消</button> |
|
|
|
|
|
|
|
<button type="primary" @click.stop="submitShip">确定</button> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</uni-popup> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js' |
|
|
|
import { queryCustomer, queryCustomerDetails } from '@/apis/modules/client.js' |
|
|
|
import { add, update, del, getDetail, renew, ship, miniProgramOrderRecord, bulkShipping } from '@/apis/modules/order.js' |
|
|
|
import { add, update, del, getDetail, renew, ship, miniProgramOrderRecord, bulkShipping, getOrderOtherTime, queryCitySettlementPrice } from '@/apis/modules/order.js' |
|
|
|
import { teamList, getAllTeam } from '@/apis/modules/parner.js' |
|
|
|
import { teamList, getAllTeam, getPartnerTeamRates } from '@/apis/modules/parner.js' |
|
|
|
|
|
|
|
import { productCategoryList } from '@/apis/modules/product.js' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -185,6 +251,7 @@ |
|
|
|
isEdit: 0, // 编辑 |
|
|
|
isEdit: 0, // 编辑 |
|
|
|
isHandle: 0, // 处理 |
|
|
|
isHandle: 0, // 处理 |
|
|
|
isRenew: 0, // 续费 |
|
|
|
isRenew: 0, // 续费 |
|
|
|
|
|
|
|
edited: false, |
|
|
|
orderId: '', |
|
|
|
orderId: '', |
|
|
|
orderTypes: [{ |
|
|
|
orderTypes: [{ |
|
|
|
text: '正式', |
|
|
|
text: '正式', |
|
|
@ -193,6 +260,7 @@ |
|
|
|
text: '试用', |
|
|
|
text: '试用', |
|
|
|
value: 2 |
|
|
|
value: 2 |
|
|
|
}], |
|
|
|
}], |
|
|
|
|
|
|
|
|
|
|
|
form: { |
|
|
|
form: { |
|
|
|
businessManagerId: '', |
|
|
|
businessManagerId: '', |
|
|
|
businessManagerName: '', |
|
|
|
businessManagerName: '', |
|
|
@ -234,6 +302,23 @@ |
|
|
|
customerListAll: [], |
|
|
|
customerListAll: [], |
|
|
|
err: '', |
|
|
|
err: '', |
|
|
|
promises: [], |
|
|
|
promises: [], |
|
|
|
|
|
|
|
orderRepeat:[], |
|
|
|
|
|
|
|
units: [{ |
|
|
|
|
|
|
|
text: '日', |
|
|
|
|
|
|
|
id: 0 |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
text: '月', |
|
|
|
|
|
|
|
id: 1 |
|
|
|
|
|
|
|
}, { |
|
|
|
|
|
|
|
text: '年', |
|
|
|
|
|
|
|
id: 2 |
|
|
|
|
|
|
|
}], |
|
|
|
|
|
|
|
unitText: ['日', '月', '年'], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rate: '', |
|
|
|
|
|
|
|
shipInfo: '', |
|
|
|
|
|
|
|
shipContent: '', |
|
|
|
|
|
|
|
curRow: {} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
@ -253,6 +338,7 @@ |
|
|
|
this.isEdit = action === 'edit' |
|
|
|
this.isEdit = action === 'edit' |
|
|
|
this.isHandle = action === 'handle' |
|
|
|
this.isHandle = action === 'handle' |
|
|
|
this.isRenew = action === 'renew' |
|
|
|
this.isRenew = action === 'renew' |
|
|
|
|
|
|
|
this.edited = uni.getStorageSync('orderEdited') |
|
|
|
const store = uni.getStorageSync('courses') |
|
|
|
const store = uni.getStorageSync('courses') |
|
|
|
this.getTeam(!store) |
|
|
|
this.getTeam(!store) |
|
|
|
if (store) { |
|
|
|
if (store) { |
|
|
@ -263,22 +349,21 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
this.courseList = store |
|
|
|
this.courseList = store |
|
|
|
this.courses = list |
|
|
|
this.courses = list |
|
|
|
this.$nextTick(() => { |
|
|
|
// this.$nextTick(() => { |
|
|
|
uni.pageScrollTo({ |
|
|
|
// uni.pageScrollTo({ |
|
|
|
selector: '#products', |
|
|
|
// selector: '#products', |
|
|
|
}) |
|
|
|
// }) |
|
|
|
}) |
|
|
|
// }) |
|
|
|
try { |
|
|
|
try { |
|
|
|
uni.removeStorageSync('courses') |
|
|
|
uni.removeStorageSync('courses') |
|
|
|
} catch (e) {} |
|
|
|
} catch (e) {} |
|
|
|
this.calcTotal() |
|
|
|
this.calcTotal() |
|
|
|
} else { |
|
|
|
} |
|
|
|
// 如果是客户订单记录页面点的新增,会有客户id,要默认选中该客户 |
|
|
|
// 如果是客户订单记录页面点的新增,会有客户id,要默认选中该客户 |
|
|
|
const { customerId } = options |
|
|
|
const { customerId } = options |
|
|
|
customerId && this.customerChange({ |
|
|
|
customerId && this.customerChange({ |
|
|
|
customerId |
|
|
|
customerId |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 非详情才需要查询客户 |
|
|
|
// 非详情才需要查询客户 |
|
|
|
this.isDetail || this.getCustomer() |
|
|
|
this.isDetail || this.getCustomer() |
|
|
|
// 设置标题 |
|
|
|
// 设置标题 |
|
|
@ -308,14 +393,17 @@ |
|
|
|
const item = this.teams.find(e => e.id == teamId) |
|
|
|
const item = this.teams.find(e => e.id == teamId) |
|
|
|
if (item) this.form.partnerClassificationName = item.partnerClassificationName |
|
|
|
if (item) this.form.partnerClassificationName = item.partnerClassificationName |
|
|
|
if (!this.isDetail) { |
|
|
|
if (!this.isDetail) { |
|
|
|
this.form.businessManagerId = +this.form.businessManagerId |
|
|
|
if (this.form.businessManagerId) this.form.businessManagerId = +this.form.businessManagerId |
|
|
|
this.getBm() |
|
|
|
this.getBm() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
order.orderOther.forEach(e => { |
|
|
|
|
|
|
|
e.settlementPriceUnit = e.settlementPrice |
|
|
|
|
|
|
|
}) |
|
|
|
this.courses = order.orderOther |
|
|
|
this.courses = order.orderOther |
|
|
|
this.handleRenew(0) |
|
|
|
for (let i = 0; i < 5; i++) { |
|
|
|
this.handleRenew(1) |
|
|
|
this.handleRenew(i) |
|
|
|
this.handleRenew(2) |
|
|
|
} |
|
|
|
Promise.all(this.promises).then(_ => { |
|
|
|
Promise.all(this.promises).then(_ => { |
|
|
|
this.handleProduct(this.courses) |
|
|
|
this.handleProduct(this.courses) |
|
|
|
this.calcTotal() |
|
|
|
this.calcTotal() |
|
|
@ -327,47 +415,38 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 转换产品列表 |
|
|
|
// 转换产品列表 |
|
|
|
handleProduct(list) { |
|
|
|
handleProduct(list) { |
|
|
|
const courses = { |
|
|
|
let courses = {} |
|
|
|
practice: { |
|
|
|
// 产品分类 |
|
|
|
|
|
|
|
productCategoryList().then(res => { |
|
|
|
|
|
|
|
res.classificationList.forEach(e => { |
|
|
|
|
|
|
|
courses['list' + this.$util.getOrderType(e.classificationId)] = { |
|
|
|
shrink: false, |
|
|
|
shrink: false, |
|
|
|
name: '实训课程产品', |
|
|
|
name: e.classificationName, |
|
|
|
list: [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
theory: { |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
|
|
|
|
name: '理论课程产品', |
|
|
|
|
|
|
|
list: [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
data: { |
|
|
|
|
|
|
|
shrink: false, |
|
|
|
|
|
|
|
name: '数据产品', |
|
|
|
|
|
|
|
list: [] |
|
|
|
list: [] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
// 3个分类的课程分别push到不同数组(0->理论 1-实训 2 数据产品) |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
list.map(e => { |
|
|
|
e.serviceFee = (e.settlementPrice * 0.1).toFixed(2) |
|
|
|
e.serviceFee = (e.finalPrice * (this.rate / 100)).toFixed(2) // 服务费 != 0 && 才需要算 |
|
|
|
const type = e.productType |
|
|
|
courses['list' + e.authority].list.push(e) |
|
|
|
!type ? |
|
|
|
|
|
|
|
courses.theory.list.push(e) : |
|
|
|
|
|
|
|
type === 1 ? |
|
|
|
|
|
|
|
courses.practice.list.push(e) : |
|
|
|
|
|
|
|
courses.data.list.push(e) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
this.courseList = courses |
|
|
|
this.courseList = courses |
|
|
|
|
|
|
|
}).catch(e => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 处理开始结束时间和订单状态(参考pc,订单模块不是本人开发的,所以也不懂这里逻辑) |
|
|
|
// 处理开始结束时间和订单状态(参考pc,订单模块不是本人开发的,所以也不懂这里逻辑) |
|
|
|
handleRenew(authority) { |
|
|
|
handleRenew(authority) { |
|
|
|
const productId = this.courses.filter(e => e.authority == authority).map(e => e.dataOrCourseId) |
|
|
|
const list = this.courses.filter(e => e.authority == authority) |
|
|
|
|
|
|
|
const productId = list.map(e => e.mallId) |
|
|
|
productId.length && this.promises.push(new Promise((resolve, reject) => { |
|
|
|
productId.length && this.promises.push(new Promise((resolve, reject) => { |
|
|
|
renew({ |
|
|
|
renew({ |
|
|
|
authority, |
|
|
|
authority, |
|
|
|
customerId: this.form.customerId, |
|
|
|
customerId: this.form.customerId, |
|
|
|
productId |
|
|
|
productId, |
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
}).then(({ orderOthers }) => { |
|
|
|
const { courses } = this |
|
|
|
const { courses } = this |
|
|
|
const now = new Date() |
|
|
|
const now = new Date() |
|
|
|
orderOthers.map(e => { |
|
|
|
orderOthers.map(e => { |
|
|
|
|
|
|
|
// e.settlementPriceUnit = e.settlementPrice |
|
|
|
const item = courses.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority) |
|
|
|
const item = courses.find(n => n.dataOrCourseId == e.dataOrCourseId && n.authority == authority && e.authority == authority) |
|
|
|
if (item) { |
|
|
|
if (item) { |
|
|
|
if (this.isRenew) { // 续费 |
|
|
|
if (this.isRenew) { // 续费 |
|
|
@ -454,25 +533,53 @@ |
|
|
|
this.keyword = '' |
|
|
|
this.keyword = '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 客户名称选择回调 |
|
|
|
// 客户名称选择回调 |
|
|
|
customerChange(item) { |
|
|
|
async customerChange(item) { |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
|
// 获取客户详情 |
|
|
|
// 获取客户详情 |
|
|
|
queryCustomerDetails({ |
|
|
|
const { result } = await queryCustomerDetails({ |
|
|
|
customerId: item.customerId |
|
|
|
customerId: item.customerId |
|
|
|
}).then(({ result }) => { |
|
|
|
}) |
|
|
|
this.handleErr('customerName') |
|
|
|
this.handleErr('customerName') |
|
|
|
const e = result.customer |
|
|
|
const e = result.customer |
|
|
|
|
|
|
|
const { provinceId, cityId } = e |
|
|
|
form.customerId = e.customerId |
|
|
|
form.customerId = e.customerId |
|
|
|
form.customerName = e.customerName |
|
|
|
form.customerName = e.customerName |
|
|
|
form.provinceId = e.provinceId |
|
|
|
form.provinceId = provinceId |
|
|
|
form.cityId = e.cityId |
|
|
|
form.cityId = cityId |
|
|
|
form.provinceName = e.provinceName |
|
|
|
form.provinceName = e.provinceName |
|
|
|
form.cityName = e.cityName |
|
|
|
form.cityName = e.cityName |
|
|
|
form.phone = e.phone |
|
|
|
form.phone = e.phone |
|
|
|
form.email = e.email |
|
|
|
form.email = e.email |
|
|
|
form.orderContact = e.name |
|
|
|
form.orderContact = e.name |
|
|
|
}).catch(e => {}) |
|
|
|
|
|
|
|
|
|
|
|
// 获取平台结算价重新计算课程的相关参数 |
|
|
|
|
|
|
|
const list = this.courseList |
|
|
|
|
|
|
|
const courses = [] |
|
|
|
|
|
|
|
const promises = [] |
|
|
|
|
|
|
|
for (const i in list) { |
|
|
|
|
|
|
|
list[i].list.forEach(n => { |
|
|
|
|
|
|
|
promises.push(new Promise(async (resolve, reject) => { |
|
|
|
|
|
|
|
const res = await queryCitySettlementPrice(n.mallId, provinceId, cityId) |
|
|
|
|
|
|
|
n.settlementPriceUnit = res.mallPrice ? res.mallPrice.discountRate : 0 |
|
|
|
|
|
|
|
courses.push(n) |
|
|
|
|
|
|
|
resolve() |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|
|
|
|
this.courses = courses |
|
|
|
|
|
|
|
this.calcTotal() |
|
|
|
this.closeCustomer() |
|
|
|
this.closeCustomer() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 查询合伙人团队费率 |
|
|
|
|
|
|
|
getRate() { |
|
|
|
|
|
|
|
getPartnerTeamRates({ |
|
|
|
|
|
|
|
teamId: this.form.teamId |
|
|
|
|
|
|
|
}).then(({ teamRates }) => { |
|
|
|
|
|
|
|
this.rate = teamRates.annualMarketingFee || 0 |
|
|
|
|
|
|
|
this.calcTotal() |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取团队 |
|
|
|
// 获取团队 |
|
|
|
getTeam(getInfo) { |
|
|
|
getTeam(getInfo) { |
|
|
@ -483,6 +590,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取商务经理 |
|
|
|
// 获取商务经理 |
|
|
|
getBm() { |
|
|
|
getBm() { |
|
|
|
|
|
|
|
this.getRate() |
|
|
|
teamList({ |
|
|
|
teamList({ |
|
|
|
pageNum: 1, |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 1000, |
|
|
|
pageSize: 1000, |
|
|
@ -495,17 +603,27 @@ |
|
|
|
// 跳转 |
|
|
|
// 跳转 |
|
|
|
toAdd() { |
|
|
|
toAdd() { |
|
|
|
uni.setStorageSync('courses', this.courses) |
|
|
|
uni.setStorageSync('courses', this.courses) |
|
|
|
|
|
|
|
uni.setStorageSync('orderForm', this.form) |
|
|
|
const { customerId, orderType } = this.form |
|
|
|
const { customerId, orderType } = this.form |
|
|
|
customerId ? |
|
|
|
customerId ? |
|
|
|
this.$util.to(`../addCourse/addCourse?orderType=${orderType}&customerId=${customerId}`) : |
|
|
|
this.$util.to(`../addCourse/addCourse?orderType=${orderType}&customerId=${customerId}&provinceId=${this.form.provinceId}&cityId=${this.form.cityId}&teamId=${this.form.teamId || ''}`) : |
|
|
|
this.$util.errMsg('请先选择客户!') |
|
|
|
this.$util.errMsg('请先选择客户!') |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 编辑课程 |
|
|
|
// 编辑课程 |
|
|
|
editCourse(c, i) { |
|
|
|
editCourse(c, i) { |
|
|
|
if (this.isDetail) return false |
|
|
|
if (this.isDetail) return false |
|
|
|
uni.setStorageSync('courses', this.courses) |
|
|
|
uni.setStorageSync('courses', this.courses) |
|
|
|
|
|
|
|
uni.setStorageSync('orderForm', this.form) |
|
|
|
const { customerId, orderType } = this.form |
|
|
|
const { customerId, orderType } = this.form |
|
|
|
this.$util.to(`../editCourse/editCourse?orderType=${orderType}&customerId=${customerId}&action=${this.isEdit ? 'edit' : this.isRenew ? 'renew' : this.isHandle ? 'handle' : !this.orderId ? 'add' : ''}`) |
|
|
|
this.$util.to(`../editCourse/editCourse?orderType=${orderType}&customerId=${customerId}&action=${this.isEdit ? 'edit' : this.isRenew ? 'renew' : this.isHandle ? 'handle' : !this.orderId ? 'add' : ''}&teamId=${this.form.teamId || ''}`) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 前往创建客户 |
|
|
|
|
|
|
|
toClient() { |
|
|
|
|
|
|
|
uni.setStorageSync('courses', this.courseList) |
|
|
|
|
|
|
|
uni.redirectTo({ |
|
|
|
|
|
|
|
url: `/order/clientDetail/clientDetail` |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
// this.$util.to(`/order/clientDetail/clientDetail`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除课程 |
|
|
|
// 删除课程 |
|
|
|
delCourse(c, i) { |
|
|
|
delCourse(c, i) { |
|
|
@ -541,13 +659,13 @@ |
|
|
|
handleDeliver(c, i) { |
|
|
|
handleDeliver(c, i) { |
|
|
|
const row = this.courseList[c].list[i] |
|
|
|
const row = this.courseList[c].list[i] |
|
|
|
row.ship = row.ship ? 0 : 1 |
|
|
|
row.ship = row.ship ? 0 : 1 |
|
|
|
this.isEdit && ship(row).then(res => {}).catch(res => {}) // 编辑的情况下,需要调接口去直接发货 |
|
|
|
if (row.ship == 1) row.isEnable = 1 // 发货后直接启用 |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 计算订单总额 |
|
|
|
// 计算订单总额 |
|
|
|
calcTotal(out) { |
|
|
|
calcTotal(out) { |
|
|
|
this.handleErr('orderType') |
|
|
|
this.handleErr('orderType') |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
|
const isTrial = form.orderType === 2 // 是否试用 |
|
|
|
const isTrial = form.orderType == 2 // 是否试用 |
|
|
|
let total = 0 |
|
|
|
let total = 0 |
|
|
|
const list = this.courses |
|
|
|
const list = this.courses |
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
let purchase = 0 // 总采购成本 |
|
|
@ -566,12 +684,16 @@ |
|
|
|
list.map(e => { |
|
|
|
list.map(e => { |
|
|
|
// out=1 && 试用,则把结算价等重置为0 |
|
|
|
// out=1 && 试用,则把结算价等重置为0 |
|
|
|
if (out && isTrial) { |
|
|
|
if (out && isTrial) { |
|
|
|
|
|
|
|
console.log(123, e, out, isTrial) |
|
|
|
e.settlementPrice = 0 |
|
|
|
e.settlementPrice = 0 |
|
|
|
e.serviceFee = 0 |
|
|
|
e.serviceFee = 0 |
|
|
|
e.finalPrice = 0 |
|
|
|
e.finalPrice = 0 |
|
|
|
e.finalValue = 0 |
|
|
|
e.finalValue = 0 |
|
|
|
e.discountRate = '0%' |
|
|
|
e.discountRate = '0%' |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
this.calcDiscount(e) |
|
|
|
|
|
|
|
this.dealSettlePrice(e) |
|
|
|
|
|
|
|
// this.calcFinalPrice(e) |
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
purchase += curPurchase |
|
|
|
purchase += curPurchase |
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
@ -579,7 +701,55 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
form.profit = Math.round(profit) |
|
|
|
form.profit = Math.round(profit) |
|
|
|
form.orderAmount = +form.purchaseCost + +form.profit |
|
|
|
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) |
|
|
|
|
|
|
|
console.log(111, this.courseList, this.courses) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 计算订单总额 |
|
|
|
|
|
|
|
calcAmount() { |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
const list = this.courses |
|
|
|
|
|
|
|
let purchase = 0 // 总采购成本 |
|
|
|
|
|
|
|
let profit = 0 // 总利润 |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
const curPurchase = +e.settlementPrice + +e.serviceFee |
|
|
|
|
|
|
|
purchase += curPurchase |
|
|
|
|
|
|
|
profit += +e.finalPrice - curPurchase |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
form.purchaseCost = Math.round(purchase) |
|
|
|
|
|
|
|
form.profit = Math.round(profit) |
|
|
|
|
|
|
|
form.orderAmount = (+form.purchaseCost + +form.profit).toFixed(2) |
|
|
|
|
|
|
|
console.log(111, this.courseList, this.courses) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 显示发货信息 |
|
|
|
|
|
|
|
showShip(row) { |
|
|
|
|
|
|
|
this.curRow = row |
|
|
|
|
|
|
|
let val = '' |
|
|
|
|
|
|
|
row.mallNonAssociatedLinks && row.mallNonAssociatedLinks.forEach(e => { |
|
|
|
|
|
|
|
val += e.urlName + ':' + e.url + '\n' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.shipInfo = val |
|
|
|
|
|
|
|
this.shipContent = row.shipContent || val |
|
|
|
|
|
|
|
this.$refs.info.open() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭发货信息 |
|
|
|
|
|
|
|
closeShip() { |
|
|
|
|
|
|
|
this.$refs.info.close() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 提交发货信息 |
|
|
|
|
|
|
|
submitShip() { |
|
|
|
|
|
|
|
if (this.shipContent.length > 300) return this.$util.errMsg('请填写300个字以内!') |
|
|
|
|
|
|
|
this.curRow.shipContent = this.shipContent |
|
|
|
|
|
|
|
this.$refs.info.close() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 复制发货信息 |
|
|
|
|
|
|
|
copy() { |
|
|
|
|
|
|
|
const that = this |
|
|
|
|
|
|
|
uni.setClipboardData({ |
|
|
|
|
|
|
|
data: that.isDetail ? that.shipContent : this.shipInfo, |
|
|
|
|
|
|
|
success() { |
|
|
|
|
|
|
|
that.$util.sucMsg('复制成功') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 处理错误提示 |
|
|
|
// 处理错误提示 |
|
|
|
handleErr(val) { |
|
|
|
handleErr(val) { |
|
|
@ -611,12 +781,154 @@ |
|
|
|
for (const i in list) { |
|
|
|
for (const i in list) { |
|
|
|
list[i].list.forEach(e => { |
|
|
|
list[i].list.forEach(e => { |
|
|
|
e.ship = ship |
|
|
|
e.ship = ship |
|
|
|
|
|
|
|
if (e.ship == 1) e.isEnable = 1 |
|
|
|
courses.push(e) |
|
|
|
courses.push(e) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
this.courses = courses |
|
|
|
this.courses = courses |
|
|
|
this.isEdit && bulkShipping({orderOthers: courses}).then(res => {}).catch(res => {}) // 编辑的情况下,需要调接口去直接发货 |
|
|
|
this.isEdit && bulkShipping({orderOthers: courses}).then(res => {}).catch(res => {}) // 编辑的情况下,需要调接口去直接发货 |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
calcDate(row, fromData) { |
|
|
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
|
|
|
const { periodOfUse, options } = row |
|
|
|
|
|
|
|
let optionsData = 0 |
|
|
|
|
|
|
|
if (periodOfUse) { |
|
|
|
|
|
|
|
if (options == 1){ |
|
|
|
|
|
|
|
optionsData = periodOfUse === '12' ? 31536000000 : periodOfUse*30*24*60*60*1000 |
|
|
|
|
|
|
|
} else if (options == 2){ |
|
|
|
|
|
|
|
optionsData = periodOfUse*365*24*60*60*1000 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
optionsData = periodOfUse*24*60*60*1000 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let time = new Date(row.startTime).getTime() |
|
|
|
|
|
|
|
let endTime = time + optionsData |
|
|
|
|
|
|
|
row.endTime = time + optionsData |
|
|
|
|
|
|
|
let dt = new Date(endTime) |
|
|
|
|
|
|
|
row.endTime = (dt.getFullYear()) + "-" + (dt.getMonth() + 1) + "-" + (dt.getDate()) |
|
|
|
|
|
|
|
let endYear = endTime - time |
|
|
|
|
|
|
|
let endYears = endYear/1000/60/60/24 |
|
|
|
|
|
|
|
row.remainingPeriod = endYears |
|
|
|
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
|
|
|
// 计算市场价 |
|
|
|
|
|
|
|
const price = row.marketPrice || 0 // 市场单价 |
|
|
|
|
|
|
|
// 结算单价是元/年,所以如果选择的不是年,要进行换算(日:/365,月:/12) |
|
|
|
|
|
|
|
row.marketValue = (!unit ? |
|
|
|
|
|
|
|
price / 365 * useUnit : |
|
|
|
|
|
|
|
unit === 1 ? |
|
|
|
|
|
|
|
price / 12 * useUnit : |
|
|
|
|
|
|
|
price * useUnit).toFixed(2) |
|
|
|
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
|
|
|
// 只有改变了起止日期才需要调接口查询订单,该接口作用是把开始时间传过去,会返回一个提示或者时间,如果是时间,则把时间+1天,如果是提示,则无法保存 |
|
|
|
|
|
|
|
if (!fromData) { |
|
|
|
|
|
|
|
const cId = row.dataOrCourseId |
|
|
|
|
|
|
|
const date = new Date(row.startTime) |
|
|
|
|
|
|
|
const orderRepeat = this.orderRepeat |
|
|
|
|
|
|
|
getOrderOtherTime({ |
|
|
|
|
|
|
|
customerId: this.customerId, |
|
|
|
|
|
|
|
id: cId, |
|
|
|
|
|
|
|
startTime: this.$util.formatDate(date, 'yyyy-MM-dd'), |
|
|
|
|
|
|
|
endTime: row.endTime |
|
|
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
|
|
orderRepeat.includes(cId) && orderRepeat.splice(orderRepeat.findIndex(e => e === cId), 1) |
|
|
|
|
|
|
|
if (res.endTime) { |
|
|
|
|
|
|
|
let time = new Date(res.endTime) |
|
|
|
|
|
|
|
time = new Date(time.setDate(time.getDate() + 1)) |
|
|
|
|
|
|
|
row.startTime = this.$util.formatDate(time, 'yyyy-MM-dd') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
this.repeatMsg = res.message |
|
|
|
|
|
|
|
orderRepeat.includes(cId) || orderRepeat.push(cId) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 折扣率 |
|
|
|
|
|
|
|
this.calcDiscount(row) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
dealSettlePrice(row) { |
|
|
|
|
|
|
|
// 如果是试用或者没选择,结算价和平台服务费都是0 |
|
|
|
|
|
|
|
if (this.form.orderType != 1) { |
|
|
|
|
|
|
|
row.settlementPrice = 0 |
|
|
|
|
|
|
|
row.serviceFee = 0 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const unit = row.options // 使用期限单位 |
|
|
|
|
|
|
|
const useUnit = row.periodOfUse // 使用期限 |
|
|
|
|
|
|
|
let sPrice = '' |
|
|
|
|
|
|
|
// 结算单价。计算规则:结算单价(**元/年)*购买时长(单位年)*数量(课程为1,数据为账号数量) |
|
|
|
|
|
|
|
const priceUnit = row.settlementPriceUnit |
|
|
|
|
|
|
|
sPrice = ((!unit ? |
|
|
|
|
|
|
|
priceUnit / 365 * useUnit : |
|
|
|
|
|
|
|
unit === 1 ? |
|
|
|
|
|
|
|
priceUnit / 12 * useUnit : |
|
|
|
|
|
|
|
priceUnit * useUnit) * (row.authority ? |
|
|
|
|
|
|
|
1 : |
|
|
|
|
|
|
|
row.accountNum)).toFixed((2)) |
|
|
|
|
|
|
|
row.settlementPrice = this.$util.handleNaN(sPrice) |
|
|
|
|
|
|
|
// 平台服务费 |
|
|
|
|
|
|
|
row.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
|
|
|
|
this.calcAmount() |
|
|
|
|
|
|
|
console.log('row.settlementPrice =>' ,row.settlementPrice,row.settlementPriceUnit,sPrice,row) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
calcDiscount(row) { |
|
|
|
|
|
|
|
const price = row.authority ? row.finalPrice : row.finalValue |
|
|
|
|
|
|
|
const { marketValue } = row |
|
|
|
|
|
|
|
// (原价-现价)÷原价 x100% |
|
|
|
|
|
|
|
if (price) row.discountRate = marketValue != 0 ? ((marketValue - price) / marketValue * 100).toFixed(2) + '%' : '0%' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
selectUnit(item) { |
|
|
|
|
|
|
|
const that = this |
|
|
|
|
|
|
|
uni.showActionSheet({ |
|
|
|
|
|
|
|
title: '标题', |
|
|
|
|
|
|
|
itemList: that.unitText, |
|
|
|
|
|
|
|
success: ({ tapIndex }) => { |
|
|
|
|
|
|
|
item.options = tapIndex |
|
|
|
|
|
|
|
that.calcDate(item) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 成交价修改后,计算成交单价,数据才需要 计算规则:成交价/账号数/时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
|
|
|
calcFinalValue(row) { |
|
|
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
|
|
|
const { authority, periodOfUse, options, accountNum, finalPrice } = row |
|
|
|
|
|
|
|
if (!authority && periodOfUse && accountNum && finalPrice) { |
|
|
|
|
|
|
|
row.finalValue = (finalPrice / accountNum / periodOfUse).toFixed(2) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 折扣率 |
|
|
|
|
|
|
|
this.calcDiscount(row) |
|
|
|
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 计算成交价。计算规则:成交单价*账号数*时间(成交单价为元/账号/年,所以时间要换算成年的单位去计算) |
|
|
|
|
|
|
|
calcFinalPrice(row) { |
|
|
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
|
|
|
const { finalValue, accountNum, periodOfUse, finalPrice } = row |
|
|
|
|
|
|
|
if (periodOfUse) { |
|
|
|
|
|
|
|
if (accountNum) { |
|
|
|
|
|
|
|
// 有成交单价,则成交价=成交单价*账号数*时间 |
|
|
|
|
|
|
|
if (finalValue) { |
|
|
|
|
|
|
|
row.finalPrice = Math.round(finalValue * periodOfUse * accountNum) |
|
|
|
|
|
|
|
} else if (!finalValue && finalPrice) { |
|
|
|
|
|
|
|
// 有成交价,没有成交单价,则成交单价=成交价/账号数/时间 |
|
|
|
|
|
|
|
row.finalValue = (finalPrice / periodOfUse / accountNum).toFixed(2) |
|
|
|
|
|
|
|
this.calcDiscount(row) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (finalValue && finalPrice && !row.authority) { |
|
|
|
|
|
|
|
// 有成交价、成交单价,没有数量,则数量=成交价/时间/成交单价 |
|
|
|
|
|
|
|
row.accountNum = Math.floor(finalPrice / periodOfUse / finalValue) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.dealSettlePrice(row) |
|
|
|
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 结算价修改后计算平台服务费 |
|
|
|
|
|
|
|
updateServiceFee(row) { |
|
|
|
|
|
|
|
options.serviceFee = (row.finalPrice * (this.rate / 100)).toFixed(2) |
|
|
|
|
|
|
|
}, |
|
|
|
// 提交 |
|
|
|
// 提交 |
|
|
|
submit() { |
|
|
|
submit() { |
|
|
|
const { form } = this |
|
|
|
const { form } = this |
|
|
@ -664,18 +976,20 @@ |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
add(data).then(res => { |
|
|
|
add(data).then(res => { |
|
|
|
// form.orderOther.find(e => !e.ship) || this.publicNotice(form, orderId) // 新增的时候要判断是否全部产品都发货了,全部发货了才发服务通知 |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
uni.hideLoading() |
|
|
|
this.$util.sucMsg('添加成功') |
|
|
|
this.$util.sucMsg('添加成功') |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
// this.$util.to(`../orders/orders`) |
|
|
|
uni.navigateBack() |
|
|
|
uni.navigateBack() |
|
|
|
|
|
|
|
// uni.redirectTo({ |
|
|
|
|
|
|
|
// url: `../orders/orders` |
|
|
|
|
|
|
|
// }) |
|
|
|
}, 1500) |
|
|
|
}, 1500) |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
uni.hideLoading() |
|
|
|
uni.hideLoading() |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
@ -690,6 +1004,17 @@ |
|
|
|
bottom: 100rpx; |
|
|
|
bottom: 100rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.form-list { |
|
|
|
|
|
|
|
.customer-wrap { |
|
|
|
|
|
|
|
text-align: right; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.create { |
|
|
|
|
|
|
|
padding: 0 20rpx; |
|
|
|
|
|
|
|
font-size: 20rpx; |
|
|
|
|
|
|
|
text-align: right; |
|
|
|
|
|
|
|
color: #f00; |
|
|
|
|
|
|
|
} |
|
|
|
.pro-wrap { |
|
|
|
.pro-wrap { |
|
|
|
position: relative; |
|
|
|
position: relative; |
|
|
|
padding: 0; |
|
|
|
padding: 0; |
|
|
@ -715,6 +1040,8 @@ |
|
|
|
.left { |
|
|
|
.left { |
|
|
|
display: inline-flex; |
|
|
|
display: inline-flex; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
|
|
|
|
|
max-width: 480rpx; |
|
|
|
|
|
|
|
margin-right: 10rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
.course-action { |
|
|
|
.course-action { |
|
|
|
display: inline-flex; |
|
|
|
display: inline-flex; |
|
|
@ -724,6 +1051,10 @@ |
|
|
|
padding: 0 16rpx; |
|
|
|
padding: 0 16rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
margin-right: 10rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
white-space: nowrap; |
|
|
|
|
|
|
|
&.mg { |
|
|
|
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.del { |
|
|
|
.del { |
|
|
|
width: 40rpx; |
|
|
|
width: 40rpx; |
|
|
@ -740,11 +1071,18 @@ |
|
|
|
.line { |
|
|
|
.line { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
justify-content: space-between; |
|
|
|
padding: 12rpx 0; |
|
|
|
padding: 28rpx 0; |
|
|
|
margin: 5px 0; |
|
|
|
|
|
|
|
font-size: 12px; |
|
|
|
font-size: 12px; |
|
|
|
|
|
|
|
border-bottom: 1px solid #E6E8ED; |
|
|
|
|
|
|
|
&:last-child { |
|
|
|
|
|
|
|
border-bottom: 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.label { |
|
|
|
.label { |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
color: #333; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.ph { |
|
|
|
font-size: 28rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #999; |
|
|
|
color: #999; |
|
|
|
} |
|
|
|
} |
|
|
@ -763,8 +1101,15 @@ |
|
|
|
font-size: 32rpx; |
|
|
|
font-size: 32rpx; |
|
|
|
color: #007EFF; |
|
|
|
color: #007EFF; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.period { |
|
|
|
|
|
|
|
flex: none; |
|
|
|
|
|
|
|
width: 100rpx; |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.bottom { |
|
|
|
.bottom { |
|
|
|
|
|
|
|
z-index: 2; |
|
|
|
position: fixed; |
|
|
|
position: fixed; |
|
|
|
bottom: 0; |
|
|
|
bottom: 0; |
|
|
|
padding-bottom: env(safe-area-inset-bottom); |
|
|
|
padding-bottom: env(safe-area-inset-bottom); |
|
|
@ -772,12 +1117,14 @@ |
|
|
|
background-color: #fff; |
|
|
|
background-color: #fff; |
|
|
|
box-shadow: 0 -2px 2px #f5f5f5; |
|
|
|
box-shadow: 0 -2px 2px #f5f5f5; |
|
|
|
box-sizing: border-box; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
.add-wrap { |
|
|
|
.add-wrap { |
|
|
|
|
|
|
|
padding: 16rpx 24rpx 40rpx; |
|
|
|
padding: 16rpx 24rpx 40rpx; |
|
|
|
background-color: #f5f5f5; |
|
|
|
background-color: #f5f5f5; |
|
|
|
} |
|
|
|
} |
|
|
|
/deep/.add-btn { |
|
|
|
.next-wrap { |
|
|
|
|
|
|
|
padding: 24rpx 24rpx 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/deep/.lg-btn { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
@ -793,6 +1140,11 @@ |
|
|
|
.uni-icons { |
|
|
|
.uni-icons { |
|
|
|
font-size: 38rpx !important; |
|
|
|
font-size: 38rpx !important; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
&.next { |
|
|
|
|
|
|
|
color: #fff; |
|
|
|
|
|
|
|
background-color: #007EFF; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.product { |
|
|
|
.product { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
@ -852,17 +1204,101 @@ |
|
|
|
.product-btns { |
|
|
|
.product-btns { |
|
|
|
display: inline-flex; |
|
|
|
display: inline-flex; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
|
margin-left: 20rpx; |
|
|
|
margin-left: 10rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
.btn { |
|
|
|
.btn { |
|
|
|
padding: 0 20rpx; |
|
|
|
padding: 0 20rpx; |
|
|
|
margin-left: 16rpx; |
|
|
|
margin-left: 8rpx; |
|
|
|
line-height: 80rpx; |
|
|
|
line-height: 80rpx; |
|
|
|
font-size: 30rpx; |
|
|
|
font-size: 26rpx; |
|
|
|
text-align: center; |
|
|
|
text-align: center; |
|
|
|
color: #fff; |
|
|
|
color: #fff; |
|
|
|
|
|
|
|
white-space: nowrap; |
|
|
|
border-radius: 10rpx; |
|
|
|
border-radius: 10rpx; |
|
|
|
background-color: #007EFF; |
|
|
|
background-color: #007EFF; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.unit { |
|
|
|
|
|
|
|
display: inline-flex; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
.icon { |
|
|
|
|
|
|
|
width: 28rpx; |
|
|
|
|
|
|
|
margin-left: 20rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
input { |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
text{ |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.line { |
|
|
|
|
|
|
|
.inline { |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
input { |
|
|
|
|
|
|
|
text-align: right; |
|
|
|
|
|
|
|
margin-right: 10rpx; |
|
|
|
|
|
|
|
margin-left: 20rpx; |
|
|
|
|
|
|
|
color: #333; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.edit { |
|
|
|
|
|
|
|
margin-left: 10rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.ship-info { |
|
|
|
|
|
|
|
height: 400rpx; |
|
|
|
|
|
|
|
padding: 30rpx; |
|
|
|
|
|
|
|
white-space: pre-wrap; |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
overflow: auto; |
|
|
|
|
|
|
|
.ship-text { |
|
|
|
|
|
|
|
margin-bottom: 20rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.ship-links { |
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
justify-content: flex-end; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
|
|
|
font-size: 24rpx; |
|
|
|
|
|
|
|
color: #007eff; |
|
|
|
|
|
|
|
.tooltip { |
|
|
|
|
|
|
|
z-index: 1000; |
|
|
|
|
|
|
|
display: none; |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
|
|
|
|
top: 40rpx; |
|
|
|
|
|
|
|
left: 0; |
|
|
|
|
|
|
|
max-width: 90%; |
|
|
|
|
|
|
|
padding: 12px; |
|
|
|
|
|
|
|
color: #fff; |
|
|
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
|
|
text-align: left; |
|
|
|
|
|
|
|
line-height: 16px; |
|
|
|
|
|
|
|
background-color: #333; |
|
|
|
|
|
|
|
border-radius: 8px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
&:hover { |
|
|
|
|
|
|
|
.tooltip { |
|
|
|
|
|
|
|
display: block; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ship-btns { |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
justify-content: center; |
|
|
|
|
|
|
|
align-items: center; |
|
|
|
|
|
|
|
button { |
|
|
|
|
|
|
|
padding: 0 16rpx; |
|
|
|
|
|
|
|
margin: 0; |
|
|
|
|
|
|
|
font-size: 28rpx; |
|
|
|
|
|
|
|
&:first-child { |
|
|
|
|
|
|
|
margin-right: 20rpx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |
|
|
|