sellerDetaileButton.vue 6.3 KB

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