create-order.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  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. if(this.secondflag){
  502. this.modal = true
  503. this.contentModalText = '请仔细确认订单是否为返佣订单后再提交订单'
  504. }else{
  505. this.SellerCreateOrderSubmit()
  506. }
  507. },
  508. handleClick(e){
  509. //确认提交
  510. if (e.index == 1) {
  511. this.SellerCreateOrderSubmit()
  512. }
  513. this.modal = false
  514. },
  515. SellerCreateOrderSubmit(){
  516. //提交订单
  517. if(this.isSubLoading){ return }
  518. this.confirmParam.orderInfo = this.goodsData.map(el => {
  519. let productInfo = []
  520. el.cartList.forEach(item => {
  521. productInfo.push({
  522. productId:item.productId,
  523. productNum:item.number,
  524. presentNum:0,
  525. productType:item.giftType
  526. })
  527. })
  528. return {splitCode:el.splitCode,shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
  529. })
  530. this.confirmParam.payInfo.postage = parseInt(this.handleFreightData.postage).toFixed(2)
  531. this.confirmParam.payInfo.postageFlag = parseInt(this.handleFreightData.postageFlag)
  532. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  533. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  534. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  535. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  536. console.log(this.confirmParam)
  537. this.isSubLoading = true
  538. this.SellerService.SellerCreateOrderSubmit(this.confirmParam).then(response =>{
  539. const data = response.data
  540. if(data.code === 1){
  541. this.$util.msg('支付成功',2000,true,'success')
  542. setTimeout(() =>{
  543. this.isSubLoading = false
  544. this.$api.redirectTo(`/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.postageParam.userId}`)
  545. },2000)
  546. }else{
  547. this.$util.msg('订单提交成功',2000,true,'success')
  548. setTimeout(()=>{
  549. this.isSubLoading = false
  550. this.$api.redirectTo(`/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${this.postageParam.userId}`)
  551. },2000)
  552. }
  553. }).catch(error =>{
  554. this.isSubLoading = false
  555. this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
  556. this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
  557. this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
  558. this.$util.msg(error.msg,2000)
  559. })
  560. },
  561. handleRebateFee(event){// 返佣服务费
  562. let rebateFee = Number(event.detail.value)
  563. this.confirmParam.payInfo.rebateFee = rebateFee.toFixed(2)
  564. },
  565. handleRebateFlag(){// 普通订单返佣
  566. let self = this
  567. uni.showActionSheet({
  568. title:'标题',
  569. itemList: ['返佣订单', '普通订单,存在返佣服务费','否'],
  570. success: (e) => {
  571. switch(e.tapIndex){
  572. case 0:
  573. self.confirmParam.payInfo.rebateFlag = 1
  574. self.rebateFeeText = '返佣订单'
  575. break
  576. case 1:
  577. self.confirmParam.payInfo.rebateFlag = 2
  578. self.rebateFeeText = '普通订单,存在返佣服务费'
  579. break
  580. case 2:
  581. self.confirmParam.payInfo.rebateFlag = 0
  582. self.rebateFeeText = '否'
  583. break
  584. }
  585. }
  586. })
  587. if(this.confirmParam.payInfo.rebateFlag ===1){
  588. this.confirmParam.payInfo.balancePayFlag = 0
  589. this.couponAmount = 0
  590. this.confirmParam.clubCouponId = 0
  591. this.confirmParam.orderSeen = 2
  592. this.$refs.clubVisible.orderVisibleText = '不可见'
  593. this.$refs.clubVisible.current = 1
  594. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  595. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  596. this.$refs.coupon.coupon.couponAmount = 0
  597. this.$refs.freight.infoData(this.freightData)
  598. this.$refs.freight.freightData = this.freightData
  599. this.handleFreightData = this.freightData
  600. }else{
  601. this.confirmParam.orderSeen = 1
  602. this.$refs.clubVisible.orderVisibleText = '可见'
  603. if(this.couponList.length>0){
  604. this.confirmParam.clubCouponId = this.couponList[0].clubCouponId
  605. this.$refs.coupon.coupon.couponAmount = this.couponAmount = this.couponList[0].couponAmount
  606. }
  607. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  608. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  609. }
  610. },
  611. handleSecondFlag(){// 二手订单勾选返佣
  612. this.rebatecheck = !this.rebatecheck
  613. if(this.rebatecheck){
  614. this.ischecked = false
  615. this.confirmParam.payInfo.rebateFlag=1
  616. this.confirmParam.payInfo.balancePayFlag = 0
  617. this.confirmParam.clubCouponId = 0
  618. this.confirmParam.orderSeen = 2
  619. this.$refs.clubVisible.orderVisibleText = '不可见'
  620. this.$refs.clubVisible.current = 1
  621. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  622. this.$refs.freight.infoData(this.freightData)
  623. this.$refs.freight.freightData = this.freightData
  624. this.handleFreightData = this.freightData
  625. }else{
  626. this.confirmParam.orderSeen = 1
  627. this.$refs.clubVisible.orderVisibleText = '可见'
  628. this.confirmParam.payInfo.rebateFlag=0
  629. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  630. }
  631. },
  632. handFreightAlertShow(){//显示邮费弹窗
  633. this.isfreightTip = true
  634. },
  635. handleClickCancel(){// 关闭优惠券弹窗
  636. this.isCouponModel = false
  637. this.getInitCrearOrder()
  638. },
  639. hideFreight(){//关闭邮费弹窗
  640. this.isfreightTip = false
  641. },
  642. hideMobel() {
  643. this.modal = false
  644. },
  645. },
  646. onShow() {
  647. let pages = getCurrentPages()
  648. let currPage = pages[pages.length-1]
  649. if(currPage.data.select =='select'){
  650. this.isAddress = true
  651. let SelectData = uni.getStorageSync('selectAddress')
  652. this.confirmParam.addressId = SelectData.addressId
  653. this.postageParam.townId = SelectData.townId
  654. this.addressData = SelectData
  655. this.getFreightData()
  656. }else{
  657. this.getAddressData()
  658. }
  659. }
  660. }
  661. </script>
  662. <style lang="scss">
  663. page {
  664. height: auto;
  665. background:#F7F7F7;
  666. }
  667. .btn-hover{
  668. background: #FFFFFF;
  669. }
  670. .animation{
  671. /* transition: transform 0.3s ease;*/
  672. transition-property: transform;
  673. transition-duration: 0.3s;
  674. transition-timing-function: ease;
  675. }
  676. .invoice-freight{
  677. width: 702rpx;
  678. padding: 0 24rpx;
  679. height: 86rpx;
  680. line-height: 86rpx;
  681. font-size: $font-size-28;
  682. color: $text-color;
  683. background: #FFFFFF;
  684. float: left;
  685. font-weight: bold;
  686. .freight-left{
  687. float: left;
  688. .icon-yunfeishuoming{
  689. height: 100%;
  690. padding: 0 15rpx;
  691. color: $color-system;
  692. font-weight: normal;
  693. }
  694. }
  695. .freight-right{
  696. float: right;
  697. color: #2A81FF;
  698. }
  699. }
  700. .invoice-balance{
  701. width: 702rpx;
  702. height: auto;
  703. padding:0 24rpx;
  704. background: #FFFFFF;
  705. float: left;
  706. margin-top: 24rpx;
  707. margin-bottom: 24rpx;
  708. .balabce-t{
  709. width: 100%;
  710. height: 86rpx;
  711. line-height: 86rpx;
  712. font-size: $font-size-28;
  713. color: $text-color;
  714. float: left;
  715. .balabce-t-le{
  716. float: left;
  717. font-weight: bold;
  718. }
  719. .balabce-t-ri{
  720. float: right;
  721. display: flex;
  722. align-items: center;
  723. .money{
  724. display: flex;
  725. float: left;
  726. }
  727. .checkbox-box{
  728. display: flex;
  729. width: 60rpx;
  730. float: left;
  731. height: 100%;
  732. font-size: $font-size-24;
  733. .checkbox{
  734. width: 40rpx;
  735. text-align: right;
  736. box-sizing: border-box;
  737. text-align: center;
  738. text-decoration: none;
  739. border-radius: 0;
  740. -webkit-tap-highlight-color: transparent;
  741. overflow: hidden;
  742. color: $color-system;
  743. padding: 5rpx;
  744. }
  745. }
  746. }
  747. }
  748. .balabce-b{
  749. width: 100%;
  750. float: left;
  751. overflow: hidden;
  752. .balabce-b-text{
  753. width: 100%;
  754. line-height: 58rpx;
  755. font-size: $font-size-24;
  756. color: #FF2A2A;
  757. text-align: right;
  758. float: right;
  759. }
  760. &.balabce-b--hide {
  761. padding: 0 0;
  762. height: 0px;
  763. line-height: 0px;
  764. }
  765. }
  766. }
  767. .footer{
  768. position: fixed;
  769. left: 0;
  770. bottom: 0;
  771. display: flex;
  772. align-items: center;
  773. width: 100%;
  774. height: 110rpx;
  775. line-height: 110rpx;
  776. justify-content: space-between;
  777. font-size: $font-size-28;
  778. background-color: #FFFFFF;
  779. z-index: 990;
  780. color: $text-color;
  781. .footer-le{
  782. width:570rpx;
  783. height:100%;
  784. float: left;
  785. }
  786. .footer-count{
  787. float: left;
  788. padding-left: 24rpx;
  789. width:190rpx;
  790. box-sizing: border-box;
  791. font-size: $font-size-26;
  792. }
  793. .footer-price{
  794. width:370rpx;
  795. float: right;
  796. text-align: right;
  797. color: $text-color;
  798. padding: 10rpx 20rpx 10rpx 0;
  799. box-sizing: border-box;
  800. .sum-none{
  801. width: 100%;
  802. height: 45rpx;
  803. line-height: 45rpx;
  804. color: $text-color;
  805. float: left;
  806. text-align: right;
  807. .money{
  808. font-size: $font-size-26;
  809. color: #999999;
  810. text-decoration: line-through;
  811. }
  812. .money-sign{
  813. font-size: $font-size-26;
  814. color: #999999;
  815. text-decoration: line-through;
  816. }
  817. .money-reduced{
  818. margin-left: 10rpx;
  819. font-size: $font-size-26;
  820. color:$color-system;
  821. }
  822. }
  823. .sum{
  824. width: 100%;
  825. height: 45rpx;
  826. line-height: 45rpx;
  827. float: left;
  828. &.none{
  829. height: 90rpx;
  830. line-height: 90rpx;
  831. }
  832. .price{
  833. font-size: $font-size-32;
  834. color: #FF2A2A;
  835. }
  836. }
  837. }
  838. .footer-submit{
  839. display:flex;
  840. align-items:center;
  841. justify-content: center;
  842. width: 180rpx;
  843. height: 100%;
  844. box-sizing: border-box;
  845. padding: 15rpx 5rpx;
  846. .btn{
  847. width: 100%;
  848. height: 100%;
  849. color: #FFFFFF;
  850. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  851. font-size: $font-size-26;
  852. text-align: center;
  853. line-height: 80rpx;
  854. border-radius: 40rpx;
  855. &.disabled{
  856. background: #e4e8eb;
  857. color: #999999;
  858. }
  859. }
  860. }
  861. }
  862. .order-return{
  863. width: 100%;
  864. height: auto;
  865. box-sizing: border-box;
  866. padding: 0 24rpx;
  867. background: #FFFFFF;
  868. float: left;
  869. margin: 24rpx 0;
  870. .order-return-main{
  871. width:100%;
  872. height: 86rpx;
  873. line-height: 86rpx;
  874. .label{
  875. float: left;
  876. font-weight: bold;
  877. color: #333333;
  878. font-size: $font-size-28;
  879. }
  880. .label-right{
  881. float: right;
  882. color: #2A81FF;
  883. .text-l{
  884. font-size: 28rpx;
  885. font-weight: bold;
  886. margin-right: 20rpx;
  887. }
  888. .icon-xiayibu{
  889. line-height: 88rpx;
  890. color: #999999;
  891. font-weight: normal;
  892. }
  893. }
  894. }
  895. .order-return-input{
  896. width: 100%;
  897. height: 86rpx;
  898. padding-bottom: 20rpx;
  899. box-sizing: border-box;
  900. .input{
  901. width: 100%;
  902. height: 66rpx;
  903. font-size: $font-size-26;
  904. border: 1px solid #e1e1e1;
  905. line-height: 66rpx;
  906. color: #333333;
  907. border-radius: 4rpx;
  908. box-sizing: border-box;
  909. padding: 0 20rpx;
  910. }
  911. }
  912. }
  913. .Rebate{
  914. width: 702rpx;
  915. height: auto;
  916. padding: 0 24rpx;
  917. background: #FFFFFF;
  918. float: left;
  919. margin-bottom: 24rpx;
  920. margin-top: 24rpx;
  921. line-height: 86rpx;
  922. .rebate-title{
  923. float: left;
  924. font-weight: bold;
  925. color: #333333;
  926. font-size: $font-size-28;
  927. }
  928. .iconfont{
  929. float: right;
  930. color: #b2b2b2;
  931. font-size: 40rpx;
  932. &.icon-yixuanze{
  933. color: $color-system;
  934. }
  935. }
  936. }
  937. .coupon-content-model{
  938. width: 100%;
  939. height: 100%;
  940. background: rgba(0,0,0,.5);
  941. position: fixed;
  942. top: 0;
  943. left: 0;
  944. z-index: 8888;
  945. transition: all 0.4s;
  946. .coupon-alert-content{
  947. width: 600rpx;
  948. height: 612rpx;
  949. position: absolute;
  950. top: 0;
  951. left: 0;
  952. bottom: 0;
  953. right: 0;
  954. margin: auto;
  955. box-sizing: border-box;
  956. padding-top: 92rpx;
  957. .coupon{
  958. width: 600rpx;
  959. height: 522rpx;
  960. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  961. background-size: cover;
  962. box-sizing: border-box;
  963. padding: 230rpx 40rpx 0 40rpx;
  964. .coupon-list{
  965. width: 100%;
  966. height: 147rpx;
  967. margin-bottom: 32rpx;
  968. box-sizing: border-box;
  969. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  970. background-size: cover;
  971. position: relative;
  972. .list-cell-tags{
  973. display: inline-block;
  974. padding: 0 10rpx;
  975. height: 32rpx;
  976. line-height: 32rpx;
  977. background-color: #f94b4b;
  978. color: #FFFFFF;
  979. font-size: 18rpx;
  980. border-radius: 16rpx 0 16rpx 0;
  981. text-align: center;
  982. position: absolute;
  983. top: 0;
  984. left: 0;
  985. }
  986. .list-cell-le{
  987. width: 154rpx;
  988. height: 100%;
  989. box-sizing: border-box;
  990. padding: 30rpx 0;
  991. float: left;
  992. .coupon-maxMoney{
  993. width: 100%;
  994. height: 54rpx;
  995. line-height: 54rpx;
  996. font-size: 42rpx;
  997. color: #f94b4b;
  998. text-align: center;
  999. margin-top: 10rpx;
  1000. .small{
  1001. font-size: $font-size-20;
  1002. }
  1003. }
  1004. .coupon-minMoney{
  1005. width: 100%;
  1006. height: 28rpx;
  1007. float: left;
  1008. box-sizing: border-box;
  1009. padding-left: 24rpx;
  1010. .txt{
  1011. display: block;
  1012. height: 28rpx;
  1013. line-height: 28rpx;
  1014. font-size: 16rpx;
  1015. color: #f94b4b;
  1016. text-align: center;
  1017. padding: 0 5rpx;
  1018. background-color: #fff1eb;
  1019. border-radius: 4rpx;
  1020. float: left;
  1021. }
  1022. }
  1023. }
  1024. .list-cell-ri{
  1025. width: 366rpx;
  1026. height: 100%;
  1027. box-sizing: border-box;
  1028. padding:30rpx 20rpx;
  1029. float: left;
  1030. .list-cell-top{
  1031. width: 100%;
  1032. height: 64rpx;
  1033. line-height: 64rpx;
  1034. font-size: $font-size-26;
  1035. color: #333333;
  1036. float: left;
  1037. text-overflow:ellipsis;
  1038. display: -webkit-box;
  1039. word-break: break-all;
  1040. -webkit-box-orient: vertical;
  1041. -webkit-line-clamp: 1;
  1042. overflow: hidden;
  1043. }
  1044. .list-cell-time{
  1045. width: 100%;
  1046. height: 28rpx;
  1047. line-height: 28rpx;
  1048. text-align: left;
  1049. font-size: $font-size-20;
  1050. color: #999999;
  1051. }
  1052. }
  1053. }
  1054. .coupon-btn{
  1055. width: 100%;
  1056. height: 78rpx;
  1057. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  1058. background-size: cover;
  1059. line-height: 78rpx;
  1060. text-align: center;
  1061. color: #FFFFFF;
  1062. font-size: $font-size-36;
  1063. }
  1064. }
  1065. }
  1066. }
  1067. </style>