create-order.vue 33 KB

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