sellerDetaileButton.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" @click.stop="btnConfirm('again',order)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  7. <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view>
  8. <view class="btn btn-cancel" @click.stop="onShareCode">
  9. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  10. 分享订单
  11. </view>
  12. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认订单</view>
  13. <view class="btn btn-color" v-if="btnState.isPay && ableUserMoney > 0 && !rechargeGoods" @click.stop="btnConfirm('balance',order)">余额抵扣</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default{
  19. name:"button",
  20. props:{
  21. status:{
  22. type:Number
  23. },
  24. order: {
  25. type:Object
  26. },
  27. ableUserMoney:{
  28. type:Number
  29. },
  30. rechargeGoods:{
  31. type:Boolean
  32. },
  33. shareCode:{
  34. type:String
  35. },
  36. serviceProviderId:{
  37. type:Number
  38. }
  39. },
  40. watch:{
  41. status:{
  42. handler:function(val){
  43. this.initData(val)
  44. },
  45. deep:true//对象内部的属性监听,也叫深度监听
  46. }
  47. },
  48. data() {
  49. return{
  50. btnState:this.initStatus(),
  51. isIphoneX:this.$store.state.isIphoneX,
  52. invoiceStatus:false,
  53. mapStateArr:[
  54. {label:'isDelete',val:[6],status: true},
  55. {label:'isCancel',val:[0,111],status: true},
  56. {label:'isConfirm',val:[0],status: true},
  57. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  58. ]
  59. }
  60. },
  61. created(){
  62. console.log(this.rechargeGoods);
  63. this.initData(this.status)
  64. },
  65. computed: {
  66. },
  67. methods:{
  68. initData(resVal) {
  69. /**
  70. * @分享按钮统一显示
  71. * @按钮根据状态显示
  72. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  73. * @(6)显示[删除订单],其他隐藏
  74. * @(0、111)显示[取消订单],其他隐藏
  75. * @(21,31)只显示分享
  76. * @(13,33)显示[确认收货]和[查看物流]
  77. */
  78. this.btnState = this.initStatus()
  79. this.mapStateArr.forEach(el => {
  80. el.val.forEach(value => {
  81. if(resVal === value){
  82. this.btnState[el.label] = el.status
  83. //console.log(this.btnState[el.label]);
  84. }
  85. })
  86. })
  87. },
  88. initStatus(){
  89. let btnState= {
  90. isQuery: false,
  91. isDelete: false,
  92. isCancel: false,
  93. isConfirm: false,
  94. isPay: false,
  95. }
  96. return btnState
  97. },
  98. getShareCode(code){
  99. this.shareCode = code
  100. },
  101. onShareCode(){
  102. if(this.order.onlinePayFlag!= '1'){
  103. this.PayService.PayOrderCheckoutCounter({orderId:this.order.orderID}).then(response =>{
  104. let data = response.data.order
  105. this.invoiceStatus = data.invoiceStatus
  106. //判断线上线下显示
  107. if(this.invoiceStatus){
  108. this.$util.modal('提示','由于商品发票属性的限制,本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  109. this.$parent.isShareModal = true
  110. })
  111. }else{
  112. this.$parent.isShareModal = true
  113. }
  114. }).catch(error =>{
  115. this.$util.msg(error.msg,2000)
  116. })
  117. }else{
  118. this.$parent.isShareModal = true
  119. }
  120. // this.$emit('shareConfirm')
  121. },
  122. btnConfirm(type,order){
  123. let data = {
  124. type:type,
  125. orderId:order.orderID,
  126. order:order
  127. }
  128. this.$emit('buttonConfirm',data)
  129. },
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. .button-template{
  135. width: 100%;
  136. height: auto;
  137. position: fixed;
  138. bottom: 0;
  139. left: 0;
  140. background: #FFFFFF;
  141. .button-content{
  142. width: 702rpx;
  143. padding:0 24rpx;
  144. height: auto;
  145. float: left;
  146. position: relative;
  147. margin: 20rpx 0;
  148. .share-code{
  149. width: 200rpx;
  150. height: 64rpx;
  151. line-height: 64rpx;
  152. color: #2A45FF;
  153. text-align: left;
  154. position: absolute;
  155. font-size: $font-size-28;
  156. font-weight: bold;
  157. left: 24rpx;
  158. top: 24rpx;
  159. }
  160. .btn{
  161. width: 160rpx;
  162. height: 64rpx;
  163. // margin:22rpx;
  164. line-height: 64rpx;
  165. font-size:$font-size-26;
  166. color: #FFFFFF;
  167. text-align: center;
  168. border-radius: 34rpx;
  169. float: right;
  170. }
  171. .btn-color{
  172. background: #f94b4b;
  173. // margin: 20rpx 0 20rpx 20rpx;
  174. .tips{
  175. width: 160rpx;
  176. height: 34rpx;
  177. padding: 10rpx 10rpx;
  178. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  179. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  180. border-radius: 8rpx;
  181. position: absolute;
  182. color: #FFFFFF;
  183. line-height: 34rpx;
  184. font-size: $font-size-24;
  185. text-align: left;
  186. right: 24rpx;
  187. top: -45rpx;
  188. &:before{
  189. content: "";
  190. width: 25rpx;
  191. height: 25rpx;
  192. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  193. position: absolute;
  194. bottom: -8rpx;
  195. right: 30rpx;
  196. z-index: -1;
  197. transform:rotate(45deg);
  198. }
  199. }
  200. }
  201. .btn-cancel{
  202. background:#FFFFFF;
  203. color: #666666;
  204. float: left;
  205. // margin: 22rpx 0;
  206. margin-right: 15rpx;
  207. border: 2rpx solid #999999;
  208. }
  209. .btn-delete{
  210. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  211. }
  212. .btn-query{
  213. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  214. }
  215. .btn-confirm{
  216. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  217. }
  218. .btn-share{
  219. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  220. margin-right: 0;
  221. position: relative;
  222. .tips{
  223. width: 160rpx;
  224. height: 34rpx;
  225. padding: 10rpx 10rpx;
  226. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  227. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  228. border-radius: 8rpx;
  229. position: absolute;
  230. color: #FFFFFF;
  231. line-height: 34rpx;
  232. font-size: $font-size-24;
  233. text-align: left;
  234. right: 0;
  235. top: -65rpx;
  236. &:before{
  237. content: "";
  238. width: 25rpx;
  239. height: 25rpx;
  240. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  241. position: absolute;
  242. bottom: -8rpx;
  243. right: 30rpx;
  244. z-index: -1;
  245. transform:rotate(45deg);
  246. }
  247. }
  248. }
  249. }
  250. }
  251. </style>