create-order.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. <template>
  2. <view class="container order clearfix" :style="{paddingBottom :isIphoneX ? '190rpx' : '134rpx'}">
  3. <!-- 地址选择 -->
  4. <choice-address ref="choiceAddress" v-if="isAddress" :addressData="addressData"></choice-address>
  5. <!-- 商品 -->
  6. <seller-goodsList ref='goods' v-if="isRequest" :secondflag="secondflag" :goodsData="goodsData" @handleGoodList="handChangeInputGoodsList"></seller-goodsList>
  7. <!-- 返佣订单 -->
  8. <view class="order-return" v-if="goodsData.length==1 && secondflag">
  9. <view class="order-return-main" @click="handleRebateFlag">
  10. <view class="label">是否返佣</view>
  11. <view class="label-right">
  12. <text class="text-l">{{ rebateFeeText }}</text>
  13. <text class="iconfont icon-xiayibu"></text>
  14. </view>
  15. </view>
  16. <view class="order-return-input" v-if="confirmParam.payInfo.rebateFlag === 2">
  17. <input class="input" v-model="rebateFee" type="number" placeholder="请输入返佣服务费" maxlength="20">
  18. </view>
  19. </view>
  20. <!-- 返佣订单 -->
  21. <view class="Rebate" @click="handleSecondFlag" v-if="!secondflag">
  22. <text class="rebate-title">二手返佣订单</text>
  23. <text class="iconfont" :class="rebatecheck?'icon-yixuanze':'icon-weixuanze'" ></text>
  24. </view>
  25. <!-- 发票信息 -->
  26. <seller-invoice ref="invoice"
  27. v-if="isRequest"
  28. :invoiceDatas="invoiceData"
  29. @handleChoiceaInvoice="handleChoiceaInvoiceData">
  30. </seller-invoice>
  31. <!-- 优惠券选择弹窗 -->
  32. <sellerCoupon ref="coupon"
  33. v-if="isCouponShow"
  34. :couponList="couponList"
  35. @handleChoiceaCoupon="handleChoiceaCouponData">
  36. </sellerCoupon>
  37. <!-- 兑换优惠券弹窗 -->
  38. <sellerExchangeCoupon v-if="isExchangePopup"></sellerExchangeCoupon>
  39. <!-- 运费 -->
  40. <seller-freight ref="freight"
  41. v-if="isFreight"
  42. :freightDatas="freightData"
  43. @handleChoiceaFreight="handleChoiceaFreightData"
  44. @showFreightAlert="handFreightAlertShow">
  45. </seller-freight>
  46. <freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
  47. <!-- 余额抵扣 -->
  48. <view class="invoice-balance" v-if="!rechargeGoods">
  49. <view class="balabce-t">
  50. <view class="balabce-t-le">余额抵扣</view>
  51. <view class="balabce-t-ri">
  52. <view class="money">
  53. <text>可用余额:</text>
  54. <text>¥{{ userMoney | NumFormat }}</text>
  55. </view>
  56. <view class="checkbox-box">
  57. <button class="checkbox iconfont"
  58. hover-class="btn-hover"
  59. v-if="userMoney!=0"
  60. @click.stop="checkedBalabce"
  61. :class="[ischecked ?'icon-yixuanze':'icon-weixuanze']"
  62. >
  63. </button>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="balabce-b" :class="{'balabce-b--hide':!ischecked}">
  68. <view class="balabce-b-text animation"
  69. :style="{'transform':ischecked?'translateY(0)':'translateY(-50%)','-webkit-transform':ischecked?'translateY(0)':'translateY(-50%)'}">
  70. <text>当前使用:¥{{deductMoney | NumFormat}},剩余:¥{{ surplusMoney | NumFormat }}</text>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 选择对机构是否可见 -->
  75. <sellerClubVisible ref="clubVisible" v-if="isRequest" @handleClubVisible="handleClubVisibleData"></sellerClubVisible>
  76. <!-- 售后条例 -->
  77. <seller-regulations ref="regulations"
  78. v-if="isRequest && seconDepositFlg"
  79. :regulaDatas="clauseList"
  80. @handleData="handleClauseData">
  81. </seller-regulations>
  82. <regula-alert v-if="isregulaTip" ref="csPhone"></regula-alert>
  83. <!-- 底部 -->
  84. <view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  85. <view class="footer-le">
  86. <view class="footer-count">
  87. <text>共{{ totalCount }}件商品</text>
  88. </view>
  89. <view class="footer-price">
  90. <view class="sum" :class="totalDiscountAmount == 0 ? 'none' : ''">
  91. 总价:<text class="price">¥{{orderShouldPayFee | NumFormat}}</text>
  92. </view>
  93. <view class="sum-none" v-if="totalDiscountAmount > 0">
  94. <text class="money-reduced">共减<text>¥{{ totalDiscountAmount | NumFormat}}</text></text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="footer-submit" @click.stop="orderSubmitMit">
  99. <view class="btn" :class="isSubLoading ? 'disabled' : ''">提交订单</view>
  100. </view>
  101. </view>
  102. <!-- 优惠券 -->
  103. <view class="coupon-content-model" v-if="isCouponModel">
  104. <view class="coupon-alert-content">
  105. <view class="coupon">
  106. <view class="coupon-list">
  107. <view class="list-cell-tags">{{ ExchangeCouponData.couponType | TypeFormat }}</text></view>
  108. <view class="list-cell-le">
  109. <view class="coupon-maxMoney">
  110. <text class="small">¥</text>
  111. {{ ExchangeCouponData.couponAmount }}
  112. </view>
  113. <view class="coupon-minMoney">
  114. <text class="txt">满{{ ExchangeCouponData.touchPrice }}可用</text>
  115. </view>
  116. </view>
  117. <view class="list-cell-ri">
  118. <view class="list-cell-top">
  119. <text v-if="ExchangeCouponData.couponType == 0">
  120. {{ ExchangeCouponData.productType && ExchangeCouponData.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  121. </text>
  122. <text v-if="ExchangeCouponData.couponType == 1">
  123. {{ ExchangeCouponData.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  124. </text>
  125. <text v-if="ExchangeCouponData.couponType == 3">仅限购买店铺【{{ ExchangeCouponData.shopName }}】的商品</text>
  126. <text v-if="ExchangeCouponData.couponType == 4 || ExchangeCouponData.couponType == 2">全商城商品通用</text>
  127. </view>
  128. <view class="list-cell-time">{{ ExchangeCouponData.startDate }} - {{ ExchangeCouponData.endDate }}</view>
  129. </view>
  130. </view>
  131. <view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
  132. </view>
  133. </view>
  134. </view>
  135. <!-- 弹窗提示 -->
  136. <tui-modal
  137. :show="modal"
  138. @click="handleClick"
  139. @cancel="hideMobel"
  140. :content="contentModalText"
  141. :button="modalButton"
  142. color="#333"
  143. :size="32"
  144. shape="circle"
  145. :maskClosable="false"
  146. >
  147. </tui-modal>
  148. </view>
  149. </template>
  150. <script>
  151. import freightAlert from '@/components/cm-module/modelAlert/freightAlert.vue'
  152. import choiceAddress from './components/sellerAddress'
  153. import sellerGoodsList from './components/sellerGoodsList'
  154. import sellerInvoice from './components/sellerInvoice'
  155. import sellerFreight from './components/sellerFreight'
  156. import sellerCoupon from './components/sellerCoupon'
  157. import sellerExchangeCoupon from './components/sellerExchangeCoupon'
  158. import sellerClubVisible from './components/sellerClubVisible'
  159. import sellerRegulations from './components/sellerRegulations.vue'
  160. export default {
  161. components:{
  162. choiceAddress,
  163. sellerGoodsList,
  164. sellerInvoice,
  165. sellerFreight,
  166. sellerCoupon,
  167. sellerExchangeCoupon,
  168. sellerClubVisible,
  169. freightAlert,
  170. sellerRegulations
  171. },
  172. data() {
  173. return {
  174. isSubLoading:false,
  175. modalButton: [
  176. {
  177. text: '再想一想',
  178. type: 'gray',
  179. plain: true //是否空心
  180. },
  181. {
  182. text: '继续提交',
  183. customStyle: {
  184. color: '#fff',
  185. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  186. },
  187. plain: false
  188. }
  189. ],
  190. contentModalText: '', //操作文字提示语句
  191. modal: false,
  192. showModalstauts:1,
  193. isIphoneX:this.$store.state.isIphoneX,
  194. cartParam: {// 购物车立即结算确认订单参数
  195. skuIds:0, // 商品Id(逗号隔开)
  196. serviceProviderId:0,// 协销Id
  197. clubId:0 // 机构Id
  198. },
  199. productParam: {// 商品立即购买确认订单参数
  200. productCount:0, // 商品数量
  201. productId:0, // 商品Id
  202. serviceProviderId:0,// 协销Id
  203. clubId:0 // 机构Id
  204. },
  205. postageParam: {// 邮费计算参数
  206. skuIds:0, // 商品Id(逗号隔开)
  207. userId:0, // 用户Id
  208. townId:0 // 地区Id
  209. },
  210. confirmParam: {// 提交订单参数
  211. cartType:3, // 购买类型:(1自主下单, 3协销下单)
  212. orderMiniType:0, // 订单提交状态 0初始提交 1 继续提交
  213. orderSource:6, // 订单来源 1WWW 6小程序[采美,星范]
  214. addressId:0, // 收货地址Id
  215. clubCouponId:0, // 关联优惠券Id
  216. clubId:0, // 机构Id
  217. orderInfo:[], // 订单商品数据
  218. orderInvoice:{type:0}, // 订单发票信息
  219. orderSeen:1, // 订单对机构可见度 1可见 2不可见
  220. payInfo:{ // 订单金额数据
  221. orderShouldPayFee: 0, // 订单最终支付金额
  222. balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
  223. clauseId:0, // 条款Id
  224. postage: 0, // 运费金额
  225. postageFlag: 0, // 运费类型
  226. userBeans: 0, // 抵扣采美豆数量
  227. rebateFee:0, // 返佣服务费
  228. rebateFlag:0 // 是否返佣订单
  229. },
  230. unionId:uni.getStorageSync('unionId'),// 用户unionId
  231. },
  232. rebateFee:'',
  233. rebateFeeText:'否',
  234. confirmType:1,
  235. submitState:'', // 提交状态
  236. totalCount:0, // 订单提交总数量
  237. reducedPrice:0, // 满减金额
  238. couponAmount:0, // 优惠券金额
  239. totalDiscountAmount:0, // 共减金额
  240. orderShouldPayFee:0.00, // 订单提交总金额
  241. allPrice:0.00, // 订单总金额
  242. surplusMoney:0.00, // 显示勾选后的剩余抵扣
  243. userMoney:0.00, // 显示可使用余额
  244. deductMoney:0.00, // 显示已使用的余额
  245. isRequest:false, // 是否加载完成渲染子组件
  246. isFreight:false, // 是否加载完成渲染子组件
  247. isAddress:false, // 是否加载完成地址
  248. isExchangePopup:false, // 控制兑换优惠券弹窗
  249. isfreightTip:false, // 控制邮费弹窗
  250. ischecked:false, // 是否勾选余额
  251. addressData:{}, // 初始化地址信息
  252. goodsData:[], // 初始化商品信息
  253. couponList:[], // 初始化优惠券信息
  254. invoiceData:{type:0}, // 初始化发票信息
  255. freightData:{}, // 邮费数据
  256. handleFreightData:{}, // 监听邮费数据
  257. orderInfo:[], // 提交的商品信息
  258. payInfo:{}, // 订单信息
  259. rechargeGoods:false,
  260. clauseList:[],
  261. seconDepositFlg:true,
  262. rebatecheck:false,
  263. isCouponShow:false, // 是否显示可选优惠券
  264. secondflag:true,
  265. isCouponModel:false, // 兑换优惠券成功提示
  266. ExchangeCouponData:{}, // 兑换优惠券信息
  267. }
  268. },
  269. onLoad(option){//商品数据
  270. this.initStorage(option)
  271. },
  272. filters:{
  273. NumFormat(value) {//处理金额
  274. return Number(value).toFixed(2)
  275. },
  276. },
  277. methods: {
  278. async initStorage(option){
  279. const data = JSON.parse(option.data)
  280. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  281. const userInfo = await this.$api.getStorage()
  282. this.productParam.clubId = this.cartParam.clubId = this.confirmParam.clubId = clubInfo.clubId ? clubInfo.clubId : 0
  283. this.postageParam.userId = clubInfo.userId ? clubInfo.userId : 0
  284. this.productParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  285. this.cartParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  286. this.confirmParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  287. if(option.type =='prodcut'){
  288. this.confirmType = 1
  289. this.productParam.productCount = data.data.productCount
  290. this.productParam.productId = data.data.productIds
  291. this.getInitProdcutCrearOrder()
  292. }else{
  293. this.confirmType = 2
  294. this.cartParam.skuIds = data.data.skuIds
  295. this.getInitCrearOrder()
  296. }
  297. },
  298. getInitCrearOrder(){//协销购物车跳转确认订单初始化信息
  299. this.SellerService.SellerSettlement(this.cartParam).then(response =>{
  300. let data = response.data
  301. this.isRequest = true
  302. this.goodsData = data.list
  303. this.userMoney = data.userMoney
  304. this.couponList = data.couponList
  305. this.reducedPrice = data.reducedPrice
  306. this.totalCount = data.totalCount
  307. this.allPrice = data.totalPrice
  308. this.rechargeGoods = data.includeRecharge
  309. this.clauseList = data.clauseList
  310. this.postageParam.productIds = this.getProductIds(data.list)
  311. this.isCouponShow = true
  312. if(this.couponList.length>0){
  313. this.couponAmount = data.couponList[0].couponAmount
  314. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  315. }
  316. this.orderShouldPayFee = this.allPrice - this.couponAmount
  317. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  318. this.getAddressData()
  319. }).catch(error =>{
  320. this.$util.msg(error.msg,2000)
  321. })
  322. },
  323. getInitProdcutCrearOrder(){//二手下单初始化查询
  324. this.seconDepositFlg = false
  325. this.SellerService.GetSettlementBySencondProduct(this.productParam).then(response =>{
  326. const data = response.data
  327. this.isRequest = true
  328. this.goodsData = data.list
  329. this.userMoney = data.userMoney
  330. this.totalCount = data.totalCount
  331. this.allPrice = data.totalPrice
  332. this.orderShouldPayFee = this.allPrice
  333. this.isCouponShow = false
  334. this.secondflag = false
  335. this.getAddressData()
  336. }).catch(error =>{
  337. this.$util.msg(error.msg,2000)
  338. })
  339. },
  340. getProductIds(list){// 获取订单商品id列表
  341. let productIds = []
  342. list.forEach(function(supplier){
  343. supplier.cartList.forEach(function(product){
  344. productIds.push(product.productId)
  345. })
  346. })
  347. return productIds.join(',')
  348. },
  349. getFreightData(){//获取邮费信息
  350. this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
  351. let data = response.data
  352. this.freightData = data
  353. this.handleFreightData = data
  354. this.isFreight = true
  355. if(data.postageFlag== 1){
  356. this.orderShouldPayFee = this.allPrice + data.postage
  357. this.attributePallPrice()
  358. }else{
  359. this.orderShouldPayFee = this.allPrice
  360. this.attributePallPrice()
  361. }
  362. })
  363. },
  364. async getAddressData(){//获取地址信息
  365. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  366. this.UserService.QueryAddressList(
  367. {
  368. pageNum:1,
  369. pageSize:1,
  370. userId:clubInfo.userId,
  371. }
  372. ).then(response =>{
  373. let data = response.data
  374. this.isAddress = true
  375. this.addressData = {}
  376. if(response.data.results != ''){
  377. this.confirmParam.addressId = data.list[0].addressId
  378. this.postageParam.townId = data.list[0].townId
  379. this.addressData = data.list[0]
  380. this.getFreightData()
  381. }else{
  382. this.addressData = this.addressData
  383. }
  384. })
  385. },
  386. handChangeInputGoodsList(data){//对应供应商的留言信息
  387. this.goodsData = data
  388. },
  389. handleChoiceaInvoiceData(data){//获取发票信息
  390. this.confirmParam.orderInvoice = data
  391. },
  392. handleChoiceaFreightData(data){//获取运费信息
  393. console.log('编辑运费信息',data)
  394. if(data.postageFlag == 1){
  395. this.handleFreightData = data
  396. this.orderShouldPayFee = this.allPrice + parseInt(data.postage)
  397. this.attributePallPrice()
  398. }else{
  399. this.handleFreightData = data
  400. this.orderShouldPayFee = this.allPrice
  401. this.attributePallPrice()
  402. }
  403. },
  404. handleClauseData(clauseId){// 条款Id
  405. this.confirmParam.payInfo.clauseId = parseInt(clauseId)
  406. },
  407. handleChoiceaCouponData(data){// 勾选使用优惠券
  408. console.log('优惠券信息',data)
  409. this.couponAmount = data.couponAmount
  410. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  411. this.confirmParam.clubCouponId = data.clubCouponId
  412. this.attributePallPrice()
  413. },
  414. handleClubVisibleData(data){// 订单对机构是否可见
  415. console.log('对机构是否可见',data)
  416. this.confirmParam.orderSeen = Number(data)
  417. },
  418. checkedBalabce(){//勾选使用余额
  419. if(this.rebatecheck){
  420. this.$util.msg('返佣订单不能使用余额抵扣',2000)
  421. }else{
  422. if(this.userMoney > 0){
  423. this.ischecked = !this.ischecked
  424. if(this.ischecked){
  425. this.confirmParam.payInfo.balancePayFlag = 1
  426. this.attributePallPrice()
  427. }else{
  428. this.confirmParam.payInfo.balancePayFlag = 0
  429. if( this.handleFreightData.postageFlag == 1 ){
  430. this.orderShouldPayFee = this.allPrice + parseInt(this.handleFreightData.postage) - this.couponAmount
  431. }else{
  432. this.orderShouldPayFee = this.allPrice - this.couponAmount
  433. }
  434. }
  435. console.log('最终订单支付金额',this.orderShouldPayFee)
  436. console.log('优惠券金额',this.couponAmount)
  437. }else{
  438. return
  439. }
  440. }
  441. },
  442. attributePallPrice(){//计算价格
  443. if( this.handleFreightData.postageFlag == 1){
  444. this.attributeHashfreight(this.handleFreightData.postage)
  445. }else{
  446. this.attributeNofreight()
  447. }
  448. },
  449. attributeNofreight(){//计算没有邮费的支付价格
  450. if(this.ischecked){
  451. let totalAmount = this.allPrice - this.couponAmount//计算不包邮的价格 总价等于商品价格+邮费
  452. if(this.userMoney > totalAmount){
  453. this.orderShouldPayFee = 0.00
  454. this.deductMoney = this.allPrice - this.couponAmount // 勾选后使用抵余额
  455. this.surplusMoney = this.userMoney - this.deductMoney // 勾选后的剩余抵扣
  456. }else{
  457. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount //勾选后的总价
  458. this.deductMoney = this.userMoney // 勾选后使用抵余额
  459. this.surplusMoney = this.userMoney - this.deductMoney // 勾选后的剩余抵扣
  460. }
  461. }else{
  462. this.orderShouldPayFee = this.allPrice - this.couponAmount
  463. this.deductMoney = 0.00
  464. this.surplusMoney = this.userMoney
  465. }
  466. console.log('最终订单支付金额',this.orderShouldPayFee)
  467. console.log('优惠券金额',this.couponAmount)
  468. },
  469. attributeHashfreight(postage){//计算需要邮费的支付价格
  470. let totalAmount = this.allPrice + parseInt(postage) - this.couponAmount//计算不包邮的价格 总价等于商品价格+邮费
  471. if(this.ischecked){
  472. if(this.userMoney > totalAmount ){ //余额大于支付金额
  473. this.orderShouldPayFee = 0.00
  474. this.deductMoney = this.allPrice + parseInt(postage) - this.couponAmount //勾选后使用抵余额
  475. this.surplusMoney = this.userMoney - this.deductMoney //勾选后的剩余抵扣
  476. }else{
  477. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.userMoney - this.couponAmount //勾选后的总价
  478. this.deductMoney = this.userMoney //勾选后使用抵余额
  479. this.surplusMoney = this.userMoney - this.deductMoney //勾选后的剩余抵扣
  480. }
  481. }else{
  482. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.couponAmount
  483. this.deductMoney = 0.00
  484. this.surplusMoney = this.userMoney
  485. }
  486. console.log('最终订单支付金额',this.orderShouldPayFee)
  487. console.log('优惠券金额',this.couponAmount)
  488. },
  489. orderSubmitMit(){//提交订单
  490. if(this.confirmParam.addressId == ''){
  491. this.$util.msg('请先添加收货地址~',2000)
  492. return
  493. }
  494. if(this.confirmParam.payInfo.rebateFlag ===2){
  495. if(this.rebateFee == 0){
  496. this.$util.msg('请输入返佣服务费',2000)
  497. return
  498. }
  499. this.confirmParam.payInfo.rebateFee = Number(this.rebateFee).toFixed(2)
  500. }
  501. this.modal = true
  502. this.contentModalText = '请仔细确认订单是否为返佣订单后再提交订单'
  503. },
  504. SellerCreateOrderSubmit(){
  505. //提交订单
  506. if(this.isSubLoading){ return }
  507. this.confirmParam.orderInfo = this.goodsData.map(el => {
  508. let productInfo = []
  509. el.cartList.forEach(pros => {
  510. productInfo.push({
  511. skuId:pros.skuId,
  512. productNum:pros.number,
  513. presentNum:0,
  514. productType:pros.giftType
  515. })
  516. })
  517. return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
  518. })
  519. this.confirmParam.payInfo.postage = parseInt(this.handleFreightData.postage).toFixed(2)
  520. this.confirmParam.payInfo.postageFlag = parseInt(this.handleFreightData.postageFlag)
  521. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  522. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  523. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  524. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  525. this.isSubLoading = true
  526. this.hanldeOrderSubmit(this.confirmParam)
  527. },
  528. hanldeOrderSubmit(params){// 提交订单
  529. this.SellerService.SellerCreateOrderSubmit(params).then(response =>{
  530. const data = response.data
  531. if(data.code === 1){
  532. this.$util.msg('支付成功',2000,true,'success')
  533. setTimeout(() =>{
  534. this.isSubLoading = false
  535. this.$api.redirectTo(`/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.postageParam.userId}`)
  536. },2000)
  537. }else{
  538. this.$util.msg('订单提交成功',2000,true,'success')
  539. setTimeout(()=>{
  540. this.isSubLoading = false
  541. this.$api.redirectTo(`/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.postageParam.userId}`)
  542. },2000)
  543. }
  544. }).catch(error =>{
  545. this.isSubLoading = false
  546. this.handleError(error)
  547. })
  548. },
  549. handleError(data){// 提交订单异常处理
  550. this.formatConfirmParam()
  551. const buttonMap = {
  552. 1:{
  553. contentModalText : '订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。',
  554. modalButton : [
  555. { text: '取消', type: 'gray', plain: true },
  556. { text: '继续提交', customStyle: { color: '#fff', bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)' },plain: false }
  557. ]
  558. }
  559. }
  560. if(data.code === -6){// 非医美机构下三类商品订单
  561. this.modal = true
  562. this.showModalstauts = 2
  563. this.contentModalText = buttonMap[1].contentModalText
  564. this.modalButton= buttonMap[1].modalButton
  565. }else{
  566. this.$util.msg(error.msg,3000)
  567. }
  568. },
  569. formatConfirmParam(){// 还原提交订单参数格式
  570. this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
  571. this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
  572. this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
  573. },
  574. handleRebateFlag(){// 普通订单返佣
  575. let self = this
  576. uni.showActionSheet({
  577. itemList: ['返佣订单', '普通订单,存在返佣服务费','否'],
  578. success: (e) => {
  579. switch(e.tapIndex){
  580. case 0:
  581. self.confirmParam.payInfo.rebateFlag = 1
  582. self.rebateFeeText = '返佣订单'
  583. break
  584. case 1:
  585. self.confirmParam.payInfo.rebateFlag = 2
  586. self.rebateFeeText = '普通订单,存在返佣服务费'
  587. break
  588. case 2:
  589. self.confirmParam.payInfo.rebateFlag = 0
  590. self.rebateFeeText = '否'
  591. break
  592. }
  593. }
  594. })
  595. if(this.confirmParam.payInfo.rebateFlag ===1){
  596. this.confirmParam.payInfo.balancePayFlag = 0
  597. this.couponAmount = 0
  598. this.confirmParam.clubCouponId = 0
  599. this.confirmParam.orderSeen = 2
  600. this.$refs.clubVisible.orderVisibleText = '不可见'
  601. this.$refs.clubVisible.current = 1
  602. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  603. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  604. this.$refs.coupon.coupon.couponAmount = 0
  605. this.$refs.freight.infoData(this.freightData)
  606. this.$refs.freight.freightData = this.freightData
  607. this.handleFreightData = this.freightData
  608. }else{
  609. this.confirmParam.orderSeen = 1
  610. this.$refs.clubVisible.orderVisibleText = '可见'
  611. if(this.couponList.length>0){
  612. this.confirmParam.clubCouponId = this.couponList[0].clubCouponId
  613. this.$refs.coupon.coupon.couponAmount = this.couponAmount = this.couponList[0].couponAmount
  614. }
  615. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  616. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  617. }
  618. },
  619. handleClick(e){
  620. //确认提交
  621. if (e.index == 1) {
  622. if(this.showModalstauts == 2){
  623. this.confirmParam.orderMiniType = 2
  624. this.SellerCreateOrderSubmit()
  625. }else{
  626. this.SellerCreateOrderSubmit()
  627. }
  628. }
  629. this.confirmParam.orderMiniType = 0
  630. this.modal = false
  631. },
  632. handleSecondFlag(){// 二手订单勾选返佣
  633. this.rebatecheck = !this.rebatecheck
  634. if(this.rebatecheck){
  635. this.ischecked = false
  636. this.confirmParam.payInfo.rebateFlag=1
  637. this.confirmParam.payInfo.balancePayFlag = 0
  638. this.confirmParam.clubCouponId = 0
  639. this.confirmParam.orderSeen = 2
  640. this.$refs.clubVisible.orderVisibleText = '不可见'
  641. this.$refs.clubVisible.current = 1
  642. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  643. this.$refs.freight.infoData(this.freightData)
  644. this.$refs.freight.freightData = this.freightData
  645. this.handleFreightData = this.freightData
  646. }else{
  647. this.confirmParam.orderSeen = 1
  648. this.$refs.clubVisible.orderVisibleText = '可见'
  649. this.confirmParam.payInfo.rebateFlag=0
  650. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  651. }
  652. },
  653. handFreightAlertShow(){//显示邮费弹窗
  654. this.isfreightTip = true
  655. },
  656. handleClickCancel(){// 关闭优惠券弹窗
  657. this.isCouponModel = false
  658. this.getInitCrearOrder()
  659. },
  660. hideFreight(){//关闭邮费弹窗
  661. this.isfreightTip = false
  662. },
  663. hideMobel() {
  664. this.modal = false
  665. },
  666. },
  667. onShow() {
  668. let pages = getCurrentPages()
  669. let currPage = pages[pages.length-1]
  670. if(currPage.data.select =='select'){
  671. this.isAddress = true
  672. let SelectData = uni.getStorageSync('selectAddress')
  673. this.confirmParam.addressId = SelectData.addressId
  674. this.postageParam.townId = SelectData.townId
  675. this.addressData = SelectData
  676. this.getFreightData()
  677. }else{
  678. this.getAddressData()
  679. }
  680. }
  681. }
  682. </script>
  683. <style lang="scss">
  684. page {
  685. height: auto;
  686. background:#F7F7F7;
  687. }
  688. .btn-hover{
  689. background: #FFFFFF;
  690. }
  691. .animation{
  692. /* transition: transform 0.3s ease;*/
  693. transition-property: transform;
  694. transition-duration: 0.3s;
  695. transition-timing-function: ease;
  696. }
  697. .invoice-freight{
  698. width: 702rpx;
  699. padding: 0 24rpx;
  700. height: 86rpx;
  701. line-height: 86rpx;
  702. font-size: $font-size-28;
  703. color: $text-color;
  704. background: #FFFFFF;
  705. float: left;
  706. font-weight: bold;
  707. .freight-left{
  708. float: left;
  709. .icon-yunfeishuoming{
  710. height: 100%;
  711. padding: 0 15rpx;
  712. color: $color-system;
  713. font-weight: normal;
  714. }
  715. }
  716. .freight-right{
  717. float: right;
  718. color: #2A81FF;
  719. }
  720. }
  721. .invoice-balance{
  722. width: 702rpx;
  723. height: auto;
  724. padding:0 24rpx;
  725. background: #FFFFFF;
  726. float: left;
  727. margin-top: 24rpx;
  728. margin-bottom: 24rpx;
  729. .balabce-t{
  730. width: 100%;
  731. height: 86rpx;
  732. line-height: 86rpx;
  733. font-size: $font-size-28;
  734. color: $text-color;
  735. float: left;
  736. .balabce-t-le{
  737. float: left;
  738. font-weight: bold;
  739. }
  740. .balabce-t-ri{
  741. float: right;
  742. display: flex;
  743. align-items: center;
  744. .money{
  745. display: flex;
  746. float: left;
  747. }
  748. .checkbox-box{
  749. display: flex;
  750. width: 60rpx;
  751. float: left;
  752. height: 100%;
  753. font-size: $font-size-24;
  754. .checkbox{
  755. width: 40rpx;
  756. text-align: right;
  757. box-sizing: border-box;
  758. text-align: center;
  759. text-decoration: none;
  760. border-radius: 0;
  761. -webkit-tap-highlight-color: transparent;
  762. overflow: hidden;
  763. color: $color-system;
  764. padding: 5rpx;
  765. }
  766. }
  767. }
  768. }
  769. .balabce-b{
  770. width: 100%;
  771. float: left;
  772. overflow: hidden;
  773. .balabce-b-text{
  774. width: 100%;
  775. line-height: 58rpx;
  776. font-size: $font-size-24;
  777. color: #FF2A2A;
  778. text-align: right;
  779. float: right;
  780. }
  781. &.balabce-b--hide {
  782. padding: 0 0;
  783. height: 0px;
  784. line-height: 0px;
  785. }
  786. }
  787. }
  788. .footer{
  789. position: fixed;
  790. left: 0;
  791. bottom: 0;
  792. display: flex;
  793. align-items: center;
  794. width: 100%;
  795. height: 110rpx;
  796. line-height: 110rpx;
  797. justify-content: space-between;
  798. font-size: $font-size-28;
  799. background-color: #FFFFFF;
  800. z-index: 990;
  801. color: $text-color;
  802. .footer-le{
  803. width:570rpx;
  804. height:100%;
  805. float: left;
  806. }
  807. .footer-count{
  808. float: left;
  809. padding-left: 24rpx;
  810. width:190rpx;
  811. box-sizing: border-box;
  812. font-size: $font-size-26;
  813. }
  814. .footer-price{
  815. width:370rpx;
  816. float: right;
  817. text-align: right;
  818. color: $text-color;
  819. padding: 10rpx 20rpx 10rpx 0;
  820. box-sizing: border-box;
  821. .sum-none{
  822. width: 100%;
  823. height: 45rpx;
  824. line-height: 45rpx;
  825. color: $text-color;
  826. float: left;
  827. text-align: right;
  828. .money{
  829. font-size: $font-size-26;
  830. color: #999999;
  831. text-decoration: line-through;
  832. }
  833. .money-sign{
  834. font-size: $font-size-26;
  835. color: #999999;
  836. text-decoration: line-through;
  837. }
  838. .money-reduced{
  839. margin-left: 10rpx;
  840. font-size: $font-size-26;
  841. color:$color-system;
  842. }
  843. }
  844. .sum{
  845. width: 100%;
  846. height: 45rpx;
  847. line-height: 45rpx;
  848. float: left;
  849. &.none{
  850. height: 90rpx;
  851. line-height: 90rpx;
  852. }
  853. .price{
  854. font-size: $font-size-32;
  855. color: #FF2A2A;
  856. }
  857. }
  858. }
  859. .footer-submit{
  860. display:flex;
  861. align-items:center;
  862. justify-content: center;
  863. width: 180rpx;
  864. height: 100%;
  865. box-sizing: border-box;
  866. padding: 15rpx 5rpx;
  867. .btn{
  868. width: 100%;
  869. height: 100%;
  870. color: #FFFFFF;
  871. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  872. font-size: $font-size-26;
  873. text-align: center;
  874. line-height: 80rpx;
  875. border-radius: 40rpx;
  876. &.disabled{
  877. background: #e4e8eb;
  878. color: #999999;
  879. }
  880. }
  881. }
  882. }
  883. .order-return{
  884. width: 100%;
  885. height: auto;
  886. box-sizing: border-box;
  887. padding: 0 24rpx;
  888. background: #FFFFFF;
  889. float: left;
  890. margin: 24rpx 0;
  891. .order-return-main{
  892. width:100%;
  893. height: 86rpx;
  894. line-height: 86rpx;
  895. .label{
  896. float: left;
  897. font-weight: bold;
  898. color: #333333;
  899. font-size: $font-size-28;
  900. }
  901. .label-right{
  902. float: right;
  903. color: #2A81FF;
  904. .text-l{
  905. font-size: 28rpx;
  906. font-weight: bold;
  907. margin-right: 20rpx;
  908. }
  909. .icon-xiayibu{
  910. line-height: 88rpx;
  911. color: #999999;
  912. font-weight: normal;
  913. }
  914. }
  915. }
  916. .order-return-input{
  917. width: 100%;
  918. height: 86rpx;
  919. padding-bottom: 20rpx;
  920. box-sizing: border-box;
  921. .input{
  922. width: 100%;
  923. height: 66rpx;
  924. font-size: $font-size-26;
  925. border: 1px solid #e1e1e1;
  926. line-height: 66rpx;
  927. color: #333333;
  928. border-radius: 4rpx;
  929. box-sizing: border-box;
  930. padding: 0 20rpx;
  931. }
  932. }
  933. }
  934. .Rebate{
  935. width: 702rpx;
  936. height: auto;
  937. padding: 0 24rpx;
  938. background: #FFFFFF;
  939. float: left;
  940. margin-bottom: 24rpx;
  941. margin-top: 24rpx;
  942. line-height: 86rpx;
  943. .rebate-title{
  944. float: left;
  945. font-weight: bold;
  946. color: #333333;
  947. font-size: $font-size-28;
  948. }
  949. .iconfont{
  950. float: right;
  951. color: #b2b2b2;
  952. font-size: 40rpx;
  953. &.icon-yixuanze{
  954. color: $color-system;
  955. }
  956. }
  957. }
  958. .coupon-content-model{
  959. width: 100%;
  960. height: 100%;
  961. background: rgba(0,0,0,.5);
  962. position: fixed;
  963. top: 0;
  964. left: 0;
  965. z-index: 8888;
  966. transition: all 0.4s;
  967. .coupon-alert-content{
  968. width: 600rpx;
  969. height: 612rpx;
  970. position: absolute;
  971. top: 0;
  972. left: 0;
  973. bottom: 0;
  974. right: 0;
  975. margin: auto;
  976. box-sizing: border-box;
  977. padding-top: 92rpx;
  978. .coupon{
  979. width: 600rpx;
  980. height: 522rpx;
  981. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  982. background-size: cover;
  983. box-sizing: border-box;
  984. padding: 230rpx 40rpx 0 40rpx;
  985. .coupon-list{
  986. width: 100%;
  987. height: 147rpx;
  988. margin-bottom: 32rpx;
  989. box-sizing: border-box;
  990. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  991. background-size: cover;
  992. position: relative;
  993. .list-cell-tags{
  994. display: inline-block;
  995. padding: 0 10rpx;
  996. height: 32rpx;
  997. line-height: 32rpx;
  998. background-color: #f94b4b;
  999. color: #FFFFFF;
  1000. font-size: 18rpx;
  1001. border-radius: 16rpx 0 16rpx 0;
  1002. text-align: center;
  1003. position: absolute;
  1004. top: 0;
  1005. left: 0;
  1006. }
  1007. .list-cell-le{
  1008. width: 154rpx;
  1009. height: 100%;
  1010. box-sizing: border-box;
  1011. padding: 30rpx 0;
  1012. float: left;
  1013. .coupon-maxMoney{
  1014. width: 100%;
  1015. height: 54rpx;
  1016. line-height: 54rpx;
  1017. font-size: 42rpx;
  1018. color: #f94b4b;
  1019. text-align: center;
  1020. margin-top: 10rpx;
  1021. .small{
  1022. font-size: $font-size-20;
  1023. }
  1024. }
  1025. .coupon-minMoney{
  1026. width: 100%;
  1027. height: 28rpx;
  1028. float: left;
  1029. box-sizing: border-box;
  1030. padding-left: 24rpx;
  1031. .txt{
  1032. display: block;
  1033. height: 28rpx;
  1034. line-height: 28rpx;
  1035. font-size: 16rpx;
  1036. color: #f94b4b;
  1037. text-align: center;
  1038. padding: 0 5rpx;
  1039. background-color: #fff1eb;
  1040. border-radius: 4rpx;
  1041. float: left;
  1042. }
  1043. }
  1044. }
  1045. .list-cell-ri{
  1046. width: 366rpx;
  1047. height: 100%;
  1048. box-sizing: border-box;
  1049. padding:30rpx 20rpx;
  1050. float: left;
  1051. .list-cell-top{
  1052. width: 100%;
  1053. height: 64rpx;
  1054. line-height: 64rpx;
  1055. font-size: $font-size-26;
  1056. color: #333333;
  1057. float: left;
  1058. text-overflow:ellipsis;
  1059. display: -webkit-box;
  1060. word-break: break-all;
  1061. -webkit-box-orient: vertical;
  1062. -webkit-line-clamp: 1;
  1063. overflow: hidden;
  1064. }
  1065. .list-cell-time{
  1066. width: 100%;
  1067. height: 28rpx;
  1068. line-height: 28rpx;
  1069. text-align: left;
  1070. font-size: $font-size-20;
  1071. color: #999999;
  1072. }
  1073. }
  1074. }
  1075. .coupon-btn{
  1076. width: 100%;
  1077. height: 78rpx;
  1078. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  1079. background-size: cover;
  1080. line-height: 78rpx;
  1081. text-align: center;
  1082. color: #FFFFFF;
  1083. font-size: $font-size-36;
  1084. }
  1085. }
  1086. }
  1087. }
  1088. </style>