product.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="jz_agentProduct">
  3. <view class="agentProduct-bg"><image src="../../../static/product10.png"></image></view>
  4. <view class="productcontent uni-flex uni-column ">
  5. <view class="uni-flex content-top align-items">
  6. <view class="img uni-flex justify-align-center" @click="goMerchProduct"><image :src="product.pic"></image></view>
  7. <view class="messages uni-flex uni-column">
  8. <view class="product-title">{{ product.title }}</view>
  9. <view class="uni-flex">
  10. <view class="salePrice">{{ product.salePrice }}</view>
  11. <view class="marketPrice">{{ product.marketPrice }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="uni-flex-item content-bottom align-items uni-flex">
  16. <view class="area">地区</view>
  17. <input :value="pickerText" class="uni-flex-item" disabled name="area" placeholder="选择地区" @click="showMulLinkageThreePicker" />
  18. <view class="search uni-flex justify-align-center" @click="search">
  19. <image src="../../../static/search02.png"></image>
  20. <view class="btnTitle">搜索</view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="agentMessage uni-flex uni-column ">
  25. <view class="messageItem uni-flex align-items itemTitle">代理信息</view>
  26. <view class="messageItem uni-flex align-items" v-for="(item, index) in areaArr" :key="index" v-if="areaArr.length > 0">
  27. <view class="circle"></view>
  28. <view class="">{{ item.areaStr }}</view>
  29. </view>
  30. <view class="messageItem uni-flex align-items noMessage space-between" v-if="key == '' && areaArr.length == 0"><view class="uni-flex">暂无</view></view>
  31. <view class="messageItem uni-flex align-items noMessage space-between" v-if="key != '' && areaArr.length == 0">
  32. <view class="uni-flex">当前区域可申请代理</view>
  33. <view class="agencyBtn uni-flex justify-align-center" @click="goAgency">点击申请</view>
  34. </view>
  35. </view>
  36. <mpvue-city-picker
  37. :themeColor="themeColor"
  38. ref="mpvueCityPicker"
  39. :pickerValueDefault="cityPickerValueDefault"
  40. @onCancel="onCancel"
  41. @onConfirm="onConfirm"
  42. @onReset="onReset"
  43. ></mpvue-city-picker>
  44. </view>
  45. </template>
  46. <script>
  47. import { mapState, mapMutations } from 'vuex';
  48. import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
  49. export default {
  50. computed: {
  51. ...mapState(['hasLogin', 'forcedLogin', 'jyyUser'])
  52. },
  53. data() {
  54. return {
  55. key: '',
  56. id: 0,
  57. product: {
  58. title: '',
  59. salePrice: '',
  60. marketPrice: ''
  61. },
  62. areaArr: [],
  63. cityPickerValueDefault: [0, 0, 1],
  64. themeColor: '#007AFF',
  65. pickerText: '',
  66. address: {},
  67. agency: {}
  68. };
  69. },
  70. components: {
  71. mpvueCityPicker
  72. },
  73. onBackPress() {
  74. if (this.$refs.mpvueCityPicker.showPicker) {
  75. this.$refs.mpvueCityPicker.pickerCancel();
  76. return true;
  77. }
  78. },
  79. onUnload() {
  80. if (this.$refs.mpvueCityPicker.showPicker) {
  81. this.$refs.mpvueCityPicker.pickerCancel();
  82. }
  83. },
  84. onLoad(e) {
  85. this.id = e.id;
  86. this.init();
  87. },
  88. methods: {
  89. goAgency() {
  90. let agent = {};
  91. agent = this.agency;
  92. agent.productId = this.id;
  93. agent.productTitle = this.product.title;
  94. agent.productPic = this.product.pic;
  95. agent.address = this.key;
  96. uni.navigateTo({
  97. url: 'applyfor?agency=' + encodeURIComponent(JSON.stringify(agent))
  98. });
  99. },
  100. goMerchProduct() {
  101. uni.navigateTo({
  102. url: '../../merchant/product/product?id=' + this.id
  103. });
  104. },
  105. showMulLinkageThreePicker() {
  106. this.$refs.mpvueCityPicker.show();
  107. },
  108. onCancel(e) {
  109. //console.log(e)
  110. },
  111. onReset() {
  112. this.pickerText = '';
  113. },
  114. onConfirm(e) {
  115. this.agency = e;
  116. this.pickerText = e.label;
  117. this.address.province = e.value[0];
  118. this.address.city = e.value[1];
  119. this.address.district = e.value[2];
  120. this.address.siteStr = e.label;
  121. },
  122. init() {
  123. this.getData();
  124. this.getAgentArea();
  125. },
  126. search() {
  127. this.key = this.pickerText;
  128. this.getAgentArea();
  129. },
  130. getData() {
  131. uni.showLoading({
  132. title: '加载中'
  133. });
  134. uni.request({
  135. url: this.webUrl + 'Product',
  136. method: 'POST',
  137. data: {
  138. id: this.id,
  139. key: this.key
  140. },
  141. header: {
  142. 'content-type': 'application/x-www-form-urlencoded'
  143. },
  144. success: res => {
  145. uni.hideLoading();
  146. if (res.data.result.isSuccess) {
  147. this.product = res.data.result.product;
  148. } else {
  149. uni.showModal({
  150. title: '系统提示',
  151. content: res.data.result.resultInfo
  152. });
  153. }
  154. },
  155. fail: () => {},
  156. complete: () => {}
  157. });
  158. },
  159. getAgentArea() {
  160. uni.showLoading({
  161. title: '加载中'
  162. });
  163. uni.request({
  164. url: this.webUrl + 'ProductAgency',
  165. method: 'POST',
  166. data: {
  167. id: this.id,
  168. key: this.pickerText
  169. },
  170. header: {
  171. 'content-type': 'application/x-www-form-urlencoded'
  172. },
  173. success: res => {
  174. uni.hideLoading();
  175. this.areaArr = res.data.data;
  176. },
  177. fail: () => {},
  178. complete: () => {}
  179. });
  180. }
  181. }
  182. };
  183. </script>
  184. <style>
  185. .content {
  186. text-align: center;
  187. height: 400upx;
  188. }
  189. .logo {
  190. height: 200upx;
  191. width: 200upx;
  192. margin-top: 200upx;
  193. }
  194. .title {
  195. font-size: 36upx;
  196. color: #8f8f94;
  197. }
  198. .jz_agentProduct .agencyBtn {
  199. border-radius: 8upx;
  200. }
  201. </style>