create-order.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  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" :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" @blur="handleRebateFee($event)" 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 choiceAddress from '@/components/cm-module/creatOrder/sellerAddress'
  152. import sellerGoodsList from '@/components/cm-module/creatOrder/sellerGoodsList'
  153. import sellerInvoice from '@/components/cm-module/creatOrder/sellerInvoice'
  154. import sellerFreight from '@/components/cm-module/creatOrder/sellerFreight'
  155. import freightAlert from '@/components/cm-module/modelAlert/freightAlert.vue'
  156. import sellerCoupon from '@/components/cm-module/creatOrder/sellerCoupon'
  157. import sellerExchangeCoupon from '@/components/cm-module/creatOrder/sellerExchangeCoupon'
  158. import sellerClubVisible from '@/components/cm-module/creatOrder/sellerClubVisible'
  159. import sellerRegulations from '@/components/cm-module/creatOrder/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. isIphoneX:this.$store.state.isIphoneX,
  193. cartParam: {// 购物车立即结算确认订单参数
  194. productIds:0, // 商品Id(逗号隔开)
  195. serviceProviderId:0,// 协销Id
  196. clubId:0 // 机构Id
  197. },
  198. productParam: {// 商品立即购买确认订单参数
  199. productCount:0, // 商品数量
  200. productId:0, // 商品Id
  201. serviceProviderId:0,// 协销Id
  202. clubId:0 // 机构Id
  203. },
  204. postageParam: {// 邮费计算参数
  205. productIds:0, // 商品Id(逗号隔开)
  206. userId:0, // 用户Id
  207. townId:0 // 地区Id
  208. },
  209. confirmParam: {// 提交订单参数
  210. cartType:3, // 购买类型:(1自主下单, 3协销下单)
  211. orderSource:6, // 订单来源 1WWW 6小程序[采美,星范]
  212. addressId:0, // 收货地址Id
  213. clubCouponId:0, // 关联优惠券Id
  214. clubId:0, // 机构Id
  215. orderInfo:[], // 订单商品数据
  216. orderInvoice:{type:0}, // 订单发票信息
  217. orderSeen:1, // 订单对机构可见度 1可见 2不可见
  218. payInfo:{ // 订单金额数据
  219. orderShouldPayFee: 0, // 订单最终支付金额
  220. balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
  221. clauseId:0, // 条款Id
  222. postage: 0, // 运费金额
  223. postageFlag: 0, // 运费类型
  224. userBeans: 0, // 抵扣采美豆数量
  225. rebateFee:0, // 返佣服务费
  226. rebateFlag:0 // 是否返佣订单
  227. },
  228. unionId:uni.getStorageSync('unionId'),// 用户unionId
  229. },
  230. rebateFeeText:'否',
  231. productIds:'', //商品ID,
  232. confirmType:1,
  233. submitState:'', // 提交状态
  234. totalCount:0, // 订单提交总数量
  235. reducedPrice:0, // 满减金额
  236. couponAmount:0, // 优惠券金额
  237. totalDiscountAmount:0, // 共减金额
  238. orderShouldPayFee:0.00, // 订单提交总金额
  239. allPrice:0.00, // 订单总金额
  240. surplusMoney:0.00, // 显示勾选后的剩余抵扣
  241. userMoney:0.00, // 显示可使用余额
  242. deductMoney:0.00, // 显示已使用的余额
  243. isRequest:false, // 是否加载完成渲染子组件
  244. isFreight:false, // 是否加载完成渲染子组件
  245. isAddress:false, // 是否加载完成地址
  246. isExchangePopup:false, // 控制兑换优惠券弹窗
  247. isfreightTip:false, // 控制邮费弹窗
  248. ischecked:false, // 是否勾选余额
  249. addressData:{}, // 初始化地址信息
  250. goodsData:[], // 初始化商品信息
  251. couponList:[], // 初始化优惠券信息
  252. invoiceData:{type:0}, // 初始化发票信息
  253. freightData:{}, // 邮费数据
  254. handleFreightData:{}, // 监听邮费数据
  255. orderInfo:[], // 提交的商品信息
  256. payInfo:{}, // 订单信息
  257. rechargeGoods:false,
  258. clauseList:[],
  259. seconDepositFlg:true,
  260. rebatecheck:false,
  261. isCouponShow:false, // 是否显示可选优惠券
  262. secondflag:true,
  263. isCouponModel:false, // 兑换优惠券成功提示
  264. ExchangeCouponData:{}, // 兑换优惠券信息
  265. }
  266. },
  267. onLoad(option){//商品数据
  268. this.initStorage(option)
  269. },
  270. filters:{
  271. NumFormat(value) {//处理金额
  272. return Number(value).toFixed(2)
  273. },
  274. },
  275. methods: {
  276. async initStorage(option){
  277. const data = JSON.parse(option.data)
  278. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  279. const userInfo = await this.$api.getStorage()
  280. this.productParam.clubId = this.cartParam.clubId = this.confirmParam.clubId = clubInfo.clubId ? clubInfo.clubId : 0
  281. this.postageParam.userId = clubInfo.userId ? clubInfo.userId : 0
  282. this.productParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  283. this.cartParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  284. this.confirmParam.serviceProviderId = userInfo.serviceProviderId ? userInfo.serviceProviderId : 0
  285. if(option.type =='prodcut'){
  286. this.confirmType = 1
  287. this.productParam.productCount = data.data.productCount
  288. this.productParam.productId = data.data.productIds
  289. this.productIds = data.data.productIds
  290. this.getInitProdcutCrearOrder()
  291. }else{
  292. this.confirmType = 2
  293. this.productIds = this.cartParam.productIds = data.data.productIds
  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. // 获取订单商品id列表
  340. getProductIds(list){
  341. const productIds = []
  342. list.forEach(function(supplier){
  343. supplier.cartList.forEach(function(product){
  344. productIds.push(product.productId)
  345. })
  346. })
  347. // console.log(list);
  348. return productIds.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.confirmParam.payInfo.rebateFee == ''){
  497. this.$util.msg('请输入返佣服务费',2000)
  498. return
  499. }
  500. }
  501. this.modal = true
  502. this.contentModalText = '请仔细确认订单是否为返佣订单后再提交订单'
  503. this.SellerCreateOrderSubmit()
  504. },
  505. handleClick(e){
  506. //确认提交
  507. if (e.index == 1) {
  508. this.SellerCreateOrderSubmit()
  509. }
  510. this.modal = false
  511. },
  512. SellerCreateOrderSubmit(){
  513. //提交订单
  514. if(this.isSubLoading){ return }
  515. this.confirmParam.orderInfo = this.goodsData.map(el => {
  516. let productInfo = []
  517. el.cartList.forEach(item => {
  518. productInfo.push({
  519. productId:item.productId,
  520. productNum:item.number,
  521. presentNum:0,
  522. productType:item.giftType
  523. })
  524. })
  525. return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
  526. })
  527. this.confirmParam.payInfo.postage = parseInt(this.handleFreightData.postage).toFixed(2)
  528. this.confirmParam.payInfo.postageFlag = parseInt(this.handleFreightData.postageFlag)
  529. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  530. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  531. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  532. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  533. console.log(this.confirmParam)
  534. this.isSubLoading = true
  535. this.SellerService.SellerCreateOrderSubmit(this.confirmParam).then(response =>{
  536. const data = response.data
  537. if(data.code === 1){
  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. }else{
  544. this.$util.msg('订单提交成功',2000,true,'success')
  545. setTimeout(()=>{
  546. this.isSubLoading = false
  547. this.$api.redirectTo(`/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.postageParam.userId}`)
  548. },2000)
  549. }
  550. }).catch(error =>{
  551. this.isSubLoading = false
  552. this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
  553. this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
  554. this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
  555. this.$util.msg(error.msg,2000)
  556. })
  557. },
  558. handleRebateFee(event){// 返佣服务费
  559. let rebateFee = Number(event.detail.value)
  560. this.confirmParam.payInfo.rebateFee = rebateFee.toFixed(2)
  561. },
  562. handleRebateFlag(){// 普通订单返佣
  563. let self = this
  564. uni.showActionSheet({
  565. title:'标题',
  566. itemList: ['返佣订单', '普通订单,存在返佣服务费','否'],
  567. success: (e) => {
  568. switch(e.tapIndex){
  569. case 0:
  570. self.confirmParam.payInfo.rebateFlag = 1
  571. self.rebateFeeText = '返佣订单'
  572. break
  573. case 1:
  574. self.confirmParam.payInfo.rebateFlag = 2
  575. self.rebateFeeText = '普通订单,存在返佣服务费'
  576. break
  577. case 2:
  578. self.confirmParam.payInfo.rebateFlag = 0
  579. self.rebateFeeText = '否'
  580. break
  581. }
  582. }
  583. })
  584. if(this.confirmParam.payInfo.rebateFlag ===1){
  585. this.confirmParam.payInfo.balancePayFlag = 0
  586. this.couponAmount = 0
  587. this.confirmParam.clubCouponId = 0
  588. this.confirmParam.orderSeen = 2
  589. this.$refs.clubVisible.orderVisibleText = '不可见'
  590. this.$refs.clubVisible.current = 1
  591. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  592. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  593. this.$refs.coupon.coupon.couponAmount = 0
  594. this.$refs.freight.infoData(this.freightData)
  595. this.$refs.freight.freightData = this.freightData
  596. this.handleFreightData = this.freightData
  597. }else{
  598. this.confirmParam.orderSeen = 1
  599. this.$refs.clubVisible.orderVisibleText = '可见'
  600. if(this.couponList.length>0){
  601. this.confirmParam.clubCouponId = this.couponList[0].clubCouponId
  602. this.$refs.coupon.coupon.couponAmount = this.couponAmount = this.couponList[0].couponAmount
  603. }
  604. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  605. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  606. }
  607. },
  608. handleSecondFlag(){// 二手订单勾选返佣
  609. this.rebatecheck = !this.rebatecheck
  610. if(this.rebatecheck){
  611. this.ischecked = false
  612. this.confirmParam.payInfo.rebateFlag=1
  613. this.confirmParam.payInfo.balancePayFlag = 0
  614. this.confirmParam.clubCouponId = 0
  615. this.confirmParam.orderSeen = 2
  616. this.$refs.clubVisible.orderVisibleText = '不可见'
  617. this.$refs.clubVisible.current = 1
  618. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  619. this.$refs.freight.infoData(this.freightData)
  620. this.$refs.freight.freightData = this.freightData
  621. this.handleFreightData = this.freightData
  622. }else{
  623. this.confirmParam.orderSeen = 1
  624. this.$refs.clubVisible.orderVisibleText = '可见'
  625. this.confirmParam.payInfo.rebateFlag=0
  626. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  627. }
  628. },
  629. handFreightAlertShow(){//显示邮费弹窗
  630. this.isfreightTip = true
  631. },
  632. handleClickCancel(){// 关闭优惠券弹窗
  633. this.isCouponModel = false
  634. this.getInitCrearOrder()
  635. },
  636. hideFreight(){//关闭邮费弹窗
  637. this.isfreightTip = false
  638. },
  639. hideMobel() {
  640. this.modal = false
  641. },
  642. },
  643. onShow() {
  644. let pages = getCurrentPages()
  645. let currPage = pages[pages.length-1]
  646. if(currPage.data.select =='select'){
  647. this.isAddress = true
  648. let SelectData = uni.getStorageSync('selectAddress')
  649. this.confirmParam.addressId = SelectData.addressId
  650. this.postageParam.townId = SelectData.townId
  651. this.addressData = SelectData
  652. this.getFreightData()
  653. }else{
  654. this.getAddressData()
  655. }
  656. }
  657. }
  658. </script>
  659. <style lang="scss">
  660. page {
  661. height: auto;
  662. background:#F7F7F7;
  663. }
  664. .btn-hover{
  665. background: #FFFFFF;
  666. }
  667. .animation{
  668. /* transition: transform 0.3s ease;*/
  669. transition-property: transform;
  670. transition-duration: 0.3s;
  671. transition-timing-function: ease;
  672. }
  673. .invoice-freight{
  674. width: 702rpx;
  675. padding: 0 24rpx;
  676. height: 86rpx;
  677. line-height: 86rpx;
  678. font-size: $font-size-28;
  679. color: $text-color;
  680. background: #FFFFFF;
  681. float: left;
  682. font-weight: bold;
  683. .freight-left{
  684. float: left;
  685. .icon-yunfeishuoming{
  686. height: 100%;
  687. padding: 0 15rpx;
  688. color: $color-system;
  689. font-weight: normal;
  690. }
  691. }
  692. .freight-right{
  693. float: right;
  694. color: #2A81FF;
  695. }
  696. }
  697. .invoice-balance{
  698. width: 702rpx;
  699. height: auto;
  700. padding:0 24rpx;
  701. background: #FFFFFF;
  702. float: left;
  703. margin-top: 24rpx;
  704. margin-bottom: 24rpx;
  705. .balabce-t{
  706. width: 100%;
  707. height: 86rpx;
  708. line-height: 86rpx;
  709. font-size: $font-size-28;
  710. color: $text-color;
  711. float: left;
  712. .balabce-t-le{
  713. float: left;
  714. font-weight: bold;
  715. }
  716. .balabce-t-ri{
  717. float: right;
  718. display: flex;
  719. align-items: center;
  720. .money{
  721. display: flex;
  722. float: left;
  723. }
  724. .checkbox-box{
  725. display: flex;
  726. width: 60rpx;
  727. float: left;
  728. height: 100%;
  729. font-size: $font-size-24;
  730. .checkbox{
  731. width: 40rpx;
  732. text-align: right;
  733. box-sizing: border-box;
  734. text-align: center;
  735. text-decoration: none;
  736. border-radius: 0;
  737. -webkit-tap-highlight-color: transparent;
  738. overflow: hidden;
  739. color: $color-system;
  740. padding: 5rpx;
  741. }
  742. }
  743. }
  744. }
  745. .balabce-b{
  746. width: 100%;
  747. float: left;
  748. overflow: hidden;
  749. .balabce-b-text{
  750. width: 100%;
  751. line-height: 58rpx;
  752. font-size: $font-size-24;
  753. color: #FF2A2A;
  754. text-align: right;
  755. float: right;
  756. }
  757. &.balabce-b--hide {
  758. padding: 0 0;
  759. height: 0px;
  760. line-height: 0px;
  761. }
  762. }
  763. }
  764. .footer{
  765. position: fixed;
  766. left: 0;
  767. bottom: 0;
  768. display: flex;
  769. align-items: center;
  770. width: 100%;
  771. height: 110rpx;
  772. line-height: 110rpx;
  773. justify-content: space-between;
  774. font-size: $font-size-28;
  775. background-color: #FFFFFF;
  776. z-index: 990;
  777. color: $text-color;
  778. .footer-le{
  779. width:570rpx;
  780. height:100%;
  781. float: left;
  782. }
  783. .footer-count{
  784. float: left;
  785. padding-left: 24rpx;
  786. width:190rpx;
  787. box-sizing: border-box;
  788. font-size: $font-size-26;
  789. }
  790. .footer-price{
  791. width:370rpx;
  792. float: right;
  793. text-align: right;
  794. color: $text-color;
  795. padding: 10rpx 20rpx 10rpx 0;
  796. box-sizing: border-box;
  797. .sum-none{
  798. width: 100%;
  799. height: 45rpx;
  800. line-height: 45rpx;
  801. color: $text-color;
  802. float: left;
  803. text-align: right;
  804. .money{
  805. font-size: $font-size-26;
  806. color: #999999;
  807. text-decoration: line-through;
  808. }
  809. .money-sign{
  810. font-size: $font-size-26;
  811. color: #999999;
  812. text-decoration: line-through;
  813. }
  814. .money-reduced{
  815. margin-left: 10rpx;
  816. font-size: $font-size-26;
  817. color:$color-system;
  818. }
  819. }
  820. .sum{
  821. width: 100%;
  822. height: 45rpx;
  823. line-height: 45rpx;
  824. float: left;
  825. &.none{
  826. height: 90rpx;
  827. line-height: 90rpx;
  828. }
  829. .price{
  830. font-size: $font-size-32;
  831. color: #FF2A2A;
  832. }
  833. }
  834. }
  835. .footer-submit{
  836. display:flex;
  837. align-items:center;
  838. justify-content: center;
  839. width: 180rpx;
  840. height: 100%;
  841. box-sizing: border-box;
  842. padding: 15rpx 5rpx;
  843. .btn{
  844. width: 100%;
  845. height: 100%;
  846. color: #FFFFFF;
  847. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  848. font-size: $font-size-26;
  849. text-align: center;
  850. line-height: 80rpx;
  851. border-radius: 40rpx;
  852. &.disabled{
  853. background: #e4e8eb;
  854. color: #999999;
  855. }
  856. }
  857. }
  858. }
  859. .order-return{
  860. width: 100%;
  861. height: auto;
  862. box-sizing: border-box;
  863. padding: 0 24rpx;
  864. background: #FFFFFF;
  865. float: left;
  866. margin: 24rpx 0;
  867. .order-return-main{
  868. width:100%;
  869. height: 86rpx;
  870. line-height: 86rpx;
  871. .label{
  872. float: left;
  873. font-weight: bold;
  874. color: #333333;
  875. font-size: $font-size-28;
  876. }
  877. .label-right{
  878. float: right;
  879. color: #2A81FF;
  880. .text-l{
  881. font-size: 28rpx;
  882. font-weight: bold;
  883. margin-right: 20rpx;
  884. }
  885. .icon-xiayibu{
  886. line-height: 88rpx;
  887. color: #999999;
  888. font-weight: normal;
  889. }
  890. }
  891. }
  892. .order-return-input{
  893. width: 100%;
  894. height: 86rpx;
  895. padding-bottom: 20rpx;
  896. box-sizing: border-box;
  897. .input{
  898. width: 100%;
  899. height: 66rpx;
  900. font-size: $font-size-26;
  901. border: 1px solid #e1e1e1;
  902. line-height: 66rpx;
  903. color: #333333;
  904. border-radius: 4rpx;
  905. box-sizing: border-box;
  906. padding: 0 20rpx;
  907. }
  908. }
  909. }
  910. .Rebate{
  911. width: 702rpx;
  912. height: auto;
  913. padding: 0 24rpx;
  914. background: #FFFFFF;
  915. float: left;
  916. margin-bottom: 24rpx;
  917. margin-top: 24rpx;
  918. line-height: 86rpx;
  919. .rebate-title{
  920. float: left;
  921. font-weight: bold;
  922. color: #333333;
  923. font-size: $font-size-28;
  924. }
  925. .iconfont{
  926. float: right;
  927. color: #b2b2b2;
  928. font-size: 40rpx;
  929. &.icon-yixuanze{
  930. color: $color-system;
  931. }
  932. }
  933. }
  934. .coupon-content-model{
  935. width: 100%;
  936. height: 100%;
  937. background: rgba(0,0,0,.5);
  938. position: fixed;
  939. top: 0;
  940. left: 0;
  941. z-index: 8888;
  942. transition: all 0.4s;
  943. .coupon-alert-content{
  944. width: 600rpx;
  945. height: 612rpx;
  946. position: absolute;
  947. top: 0;
  948. left: 0;
  949. bottom: 0;
  950. right: 0;
  951. margin: auto;
  952. box-sizing: border-box;
  953. padding-top: 92rpx;
  954. .coupon{
  955. width: 600rpx;
  956. height: 522rpx;
  957. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  958. background-size: cover;
  959. box-sizing: border-box;
  960. padding: 230rpx 40rpx 0 40rpx;
  961. .coupon-list{
  962. width: 100%;
  963. height: 147rpx;
  964. margin-bottom: 32rpx;
  965. box-sizing: border-box;
  966. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  967. background-size: cover;
  968. position: relative;
  969. .list-cell-tags{
  970. display: inline-block;
  971. padding: 0 10rpx;
  972. height: 32rpx;
  973. line-height: 32rpx;
  974. background-color: #f94b4b;
  975. color: #FFFFFF;
  976. font-size: 18rpx;
  977. border-radius: 16rpx 0 16rpx 0;
  978. text-align: center;
  979. position: absolute;
  980. top: 0;
  981. left: 0;
  982. }
  983. .list-cell-le{
  984. width: 154rpx;
  985. height: 100%;
  986. box-sizing: border-box;
  987. padding: 30rpx 0;
  988. float: left;
  989. .coupon-maxMoney{
  990. width: 100%;
  991. height: 54rpx;
  992. line-height: 54rpx;
  993. font-size: 42rpx;
  994. color: #f94b4b;
  995. text-align: center;
  996. margin-top: 10rpx;
  997. .small{
  998. font-size: $font-size-20;
  999. }
  1000. }
  1001. .coupon-minMoney{
  1002. width: 100%;
  1003. height: 28rpx;
  1004. float: left;
  1005. box-sizing: border-box;
  1006. padding-left: 24rpx;
  1007. .txt{
  1008. display: block;
  1009. height: 28rpx;
  1010. line-height: 28rpx;
  1011. font-size: 16rpx;
  1012. color: #f94b4b;
  1013. text-align: center;
  1014. padding: 0 5rpx;
  1015. background-color: #fff1eb;
  1016. border-radius: 4rpx;
  1017. float: left;
  1018. }
  1019. }
  1020. }
  1021. .list-cell-ri{
  1022. width: 366rpx;
  1023. height: 100%;
  1024. box-sizing: border-box;
  1025. padding:30rpx 20rpx;
  1026. float: left;
  1027. .list-cell-top{
  1028. width: 100%;
  1029. height: 64rpx;
  1030. line-height: 64rpx;
  1031. font-size: $font-size-26;
  1032. color: #333333;
  1033. float: left;
  1034. text-overflow:ellipsis;
  1035. display: -webkit-box;
  1036. word-break: break-all;
  1037. -webkit-box-orient: vertical;
  1038. -webkit-line-clamp: 1;
  1039. overflow: hidden;
  1040. }
  1041. .list-cell-time{
  1042. width: 100%;
  1043. height: 28rpx;
  1044. line-height: 28rpx;
  1045. text-align: left;
  1046. font-size: $font-size-20;
  1047. color: #999999;
  1048. }
  1049. }
  1050. }
  1051. .coupon-btn{
  1052. width: 100%;
  1053. height: 78rpx;
  1054. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  1055. background-size: cover;
  1056. line-height: 78rpx;
  1057. text-align: center;
  1058. color: #FFFFFF;
  1059. font-size: $font-size-36;
  1060. }
  1061. }
  1062. }
  1063. }
  1064. </style>