create-order.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  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. let data = JSON.parse(option.data);
  208. console.log('infodata',data)
  209. this.$api.getStorage().then((resolve) =>{
  210. this.productParam.userId = this.cartParam.userId = this.postageParam.userId = resolve.userId ? resolve.userId : 0
  211. this.confirmParam.clubId = resolve.clubId ? resolve.clubId : 0
  212. if(option.type =='prodcut'){
  213. this.confirmType = 1
  214. this.productParam.productCount = data.data.productCount
  215. this.productParam.productId = data.data.productIds
  216. this.productIds = this.postageParam.productIds = data.data.productIds
  217. this.getProductCreateOrderInfo()
  218. }else{
  219. this.confirmType = 2
  220. this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
  221. this.CartCreateOrderInfo()
  222. }
  223. })
  224. },
  225. filters:{
  226. NumFormat(value) {//处理金额
  227. return Number(value).toFixed(2)
  228. },
  229. },
  230. methods: {
  231. getProductCreateOrderInfo(){// 商品立即购买确认订单数据初始化
  232. this.OrderService.ProductCreateOrderInfo(this.productParam).then(response =>{
  233. let data = response.data
  234. this.isRequest = true
  235. this.goodsData = data.list
  236. this.couponList = data.couponList
  237. this.userMoney = data.userMoney
  238. this.reducedPrice = data.reducedPrice
  239. this.totalCount = data.totalCount
  240. this.allPrice = data.totalPrice
  241. this.rechargeGoods = data.rechargeGoods
  242. if(this.couponList.length>0){
  243. this.isCouponShow = true
  244. this.couponAmount = data.couponList[0].couponAmount
  245. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  246. }
  247. this.orderShouldPayFee = this.allPrice - this.couponAmount
  248. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  249. })
  250. .catch(error =>{
  251. this.$util.msg(error.msg,2000)
  252. })
  253. },
  254. CartCreateOrderInfo(){// 购物车去结算确认订单数据初始化
  255. this.OrderService.CartCreateOrderInfo(this.cartParam).then(response =>{
  256. let data = response.data
  257. this.isRequest = true
  258. this.goodsData = data.list
  259. this.couponList = data.couponList
  260. this.userMoney = data.userMoney
  261. this.reducedPrice = data.reducedPrice
  262. this.totalCount = data.totalCount
  263. this.allPrice = data.totalPrice
  264. this.rechargeGoods = data.rechargeGoods
  265. if(this.couponList.length>0){
  266. this.isCouponShow = true
  267. this.couponAmount = data.couponList[0].couponAmount
  268. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  269. }
  270. this.orderShouldPayFee = this.allPrice - this.couponAmount
  271. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  272. })
  273. .catch(error =>{
  274. this.$util.msg(error.msg,2000)
  275. })
  276. },
  277. getFreightData(){// 获取邮费信息
  278. this.isFreight = false
  279. this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
  280. const data = response.data
  281. this.isFreight = true
  282. this.isCheckedBeans = false
  283. this.freightData = data
  284. this.hanldFreePostFlag = data.postageFlag
  285. this.hanldFreight = data.postage
  286. if(this.hanldFreePostFlag == 1){
  287. if( this.freightData.userBeans > 0 ){
  288. this.freightBeansMoney = this.hanldFreight
  289. }else{
  290. this.freightBeansMoney = 0
  291. }
  292. this.orderShouldPayFee = this.allPrice + data.postage
  293. this.attributePallPrice()
  294. this.hanldFreightBeans(this.isCheckedBeans)
  295. }else{
  296. if( this.freightData.userBeans > 0 ){
  297. this.freightBeansMoney = 30
  298. }else{
  299. this.freightBeansMoney = 0
  300. }
  301. this.orderShouldPayFee = this.allPrice
  302. this.attributePallPrice()
  303. this.hanldFreightBeans(this.isCheckedBeans)
  304. }
  305. })
  306. },
  307. getAddressData(){//获取地址信息
  308. this.$api.getStorage().then((resolve) => {
  309. this.UserService.QueryAddressList({pageNum:1,pageSize:1,userId:resolve.userId}).then(response =>{
  310. let data = response.data
  311. this.isAddress = true
  312. this.addressData = {}
  313. if( data.list && data.list.length > 0 ){
  314. this.confirmParam.addressId = data.list[0].addressId;
  315. this.postageParam.townId = data.list[0].townId;
  316. this.addressData = data.list[0];
  317. this.getFreightData()
  318. }else{
  319. this.addressData = this.addressData
  320. }
  321. })
  322. })
  323. },
  324. handChangeInputGoodsList(data){//对应供应商的留言信息
  325. this.goodsData = data
  326. },
  327. handleChoiceaInvoiceData(data){//获取发票信息
  328. this.confirmParam.orderInvoice = data
  329. },
  330. hanldFreightFn(data){//显示邮费弹窗
  331. console.log('邮费信息',data)
  332. switch(data.postageFlag){
  333. case 1:
  334. this.hanldFreight = this.freightData.postage
  335. this.hanldFreePostFlag = data.postageFlag
  336. this.freightBeansMoney = data.freightBeansMoney
  337. this.orderShouldPayFee =this.allPrice + this.hanldFreight
  338. this.attributePallPrice()
  339. this.hanldFreightBeans(this.isCheckedBeans)
  340. break
  341. case -1:
  342. this.hanldFreight = 0
  343. this.hanldFreePostFlag = data.postageFlag
  344. this.freightBeansMoney = data.freightBeansMoney
  345. this.orderShouldPayFee = this.allPrice
  346. this.attributePallPrice()
  347. this.hanldFreightBeans(this.isCheckedBeans)
  348. break
  349. }
  350. },
  351. hanldFreightBeans(data){//是否勾选采美豆抵扣
  352. this.isCheckedBeans = data
  353. if(this.isCheckedBeans){
  354. // 判断如果采美豆大于等于运费*100
  355. if( this.freightData.userBeans > 0 ){
  356. this.confirmParam.payInfo.userBeans = this.freightBeansMoney*100
  357. }else{
  358. this.confirmParam.payInfo.userBeans = 0
  359. }
  360. // 计算抵扣后的总价
  361. if(this.hanldFreePostFlag == 1){
  362. // 如果使用了余额 最终价格
  363. if(this.ischecked){
  364. let totalAmount = this.allPrice - this.couponAmount
  365. if(this.userMoney >= totalAmount){
  366. this.orderShouldPayFee = 0.00
  367. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  368. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  369. }else{
  370. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  371. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  372. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  373. }
  374. }else{
  375. this.orderShouldPayFee = this.allPrice + this.hanldFreight - this.freightBeansMoney - this.couponAmount
  376. }
  377. console.log('抵扣',this.orderShouldPayFee)
  378. }
  379. }else{// 采美豆不抵扣运费
  380. this.confirmParam.payInfo.userBeans = 0
  381. // 不抵扣时计算总价
  382. if(this.hanldFreePostFlag == 1){
  383. this.attributeHashfreight(this.hanldFreight)
  384. }
  385. }
  386. },
  387. handleChoiceaCouponData(data){// 勾选使用优惠券
  388. console.log('优惠券信息',data)
  389. this.couponAmount = data.couponAmount
  390. this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
  391. this.confirmParam.clubCouponId = data.clubCouponId
  392. this.attributePallPrice()
  393. this.hanldFreightBeans(this.isCheckedBeans)
  394. },
  395. checkedBalabce(){//勾选使用余额
  396. if(this.userMoney > 0){
  397. this.ischecked = !this.ischecked
  398. if(this.ischecked){
  399. this.confirmParam.payInfo.balancePayFlag = 1
  400. this.attributePallPrice()
  401. }else{
  402. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){ //如果是有运费时
  403. if(this.isCheckedBeans){
  404. this.orderShouldPayFee = this.allPrice - this.couponAmount
  405. }else{
  406. this.orderShouldPayFee = this.allPrice+parseInt(this.freightData.postage) - this.couponAmount
  407. }
  408. }else{
  409. this.orderShouldPayFee = this.allPrice - this.couponAmount
  410. }
  411. this.confirmParam.payInfo.balancePayFlag = 0
  412. }
  413. console.log('最终订单支付金额',this.orderShouldPayFee)
  414. console.log('优惠券金额',this.couponAmount)
  415. }else{
  416. return
  417. }
  418. },
  419. attributePallPrice(){// 计算价格
  420. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){
  421. this.attributeHashfreight(this.freightData.postage)
  422. }else{
  423. this.attributeNofreight()
  424. }
  425. },
  426. attributeNofreight(){// 计算没有邮费的支付价格
  427. if(this.ischecked){
  428. let totalAmount = this.allPrice - this.couponAmount
  429. if(this.userMoney >= totalAmount){
  430. this.orderShouldPayFee = 0.00
  431. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  432. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  433. }else{
  434. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  435. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  436. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  437. }
  438. }else{
  439. this.orderShouldPayFee = this.allPrice - this.couponAmount;
  440. this.deductMoney = 0.00; // 当前使用
  441. this.surplusMoney = this.userMoney; // 剩余余额
  442. }
  443. console.log('最终订单支付金额',this.orderShouldPayFee)
  444. console.log('优惠券金额',this.couponAmount)
  445. },
  446. attributeHashfreight(postage){// 计算需要邮费的支付价格
  447. console.log()
  448. let totalAmount = this.allPrice + parseInt(postage) - this.couponAmount//计算不包邮的价格 总价等于商品价格+邮费
  449. if(this.ischecked){
  450. if(this.userMoney >= totalAmount){// 全部抵扣
  451. this.orderShouldPayFee =0.00
  452. if(this.isCheckedBeans){// 抵扣运费了
  453. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  454. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额减去当前使用金额
  455. }else{
  456. this.deductMoney = this.allPrice + parseInt(postage)- this.couponAmount // 当前使用金额等于订单金额+运费金额
  457. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  458. }
  459. }else{// 部分抵扣
  460. if(this.isCheckedBeans){// 抵扣运费了
  461. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于总订单金额-账户余额-优惠券金额
  462. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  463. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  464. }else{
  465. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.userMoney - this.couponAmount//订单支付金额等于订单金额+运费-账户余额-优惠券
  466. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  467. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  468. }
  469. }
  470. }else{
  471. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.couponAmount
  472. this.deductMoney = 0.00 // 当前使用金额
  473. this.surplusMoney = this.userMoney // 剩余余额
  474. }
  475. console.log('最终订单支付金额',this.orderShouldPayFee)
  476. console.log('优惠券金额',this.couponAmount)
  477. },
  478. orderSubmitMit(){// 提交订单
  479. if(this.isSubLoading){ return; }
  480. if(this.confirmParam.addressId == ''){
  481. this.$util.msg('请先添加收货地址~',2000)
  482. return
  483. }
  484. this.confirmParam.orderInfo = this.goodsData.map(el => {
  485. let productInfo = [];
  486. el.cartList.forEach(item => {
  487. productInfo.push({
  488. productId:item.productId,
  489. productNum:item.number,
  490. presentNum:0,
  491. productType:item.productType
  492. })
  493. })
  494. return {shopId:el.shopId,note:el.note?el.note:'',productInfo:productInfo}
  495. })
  496. this.confirmParam.payInfo.postage = parseInt(this.hanldFreight).toFixed(2)
  497. this.confirmParam.payInfo.postageFlag = parseInt(this.hanldFreePostFlag)
  498. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  499. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  500. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  501. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  502. console.log(this.confirmParam)
  503. this.isSubLoading = true;
  504. this.OrderService.CreatedOrderSubmit(this.confirmParam).then(response =>{
  505. let data = response.data;
  506. // 友盟埋点收集机构自主提交订单
  507. if(process.env.NODE_ENV != 'development'){
  508. this.$uma.trackEvent('Um_Event_ConfirmOrder', {
  509. Um_Key_PageName: '机构提交订单',
  510. Um_Key_SourcePage: '确认订单',
  511. Um_Key_OrderID:`${data.orderId}`
  512. })
  513. }
  514. console.log('机构提交订单机构提交订单机构提交订单机构提交订单')
  515. if(data.code === 1){
  516. this.submitState ='success'
  517. setTimeout(()=>{
  518. this.isSubLoading = false
  519. },2000)
  520. this.$api.navigateTo(`/pages/user/order/success?data=${JSON.stringify({data:{orderId:data.orderId}})}`)
  521. }else{
  522. this.submitState ='confirm'
  523. this.$util.msg('订单提交成功',3000,true,'success')
  524. setTimeout(()=>{
  525. this.isSubLoading = false
  526. },2000)
  527. setTimeout(()=>{
  528. this.$api.redirectTo(`/pages/user/order/order-payment?type=${this.submitState}&orderId=${data.orderId}`)
  529. },3000)
  530. }
  531. }).catch(error =>{
  532. this.$util.msg(error.msg,3000)
  533. })
  534. },
  535. handFreightAlertShow(){//显示邮费弹窗
  536. this.isfreightTip = true
  537. },
  538. handleClickCancel(){// 关闭优惠券弹窗
  539. this.isCouponModel = false;
  540. if(this.confirmType == 1){
  541. }else{
  542. }
  543. this.getInitCrearOrder();
  544. },
  545. hideFreight(){//关闭邮费弹窗
  546. this.isfreightTip = false
  547. },
  548. },
  549. onShow() {
  550. let pages = getCurrentPages();
  551. let currPage = pages[pages.length-1];
  552. if(currPage.data.select =='select'){
  553. this.isAddress = true
  554. let SelectData = uni.getStorageSync('selectAddress');
  555. this.confirmParam.addressId = SelectData.addressId;
  556. this.postageParam.townId = SelectData.townId
  557. this.addressData = SelectData
  558. this.getFreightData()
  559. }else{
  560. this.getAddressData()
  561. }
  562. }
  563. }
  564. </script>
  565. <style lang="scss">
  566. page {
  567. height: auto;
  568. background:#F7F7F7;
  569. }
  570. .btn-hover{
  571. background: #FFFFFF;
  572. }
  573. .animation{
  574. /* transition: transform 0.3s ease;*/
  575. transition-property: transform;
  576. transition-duration: 0.3s;
  577. transition-timing-function: ease;
  578. }
  579. .order{
  580. padding-bottom: 134rpx;
  581. }
  582. .invoice-freight{
  583. width: 702rpx;
  584. padding: 0 24rpx;
  585. height: auto;
  586. font-size: $font-size-28;
  587. color: $text-color;
  588. background: #FFFFFF;
  589. float: left;
  590. font-weight: bold;
  591. }
  592. .invoice-balance{
  593. width: 702rpx;
  594. height: auto;
  595. padding:0 24rpx;
  596. background: #FFFFFF;
  597. float: left;
  598. margin-top: 24rpx;
  599. margin-bottom: 24rpx;
  600. .balabce-t{
  601. width: 100%;
  602. height: 86rpx;
  603. line-height: 86rpx;
  604. font-size: $font-size-28;
  605. color: $text-color;
  606. float: left;
  607. .balabce-t-le{
  608. float: left;
  609. font-weight: bold;
  610. }
  611. .balabce-t-ri{
  612. float: right;
  613. display: flex;
  614. align-items: center;
  615. .money{
  616. display: flex;
  617. float: left;
  618. }
  619. .checkbox-box{
  620. display: flex;
  621. width: 60rpx;
  622. float: left;
  623. height: 100%;
  624. font-size: $font-size-24;
  625. .checkbox{
  626. width: 40rpx;
  627. text-align: right;
  628. box-sizing: border-box;
  629. text-align: center;
  630. text-decoration: none;
  631. border-radius: 0;
  632. -webkit-tap-highlight-color: transparent;
  633. overflow: hidden;
  634. color: $color-system;
  635. }
  636. }
  637. }
  638. }
  639. .balabce-b{
  640. width: 100%;
  641. float: left;
  642. overflow: hidden;
  643. .balabce-b-text{
  644. width: 100%;
  645. line-height: 58rpx;
  646. font-size: $font-size-24;
  647. color: #FF2A2A;
  648. text-align: right;
  649. float: right;
  650. }
  651. &.balabce-b--hide {
  652. padding: 0 0;
  653. height: 0px;
  654. line-height: 0px;
  655. }
  656. }
  657. }
  658. .footer{
  659. position: fixed;
  660. left: 0;
  661. bottom: 0;
  662. display: flex;
  663. align-items: center;
  664. width: 100%;
  665. height: 110rpx;
  666. line-height: 110rpx;
  667. justify-content: space-between;
  668. font-size: $font-size-28;
  669. background-color: #FFFFFF;
  670. z-index: 990;
  671. color: $text-color;
  672. .footer-le{
  673. width:570rpx;
  674. height:100%;
  675. float: left;
  676. }
  677. .footer-count{
  678. float: left;
  679. padding-left: 24rpx;
  680. width:180rpx;
  681. box-sizing: border-box;
  682. }
  683. .footer-price{
  684. width:370rpx;
  685. float: right;
  686. text-align: right;
  687. color: $text-color;
  688. padding: 10rpx 20rpx 10rpx 0;
  689. box-sizing: border-box;
  690. .sum-none{
  691. width: 100%;
  692. height: 45rpx;
  693. line-height: 45rpx;
  694. color: $text-color;
  695. float: left;
  696. text-align: right;
  697. .money{
  698. font-size: $font-size-26;
  699. color: #999999;
  700. text-decoration: line-through;
  701. }
  702. .money-sign{
  703. font-size: $font-size-26;
  704. color: #999999;
  705. text-decoration: line-through;
  706. }
  707. .money-reduced{
  708. margin-left: 10rpx;
  709. font-size: $font-size-26;
  710. color:#FF2A2A;
  711. }
  712. }
  713. .sum{
  714. width: 100%;
  715. height: 45rpx;
  716. line-height: 45rpx;
  717. float: left;
  718. &.none{
  719. height: 90rpx;
  720. line-height: 90rpx;
  721. }
  722. .price{
  723. font-size: $font-size-32;
  724. color: #FF2A2A;
  725. }
  726. }
  727. }
  728. .footer-submit{
  729. display:flex;
  730. align-items:center;
  731. justify-content: center;
  732. width: 180rpx;
  733. height: 100%;
  734. box-sizing: border-box;
  735. padding: 15rpx 5rpx;
  736. .btn{
  737. width: 100%;
  738. height: 100%;
  739. color: #FFFFFF;
  740. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  741. font-size: $font-size-26;
  742. text-align: center;
  743. line-height: 80rpx;
  744. border-radius: 40rpx;
  745. &.disabled{
  746. background: #e4e8eb;
  747. color: #999999;
  748. }
  749. }
  750. }
  751. }
  752. .coupon-content-model{
  753. width: 100%;
  754. height: 100%;
  755. background: rgba(0,0,0,.5);
  756. position: fixed;
  757. top: 0;
  758. left: 0;
  759. z-index: 8888;
  760. transition: all 0.4s;
  761. .coupon-alert-content{
  762. width: 600rpx;
  763. height: 612rpx;
  764. position: absolute;
  765. top: 0;
  766. left: 0;
  767. bottom: 0;
  768. right: 0;
  769. margin: auto;
  770. box-sizing: border-box;
  771. padding-top: 92rpx;
  772. .coupon{
  773. width: 600rpx;
  774. height: 522rpx;
  775. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  776. background-size: cover;
  777. box-sizing: border-box;
  778. padding: 230rpx 40rpx 0 40rpx;
  779. .coupon-list{
  780. width: 100%;
  781. height: 147rpx;
  782. margin-bottom: 32rpx;
  783. box-sizing: border-box;
  784. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  785. background-size: cover;
  786. position: relative;
  787. .list-cell-tags{
  788. display: inline-block;
  789. padding: 0 10rpx;
  790. height: 32rpx;
  791. line-height: 32rpx;
  792. background-color: #f94b4b;
  793. color: #FFFFFF;
  794. font-size: 18rpx;
  795. border-radius: 16rpx 0 16rpx 0;
  796. text-align: center;
  797. position: absolute;
  798. top: 0;
  799. left: 0;
  800. }
  801. .list-cell-le{
  802. width: 154rpx;
  803. height: 100%;
  804. box-sizing: border-box;
  805. padding: 30rpx 0;
  806. float: left;
  807. .coupon-maxMoney{
  808. width: 100%;
  809. height: 54rpx;
  810. line-height: 54rpx;
  811. font-size: 42rpx;
  812. color: #f94b4b;
  813. text-align: center;
  814. margin-top: 10rpx;
  815. .small{
  816. font-size: $font-size-20;
  817. }
  818. }
  819. .coupon-minMoney{
  820. width: 100%;
  821. height: 28rpx;
  822. float: left;
  823. box-sizing: border-box;
  824. padding-left: 24rpx;
  825. .txt{
  826. display: block;
  827. height: 28rpx;
  828. line-height: 28rpx;
  829. font-size: 16rpx;
  830. color: #f94b4b;
  831. text-align: center;
  832. padding: 0 5rpx;
  833. background-color: #fff1eb;
  834. border-radius: 4rpx;
  835. float: left;
  836. }
  837. }
  838. }
  839. .list-cell-ri{
  840. width: 366rpx;
  841. height: 100%;
  842. box-sizing: border-box;
  843. padding:30rpx 20rpx;
  844. float: left;
  845. .list-cell-top{
  846. width: 100%;
  847. height: 64rpx;
  848. line-height: 64rpx;
  849. font-size: $font-size-26;
  850. color: #333333;
  851. float: left;
  852. text-overflow:ellipsis;
  853. display: -webkit-box;
  854. word-break: break-all;
  855. -webkit-box-orient: vertical;
  856. -webkit-line-clamp: 1;
  857. overflow: hidden;
  858. }
  859. .list-cell-time{
  860. width: 100%;
  861. height: 28rpx;
  862. line-height: 28rpx;
  863. text-align: left;
  864. font-size: $font-size-20;
  865. color: #999999;
  866. }
  867. }
  868. }
  869. .coupon-btn{
  870. width: 100%;
  871. height: 78rpx;
  872. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  873. background-size: cover;
  874. line-height: 78rpx;
  875. text-align: center;
  876. color: #FFFFFF;
  877. font-size: $font-size-36;
  878. }
  879. }
  880. }
  881. }
  882. </style>