index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <zj-page-layout :hasFooter="true">
  3. <view class="form-container">
  4. <!-- <view class="item" @tap="isShowBrandDialog = true">
  5. <view class="label"><text>*</text>品牌</view>
  6. <view class="picker">
  7. <text class="value" v-if="brand">{{brand.brandName}}</text>
  8. <text class="placeholder" v-else>请选择</text>
  9. <text class="iconfont icon-jinru"></text>
  10. </view>
  11. </view> -->
  12. <view class="item" v-if="type == 'P'" @tap="isShowCategoryDialog = true">
  13. <view class="label"><text>*</text>产品大类</view>
  14. <view class="picker">
  15. <text class="value" v-if="category">{{ category.name }}</text>
  16. <text class="placeholder" v-else>请选择</text>
  17. <text class="iconfont icon-jinru"></text>
  18. </view>
  19. </view>
  20. <!-- <view class="item">
  21. <view class="label"><text>*</text>销售方式</view>
  22. <u-radio-group v-model="salesType">
  23. <u-radio shape="circle" label="外购" :name="'OUT'"></u-radio>
  24. <u-radio shape="circle" label="自有仓库" :name="'OWN'"></u-radio>
  25. </u-radio-group>
  26. </view> -->
  27. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  28. <view class="item">
  29. <view class="label"><text>*</text>客户电话</view>
  30. <!-- :readonly="hasOid" -->
  31. <u--input :maxlength="11" placeholder="请输入" border="none" inputAlign="right" v-model="userMobile"></u--input>
  32. </view>
  33. <view class="item">
  34. <view class="label">工单单号</view>
  35. <u--input
  36. :readonly="!!hasOid"
  37. placeholder="请输入"
  38. border="none"
  39. inputAlign="right"
  40. v-model="orderNo"
  41. ></u--input>
  42. </view>
  43. <view class="item" @tap="hasOid ? '' : (isShowWebsitDialog = true)">
  44. <view class="label"><text>*</text>所属网点</view>
  45. <view class="picker">
  46. <text class="value" v-if="websit">{{ websit.name }}</text>
  47. <text class="placeholder" v-else>请选择工单所属网点</text>
  48. <text class="iconfont icon-jinru"></text>
  49. </view>
  50. </view>
  51. </view>
  52. <template slot="footer">
  53. <view class="footer-btn-group">
  54. <!-- <u-button
  55. text="历史记录"
  56. @click="$navToPage({ url: `/packageMaterial/pages/sale/orderList?type=${type}` })"
  57. ></u-button> -->
  58. <u-button type="primary" text="选择产品" @click="toChooseProduct"></u-button>
  59. </view>
  60. </template>
  61. <zjDialogPicker
  62. ref="brandDialog"
  63. :isShow="isShowBrandDialog"
  64. :multiple="false"
  65. :styleType="2"
  66. :title="'品牌'"
  67. :list="brandList"
  68. :keyName="'brandName'"
  69. @cancel="isShowBrandDialog = false"
  70. @confirm="confirmBrandDialog"
  71. >
  72. </zjDialogPicker>
  73. <zjDialogPicker
  74. ref="categoryDialog"
  75. :isShow="isShowCategoryDialog"
  76. :multiple="false"
  77. :styleType="2"
  78. :title="'产品大类'"
  79. :list="categoryList"
  80. :keyName="'name'"
  81. @cancel="isShowCategoryDialog = false"
  82. @confirm="confirmCategoryDialog"
  83. >
  84. </zjDialogPicker>
  85. <zjDialogPicker
  86. ref="websitDialog"
  87. :isShow="isShowWebsitDialog"
  88. :multiple="false"
  89. :styleType="2"
  90. :title="'所属网点'"
  91. :list="websitList"
  92. :keyName="'name'"
  93. @cancel="isShowWebsitDialog = false"
  94. @confirm="confirmWebsitDialog"
  95. >
  96. </zjDialogPicker>
  97. </zj-page-layout>
  98. </template>
  99. <script>
  100. import zjDialogPicker from '@/components/zj-dialog/zj-dialog-picker.vue'
  101. export default {
  102. components: {
  103. zjDialogPicker
  104. },
  105. data() {
  106. return {
  107. hasOid: false,
  108. wbId: null, // 维保工单
  109. wbIsAllFee: null, // 维保工单是否包含全部费用
  110. wbPayType: null, // 维保工单费用支付方式
  111. type: 'M',
  112. userMobile: '',
  113. orderNo: '',
  114. salesType: 'OUT',
  115. brand: null,
  116. brandList: [],
  117. isShowBrandDialog: false,
  118. category: null,
  119. categoryList: [],
  120. isShowCategoryDialog: false,
  121. websit: null,
  122. websitList: [],
  123. isShowWebsitDialog: false
  124. }
  125. },
  126. onLoad({ type, oid = '' }) {
  127. this.type = type
  128. this.hasOid = oid
  129. uni.setNavigationBarTitle({
  130. title: type == 'M' ? '辅材收款' : '配件收款'
  131. })
  132. this.getBrandList()
  133. this.getWebsitList()
  134. if (type == 'P') {
  135. this.getCategoryList()
  136. }
  137. if (this.hasOid) {
  138. this.$api
  139. .post('/pg/order/base/detail', {
  140. orderBaseId: oid
  141. })
  142. .then(res => {
  143. const data = res.data
  144. this.orderNo = oid
  145. this.userMobile = data.userMobile
  146. this.websit = {
  147. websitId: data.websitId,
  148. name: data.websitName
  149. }
  150. if (data.pgOrderProducts && data.pgOrderProducts.length > 0) {
  151. this.brand = {
  152. id: data.pgOrderProducts[0].brandId,
  153. brandName: data.pgOrderProducts[0].brandName
  154. }
  155. }
  156. this.wbId = data.rpProjectRepairId || ''
  157. this.wbIsAllFee = data.isAllFee || ''
  158. this.wbPayType = data.feePayMethod || ''
  159. })
  160. }
  161. },
  162. methods: {
  163. getBrandList() {
  164. this.$api.post('/pay/getBrand').then(res => {
  165. this.brandList = res.data
  166. })
  167. },
  168. getCategoryList() {
  169. this.$api.post('/pay/getCategoryList').then(res => {
  170. this.categoryList = res.data
  171. })
  172. },
  173. getWebsitList() {
  174. this.$api
  175. .get('/user/apply/websit', {
  176. examineStatus: ['OK', 'EXPIRED']
  177. })
  178. .then(res => {
  179. this.websitList = res.data
  180. if (this.websitList.length == 1) {
  181. this.websit = this.websitList[0]
  182. }
  183. })
  184. },
  185. confirmBrandDialog(e) {
  186. this.brand = this.brandList[e[0]]
  187. this.isShowBrandDialog = false
  188. },
  189. confirmCategoryDialog(e) {
  190. this.category = this.categoryList[e[0]]
  191. this.isShowCategoryDialog = false
  192. },
  193. confirmWebsitDialog(e) {
  194. this.websit = this.websitList[e[0]]
  195. this.isShowWebsitDialog = false
  196. },
  197. toChooseProduct() {
  198. // if(!this.brand) return this.$toast('请选择品牌');
  199. if (this.type == 'P' && !this.category) return this.$toast('请选择产品大类')
  200. if (!this.websit) return this.$toast('请选择所属网点')
  201. if (!this.userMobile) return this.$toast('请输入客户电话')
  202. // if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
  203. // this.$navToPage({
  204. // url: `/packageMaterial/pages/sale/product?type=${this.type}&brandId=${this.brand.id}&brandName=${this.brand.brandName}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&salesType=${this.salesType}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
  205. // })
  206. this.$navToPage({
  207. url: `/packageMaterial/pages/sale/product?type=${this.type}&categoryId=${
  208. this.type == 'P' ? this.category.categoryId : ''
  209. }&categoryName=${this.type == 'P' ? this.category.name : ''}&userMobile=${this.userMobile}&orderNo=${
  210. this.orderNo
  211. }&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId || ''}&wbIsAllFee=${
  212. this.wbIsAllFee || ''
  213. }&wbPayType=${this.wbPayType || ''}`
  214. })
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang="scss" scoped>
  220. .form-container {
  221. background: #ffffff;
  222. margin-top: 20rpx;
  223. border-top: 1px solid #f5f5f5;
  224. .item {
  225. height: 108rpx;
  226. border-bottom: 1px solid #f5f5f5;
  227. display: flex;
  228. align-items: center;
  229. justify-content: space-between;
  230. padding: 0 20rpx;
  231. .label {
  232. margin-right: 30rpx;
  233. min-width: 200rpx;
  234. text {
  235. color: $error-color;
  236. }
  237. }
  238. .picker {
  239. .placeholder {
  240. color: $sec-font;
  241. }
  242. .iconfont {
  243. margin-left: 12rpx;
  244. color: $sec-font;
  245. }
  246. }
  247. ::v-deep .u-radio-group {
  248. flex: unset;
  249. .u-radio {
  250. margin-left: 50rpx;
  251. }
  252. }
  253. }
  254. }
  255. </style>