create-order.vue 30 KB

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