create-order.vue 34 KB

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