sellerDetaileButton.vue 6.3 KB

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