order-confirm.vue 34 KB

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