create-order.vue 29 KB

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