create-order.vue 29 KB

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