create-order.vue 32 KB

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